[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Z73XxMwvFYjA0_6s@smile.fi.intel.com>
Date: Tue, 25 Feb 2025 16:46:28 +0200
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Bartosz Golaszewski <brgl@...ev.pl>
Cc: Linus Walleij <linus.walleij@...aro.org>,
Marek Szyprowski <m.szyprowski@...sung.com>,
linux-gpio@...r.kernel.org, linux-kernel@...r.kernel.org,
Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
Subject: Re: [PATCH 1/3] gpiolib: don't use gpiochip_get_direction() when
registering a chip
On Tue, Feb 25, 2025 at 03:43:29PM +0100, Bartosz Golaszewski wrote:
> On Tue, Feb 25, 2025 at 2:22 PM Andy Shevchenko
> <andriy.shevchenko@...ux.intel.com> wrote:
> > On Tue, Feb 25, 2025 at 12:56:23PM +0100, Bartosz Golaszewski wrote:
> > > During chip registration we should neither check the return value of
> > > gc->get_direction() nor hold the SRCU lock when calling it. The former
> > > is because pin controllers may have pins set to alternate functions and
> > > return errors from their get_direction() callbacks. That's alright - we
> > > should default to the safe INPUT state and not bail-out. The latter is
> > > not needed because we haven't registered the chip yet so there's nothing
> > > to protect against dynamic removal. In fact: we currently hit a lockdep
> > > splat. Revert to calling the gc->get_direction() callback directly not
> > > not checking its value.
...
> > I think the below code deserves a commit (as a summary of the above commit
> > message).
>
> Can you rephrase? I'm not getting this one.
Ah, s/commit/comment/
> > > + if (gc->get_direction && gpiochip_line_is_valid(gc, desc_index))
> > > + assign_bit(FLAG_IS_OUT, &desc->flags,
> > > + !gc->get_direction(gc, desc_index));
> > > + else
> > > assign_bit(FLAG_IS_OUT,
> > > &desc->flags, !gc->direction_input);
> >
> > Otherwise LGTM,
> > Reviewed-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists