[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMRc=McrXEQbwcsK3yrfROujezjMd1L4EcJj7GNTCE5L6zD1gw@mail.gmail.com>
Date: Wed, 20 Sep 2023 02:33:04 -0700
From: Bartosz Golaszewski <brgl@...ev.pl>
To: Linus Walleij <linus.walleij@...aro.org>
Cc: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
linux-gpio@...r.kernel.org, linux-kernel@...r.kernel.org,
Bartosz Golaszewski <bartosz.golaszewski@...aro.org>,
Bartosz Golaszewski <brgl@...ev.pl>
Subject: Re: [PATCH] gpiolib: extend the critical sections of lookup tables
On Wed, 20 Sep 2023 11:12:58 +0200, Linus Walleij
<linus.walleij@...aro.org> said:
> On Wed, Sep 20, 2023 at 10:56 AM Bartosz Golaszewski <brgl@...ev.pl> wrote:
>
>> From: Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
>>
>> There are two places in the code where we retrieve a lookup table using
>> gpiod_find_lookup_table() (which protects the table list with the lookup
>> table lock) and then use it after the lock is released.
>>
>> We need to keep the lookup table mutex locked the entire time we're using
>> the tables. Remove the locking from gpiod_find_lookup_table() and use
>> guards to protect the code actually using the table objects.
>>
>> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
>
> I convinced myself that this change is correct, good find!
>
>> @@ -3822,8 +3822,6 @@ static struct gpiod_lookup_table *gpiod_find_lookup_table(struct device *dev)
>
> Can we rename this function gpiod_find_lookup_table_locked()
> as per precedents in the kernel, to indicate that it needs to be
> called with a lock held?
>
I think you mean gpiod_find_lookup_table_unlocked() as with this change it
will no longer take the lock?
Bart
> Either way:
> Reviewed-by: Linus Walleij <linus.walleij@...aro.org>
>
> Yours,
> Linus Walleij
>
Powered by blists - more mailing lists