From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Bartosz Golaszewski <brgl@bgdev.pl>
Cc: Linus Walleij <linus.walleij@linaro.org>,
Marek Szyprowski <m.szyprowski@samsung.com>,
linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Subject: Re: [PATCH 1/3] gpiolib: don't use gpiochip_get_direction() when registering a chip
Date: Tue, 25 Feb 2025 16:46:28 +0200 [thread overview]
Message-ID: <Z73XxMwvFYjA0_6s@smile.fi.intel.com> (raw)
In-Reply-To: <CAMRc=MdTKCtwrDouTV4YHoWa1F8cenSVEtTXicSUdrmEk3TxCQ@mail.gmail.com>
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@linux.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@linux.intel.com>
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2025-02-25 14:46 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-25 11:56 [PATCH 0/3] gpiolib: fix bugs in retval sanitization Bartosz Golaszewski
2025-02-25 11:56 ` [PATCH 1/3] gpiolib: don't use gpiochip_get_direction() when registering a chip Bartosz Golaszewski
2025-02-25 13:22 ` Marek Szyprowski
2025-02-25 13:22 ` Andy Shevchenko
2025-02-25 14:43 ` Bartosz Golaszewski
2025-02-25 14:46 ` Andy Shevchenko [this message]
2025-02-25 11:56 ` [PATCH 2/3] gpiolib: use a more explicit retval logic in gpiochip_get_direction() Bartosz Golaszewski
2025-02-25 13:19 ` Andy Shevchenko
2025-02-25 11:56 ` [PATCH 3/3] gpiolib: don't double-check the gc->get callback's existence Bartosz Golaszewski
2025-02-25 13:20 ` Andy Shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Z73XxMwvFYjA0_6s@smile.fi.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=bartosz.golaszewski@linaro.org \
--cc=brgl@bgdev.pl \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®