Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1491188
| From | Bartosz Golaszewski <bgolaszewski@baylibre.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH] gpio: pca953x: add a comment explaining the need for a lockdep subclass |
| Date | 2016-09-26 12:00 +0200 |
| Message-ID | <slARA-2d9-17@gated-at.bofh.it> (permalink) |
| References | <slARz-2d9-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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>
---
drivers/gpio/gpio-pca953x.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c
index 018f39c..f306909 100644
--- a/drivers/gpio/gpio-pca953x.c
+++ b/drivers/gpio/gpio-pca953x.c
@@ -786,6 +786,22 @@ static int pca953x_probe(struct i2c_client *client,
chip->chip_type = PCA_CHIP_TYPE(chip->driver_data);
mutex_init(&chip->i2c_lock);
+ /*
+ * In case we have an i2c-mux controlled by a GPIO provided by an
+ * expander using the same driver higher on the device tree, read the
+ * i2c adapter nesting depth and use the retrieved value as lockdep
+ * subclass for chip->i2c_lock.
+ *
+ * REVISIT: This solution is not complete. It protects us from lockdep
+ * false positives when the expander controlling the i2c-mux is on
+ * a different level on the device tree, but not when it's on the same
+ * level on a different branch (in which case the subclass number
+ * would be the same).
+ *
+ * TODO: Once a correct solution is developed, a similar fix should be
+ * applied to all other i2c-controlled GPIO expanders (and potentially
+ * regmap-i2c).
+ */
lockdep_set_subclass(&chip->i2c_lock,
i2c_adapter_depth(client->adapter));
--
2.7.4
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] gpio: pca953x: add a comment explaining the need for a lockdep subclass Bartosz Golaszewski <bgolaszewski@baylibre.com> - 2016-09-26 12:00 +0200
[PATCH] gpio: pca953x: add a comment explaining the need for a lockdep subclass Bartosz Golaszewski <bgolaszewski@baylibre.com> - 2016-09-26 12:00 +0200
Re: [PATCH] gpio: pca953x: add a comment explaining the need for a lockdep subclass Wolfram Sang <wsa@the-dreams.de> - 2016-09-26 12:10 +0200
Re: [PATCH] gpio: pca953x: add a comment explaining the need for a lockdep subclass Wolfram Sang <wsa@the-dreams.de> - 2016-09-29 08:10 +0200
Re: [PATCH] gpio: pca953x: add a comment explaining the need for a lockdep subclass Bartosz Golaszewski <bgolaszewski@baylibre.com> - 2016-09-29 10:00 +0200
Re: [PATCH] gpio: pca953x: add a comment explaining the need for a lockdep subclass Wolfram Sang <wsa@the-dreams.de> - 2016-09-29 10:10 +0200
Re: [PATCH] gpio: pca953x: add a comment explaining the need for a lockdep subclass Linus Walleij <linus.walleij@linaro.org> - 2016-10-04 14:20 +0200
Re: [PATCH] gpio: pca953x: add a comment explaining the need for a lockdep subclass Wolfram Sang <wsa@the-dreams.de> - 2016-10-12 09:10 +0200
csiph-web