Re: [PATCH 1/7] gpio: bd9571mwv: normalize return value of gpio_get
From: Dmitry Torokhov
Date: Wed Feb 18 2026 - 16:03:32 EST
On Wed, Feb 18, 2026 at 09:23:38PM +0100, Bartosz Golaszewski wrote:
> On Wed, Feb 18, 2026 at 8:07 PM Dmitry Torokhov
> <dmitry.torokhov@xxxxxxxxx> wrote:
> >
> > The GPIO get callback is expected to return 0 or 1 (or a negative error
> > code). Ensure that the value returned by bd9571mwv_gpio_get() is
> > normalized to the [0, 1] range.
> >
> > Signed-off-by: Dmitry Torokhov <dmitry.torokhov@xxxxxxxxx>
> > ---
> > drivers/gpio/gpio-bd9571mwv.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpio/gpio-bd9571mwv.c b/drivers/gpio/gpio-bd9571mwv.c
> > index 7c95bb36511e..cc5b1746f2fe 100644
> > --- a/drivers/gpio/gpio-bd9571mwv.c
> > +++ b/drivers/gpio/gpio-bd9571mwv.c
> > @@ -69,7 +69,7 @@ static int bd9571mwv_gpio_get(struct gpio_chip *chip, unsigned int offset)
> > if (ret < 0)
> > return ret;
> >
> > - return val & BIT(offset);
> > + return !!(val & BIT(offset));
> > }
> >
> > static int bd9571mwv_gpio_set(struct gpio_chip *chip, unsigned int offset,
> > --
> > 2.53.0.335.g19a08e0c02-goog
> >
>
> Thanks for doing this. I think it would make sense to backport them
> all the way to commit 86ef402d805d ("gpiolib: sanitize the return
> value of gpio_chip::get()")?
I do not think this is workable since the breakages are not limited to
dtivers/gpio/.
I would recommend reverting the patch for stable, but keeping it for 7.0
and working with maintainers outside of drivers/gpio to make sure the
fixes land in this release cycle.
This way you will ensure that new drivers are not adding tech debt while
not punishing existing users who might not be running latest and
greatest kernel.
Thanks.
--
Dmitry