aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBartosz Golaszewski <bgolaszewski@baylibre.com>2016-09-26 05:54:15 -0400
committerWolfram Sang <wsa@the-dreams.de>2016-10-11 17:17:08 -0400
commit74f47f07e53daeca1d16812fa7c9bf3145bd8216 (patch)
tree2d3e391673d544148dc5956ee85fb175cb43d4ce
parentde34f4da7f62ff59ac6e1ef320b0fcfa3296fce3 (diff)
gpio: pca953x: add a comment explaining the need for a lockdep subclass
This is a follow-up to commit 559b46990e76 ("gpio: pca953x: fix an incorrect lockdep warning"). The reason for calling lockdep_set_subclass() in pca953x_probe() is not explained in the code. Add a comment describing the problem, partial solution and required future extensions. Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> Acked-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
-rw-r--r--drivers/gpio/gpio-pca953x.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c
index 45c8817d068c..e422568e14ad 100644
--- a/drivers/gpio/gpio-pca953x.c
+++ b/drivers/gpio/gpio-pca953x.c
@@ -794,6 +794,22 @@ static int pca953x_probe(struct i2c_client *client,
794 } 794 }
795 795
796 mutex_init(&chip->i2c_lock); 796 mutex_init(&chip->i2c_lock);
797 /*
798 * In case we have an i2c-mux controlled by a GPIO provided by an
799 * expander using the same driver higher on the device tree, read the
800 * i2c adapter nesting depth and use the retrieved value as lockdep
801 * subclass for chip->i2c_lock.
802 *
803 * REVISIT: This solution is not complete. It protects us from lockdep
804 * false positives when the expander controlling the i2c-mux is on
805 * a different level on the device tree, but not when it's on the same
806 * level on a different branch (in which case the subclass number
807 * would be the same).
808 *
809 * TODO: Once a correct solution is developed, a similar fix should be
810 * applied to all other i2c-controlled GPIO expanders (and potentially
811 * regmap-i2c).
812 */
797 lockdep_set_subclass(&chip->i2c_lock, 813 lockdep_set_subclass(&chip->i2c_lock,
798 i2c_adapter_depth(client->adapter)); 814 i2c_adapter_depth(client->adapter));
799 815