[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMRc=McuKNg5r7m6OPtwYc3er7i6JB2JN=H6QVJU_G9BVtnuAA@mail.gmail.com>
Date: Mon, 25 Sep 2023 16:24:20 +0200
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>
Subject: Re: [PATCH] gpiolib: extend the critical sections of lookup tables
On Wed, Sep 20, 2023 at 2:51 PM Bartosz Golaszewski <brgl@...ev.pl> wrote:
>
> On Wed, 20 Sep 2023 12:58:58 +0200, Linus Walleij <linus.walleij@...aro.org> said:
> > On Wed, Sep 20, 2023 at 11:33 AM Bartosz Golaszewski <brgl@...ev.pl> wrote:
> >> 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:
> >
> >> > 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?
> >
> > I think the pattern is the one I indicated: *_locked() means the function
> > is to be called with the appropriate lock held, cf
> > arch/arm64/kvm/hyp/nvhe/mm.c
> >
> > pkvm_create_mappings() takes a lock and then calls
> > pkvm_create_mappings_locked() which even asserts that
> > the lock is held.
> >
>
> Ha! I always though the pattern is to call the functions that *DON'T* take
> the lock _unlocked(). This is what I used in gpiolib-cdev.c or gpio-sim.c.
>
> I guess both conventions make sense in some way.
>
> Bart
I don't think I will be doing it just now. We don't use this
convention elsewhere in drivers/gpio/ and we'll have a lot of locking
reworked soon anyway. We may get to it when that is done.
Bart
Powered by blists - more mailing lists