[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZWjN_oYS3JANyx7u@smile.fi.intel.com>
Date: Thu, 30 Nov 2023 20:01:34 +0200
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Bartosz Golaszewski <brgl@...ev.pl>
Cc: Linus Walleij <linus.walleij@...aro.org>,
linux-gpio@...r.kernel.org, linux-kernel@...r.kernel.org,
Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
Subject: Re: [PATCH v2 10/10] gpiolib: remove gpiochip_is_requested()
On Thu, Nov 30, 2023 at 06:46:20PM +0100, Bartosz Golaszewski wrote:
> On Thu, Nov 30, 2023 at 5:46 PM Andy Shevchenko
> <andriy.shevchenko@...ux.intel.com> wrote:
> > On Thu, Nov 30, 2023 at 02:46:30PM +0100, Bartosz Golaszewski wrote:
...
> > > - cpy = kstrdup(label, GFP_KERNEL);
> > > - if (!cpy)
> > > - return ERR_PTR(-ENOMEM);
> > > + scoped_guard(spinlock_irqsave, &gpio_lock) {
> > > + if (!test_bit(FLAG_REQUESTED, &desc->flags))
> > > + return NULL;
> >
> > > + cpy = kstrdup(desc->label, GFP_KERNEL);
> > > + if (!cpy)
> > > + return ERR_PTR(-ENOMEM);
> >
> > You just introduced these lines earlier in the series, and here you moved
> > them again. With guard() instead it may be kept in a better shape.
> >
>
> I wanted to limit the critical section to a minimum hence scoped
> variant. And this will go away as soon as we have a desc lock so it's
> temporary anyway. What matters to me is how the code looks when
> sending it to Torvalds. On the off chance that we don't get the
> locking rework merged in time for v6.8, I want this to at least be
> under the existing lock.
guard() here is equally scoped, no? And what's wrong with that when gets
to Torvalds? He accepted your guard() cases last time IIRC.
> > > + }
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists