Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1491187 > unrolled thread

[PATCH] gpio: pca953x: add a comment explaining the need for a lockdep subclass

Started byBartosz Golaszewski <bgolaszewski@baylibre.com>
First post2016-09-26 12:00 +0200
Last post2016-10-12 09:10 +0200
Articles 8 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [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

#1491187 — [PATCH] gpio: pca953x: add a comment explaining the need for a lockdep subclass

FromBartosz Golaszewski <bgolaszewski@baylibre.com>
Date2016-09-26 12:00 +0200
Subject[PATCH] gpio: pca953x: add a comment explaining the need for a lockdep subclass
Message-ID<slARz-2d9-5@gated-at.bofh.it>
Since there's an rc8 I thought I'd send a follow-up patch to the
series addressing the lockdep false positive in pca953x.

The reason for setting the subclass in the probe function is not
explained in the code nor is it obvious at first glance. This patch
adds a comment explaining the problem.

Rebased on top of current i2c/for-next.

Bartosz Golaszewski (1):
  gpio: pca953x: add a comment explaining the need for a lockdep
    subclass

 drivers/gpio/gpio-pca953x.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

-- 
2.7.4

[toc] | [next] | [standalone]


#1491188

FromBartosz Golaszewski <bgolaszewski@baylibre.com>
Date2016-09-26 12:00 +0200
Message-ID<slARA-2d9-17@gated-at.bofh.it>
In reply to#1491187
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

[toc] | [prev] | [next] | [standalone]


#1491194 — Re: [PATCH] gpio: pca953x: add a comment explaining the need for a lockdep subclass

FromWolfram Sang <wsa@the-dreams.de>
Date2016-09-26 12:10 +0200
SubjectRe: [PATCH] gpio: pca953x: add a comment explaining the need for a lockdep subclass
Message-ID<slB1f-2w1-13@gated-at.bofh.it>
In reply to#1491188

[Multipart message — attachments visible in raw view] — view raw

On Mon, Sep 26, 2016 at 11:54:15AM +0200, Bartosz Golaszewski wrote:
> 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: Wolfram Sang <wsa@the-dreams.de>

Linus, because of dependencies, I should probably pick it up?

[toc] | [prev] | [next] | [standalone]


#1493146 — Re: [PATCH] gpio: pca953x: add a comment explaining the need for a lockdep subclass

FromWolfram Sang <wsa@the-dreams.de>
Date2016-09-29 08:10 +0200
SubjectRe: [PATCH] gpio: pca953x: add a comment explaining the need for a lockdep subclass
Message-ID<smCHD-hA-1@gated-at.bofh.it>
In reply to#1491194

[Multipart message — attachments visible in raw view] — view raw

On Mon, Sep 26, 2016 at 12:00:30PM +0200, Wolfram Sang wrote:
> On Mon, Sep 26, 2016 at 11:54:15AM +0200, Bartosz Golaszewski wrote:
> > 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: Wolfram Sang <wsa@the-dreams.de>
> 
> Linus, because of dependencies, I should probably pick it up?

Linus, ping!

[toc] | [prev] | [next] | [standalone]


#1493184 — Re: [PATCH] gpio: pca953x: add a comment explaining the need for a lockdep subclass

FromBartosz Golaszewski <bgolaszewski@baylibre.com>
Date2016-09-29 10:00 +0200
SubjectRe: [PATCH] gpio: pca953x: add a comment explaining the need for a lockdep subclass
Message-ID<smEq6-19I-9@gated-at.bofh.it>
In reply to#1493146
2016-09-29 8:06 GMT+02:00 Wolfram Sang <wsa@the-dreams.de>:
> On Mon, Sep 26, 2016 at 12:00:30PM +0200, Wolfram Sang wrote:
>> On Mon, Sep 26, 2016 at 11:54:15AM +0200, Bartosz Golaszewski wrote:
>> > 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: Wolfram Sang <wsa@the-dreams.de>
>>
>> Linus, because of dependencies, I should probably pick it up?
>
> Linus, ping!
>

Hi Wolfram,

this patch will not apply to the gpio tree. If Linus is too busy to
comment, maybe you could pick it up anyway - it doesn't change
anything in terms of functionality and it's better to have the code
commented when it's not obvious what it does.

Thanks,
Bartosz

[toc] | [prev] | [next] | [standalone]


#1493189 — Re: [PATCH] gpio: pca953x: add a comment explaining the need for a lockdep subclass

FromWolfram Sang <wsa@the-dreams.de>
Date2016-09-29 10:10 +0200
SubjectRe: [PATCH] gpio: pca953x: add a comment explaining the need for a lockdep subclass
Message-ID<smEzL-1sy-9@gated-at.bofh.it>
In reply to#1493184

[Multipart message — attachments visible in raw view] — view raw

On Thu, Sep 29, 2016 at 09:56:58AM +0200, Bartosz Golaszewski wrote:
> 2016-09-29 8:06 GMT+02:00 Wolfram Sang <wsa@the-dreams.de>:
> > On Mon, Sep 26, 2016 at 12:00:30PM +0200, Wolfram Sang wrote:
> >> On Mon, Sep 26, 2016 at 11:54:15AM +0200, Bartosz Golaszewski wrote:
> >> > 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: Wolfram Sang <wsa@the-dreams.de>
> >>
> >> Linus, because of dependencies, I should probably pick it up?
> >
> > Linus, ping!
> >
> 
> Hi Wolfram,
> 
> this patch will not apply to the gpio tree. If Linus is too busy to
> comment, maybe you could pick it up anyway - it doesn't change
> anything in terms of functionality and it's better to have the code
> commented when it's not obvious what it does.

I want to pick it up and am likely to do so anyway, but to be formally
perfect, I need an ack from Linus.

[toc] | [prev] | [next] | [standalone]


#1495397 — Re: [PATCH] gpio: pca953x: add a comment explaining the need for a lockdep subclass

FromLinus Walleij <linus.walleij@linaro.org>
Date2016-10-04 14:20 +0200
SubjectRe: [PATCH] gpio: pca953x: add a comment explaining the need for a lockdep subclass
Message-ID<sowRr-2BB-11@gated-at.bofh.it>
In reply to#1491194
On Mon, Sep 26, 2016 at 12:00 PM, Wolfram Sang <wsa@the-dreams.de> wrote:
> On Mon, Sep 26, 2016 at 11:54:15AM +0200, Bartosz Golaszewski wrote:
>> 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: Wolfram Sang <wsa@the-dreams.de>
>
> Linus, because of dependencies, I should probably pick it up?

Yes Acked-by: Linus Walleij <linus.walleij@linaro.org>

Sorry was travelling.

Yours,
Linus Walleij

[toc] | [prev] | [next] | [standalone]


#1499394 — Re: [PATCH] gpio: pca953x: add a comment explaining the need for a lockdep subclass

FromWolfram Sang <wsa@the-dreams.de>
Date2016-10-12 09:10 +0200
SubjectRe: [PATCH] gpio: pca953x: add a comment explaining the need for a lockdep subclass
Message-ID<srlPQ-12Y-27@gated-at.bofh.it>
In reply to#1491188

[Multipart message — attachments visible in raw view] — view raw

On Mon, Sep 26, 2016 at 11:54:15AM +0200, Bartosz Golaszewski wrote:
> 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>

Applied to for-current, thanks!

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web