[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMRc=Mdq6ACsxW95+rinRYh-HAxtbWsT7KxDq1M+H4C8Q8zJ5A@mail.gmail.com>
Date: Mon, 14 Oct 2024 10:41:20 +0200
From: Bartosz Golaszewski <brgl@...ev.pl>
To: Kent Gibson <warthog618@...il.com>
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 2/6] gpio: cdev: prepare gpio_desc_to_lineinfo() for
being called from atomic
On Mon, Oct 14, 2024 at 10:32 AM Kent Gibson <warthog618@...il.com> wrote:
>
> On Mon, Oct 14, 2024 at 09:45:19AM +0200, Bartosz Golaszewski wrote:
> > On Mon, Oct 14, 2024 at 3:58 AM Kent Gibson <warthog618@...il.com> wrote:
> > >
> > > On Thu, Oct 10, 2024 at 11:10:23AM +0200, Bartosz Golaszewski wrote:
> > > > From: Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
> > > >
> > > > In order to prepare gpio_desc_to_lineinfo() to being called from atomic
> > > > context, add a new argument - bool atomic - which, if set, indicates
> > > > that no sleeping functions must be called (currently: only
> > > > pinctrl_gpio_can_use_line()).
> > > >
> > > > Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
> > > > ---
> > > > unsigned long dflags;
> > > > const char *label;
> > > > @@ -2402,9 +2402,13 @@ static void gpio_desc_to_lineinfo(struct gpio_desc *desc,
> > > > test_bit(FLAG_USED_AS_IRQ, &dflags) ||
> > > > test_bit(FLAG_EXPORT, &dflags) ||
> > > > test_bit(FLAG_SYSFS, &dflags) ||
> > > > - !gpiochip_line_is_valid(guard.gc, info->offset) ||
> > > > - !pinctrl_gpio_can_use_line(guard.gc, info->offset))
> > > > + !gpiochip_line_is_valid(guard.gc, info->offset))
> > > > info->flags |= GPIO_V2_LINE_FLAG_USED;
> > > > +
> > > > + if (!atomic) {
> > > > + if (!pinctrl_gpio_can_use_line(guard.gc, info->offset))
> > > > + info->flags |= GPIO_V2_LINE_FLAG_USED;
> > > > + }
> > > >
> > >
> > > Should be else if.
> > >
> >
> > If we're not atomic, let's call pinctrl_gpio_can_use_line() and update
> > the flag accordingly. If we're in atomic, just don't do it. In any
> > case do the rest. Looks good to me, am I missing something?
> >
>
> Previously the preceding if short circuits and doesn't perform the
> pinctl check if ANY of the preceding checks are true.
> The pinctrl check should be in an else-if to get the same behaviour.
>
> I am refering to the if (!atomic), btw, not the if in its body.
> (that is why my comment is placed after the closing bracket)
>
Ok, got it.
Bartosz
Powered by blists - more mailing lists