* [PATCH] pinctrl: renesas: rza1: normalize return value of gpio_get
@ 2026-02-18 20:58 Dmitry Torokhov
2026-02-19 7:46 ` Andy Shevchenko
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Dmitry Torokhov @ 2026-02-18 20:58 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Linus Walleij, Bartosz Golaszewski, Andy Shevchenko, Marek Vasut,
linux-renesas-soc, linux-gpio, linux-kernel
The GPIO get callback is expected to return 0 or 1 (or a negative error
code). Ensure that the value returned by rza1_gpio_get() is normalized
to the [0, 1] range.
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
drivers/pinctrl/renesas/pinctrl-rza1.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pinctrl/renesas/pinctrl-rza1.c b/drivers/pinctrl/renesas/pinctrl-rza1.c
index 3cfa4c8be80e..d83c7d8ee82c 100644
--- a/drivers/pinctrl/renesas/pinctrl-rza1.c
+++ b/drivers/pinctrl/renesas/pinctrl-rza1.c
@@ -589,7 +589,7 @@ static inline unsigned int rza1_get_bit(struct rza1_port *port,
{
void __iomem *mem = RZA1_ADDR(port->base, reg, port->id);
- return ioread16(mem) & BIT(bit);
+ return !!(ioread16(mem) & BIT(bit));
}
/**
--
2.53.0.335.g19a08e0c02-goog
--
Dmitry
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH] pinctrl: renesas: rza1: normalize return value of gpio_get 2026-02-18 20:58 [PATCH] pinctrl: renesas: rza1: normalize return value of gpio_get Dmitry Torokhov @ 2026-02-19 7:46 ` Andy Shevchenko 2026-02-19 10:39 ` Bartosz Golaszewski 2026-02-24 9:04 ` Linus Walleij 2 siblings, 0 replies; 6+ messages in thread From: Andy Shevchenko @ 2026-02-19 7:46 UTC (permalink / raw) To: Dmitry Torokhov Cc: Geert Uytterhoeven, Linus Walleij, Bartosz Golaszewski, Andy Shevchenko, Marek Vasut, linux-renesas-soc, linux-gpio, linux-kernel On Wed, Feb 18, 2026 at 12:58:09PM -0800, Dmitry Torokhov wrote: > The GPIO get callback is expected to return 0 or 1 (or a negative error > code). Ensure that the value returned by rza1_gpio_get() is normalized > to the [0, 1] range. Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> -- With Best Regards, Andy Shevchenko ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] pinctrl: renesas: rza1: normalize return value of gpio_get 2026-02-18 20:58 [PATCH] pinctrl: renesas: rza1: normalize return value of gpio_get Dmitry Torokhov 2026-02-19 7:46 ` Andy Shevchenko @ 2026-02-19 10:39 ` Bartosz Golaszewski 2026-02-24 9:04 ` Linus Walleij 2 siblings, 0 replies; 6+ messages in thread From: Bartosz Golaszewski @ 2026-02-19 10:39 UTC (permalink / raw) To: Dmitry Torokhov Cc: Linus Walleij, Bartosz Golaszewski, Andy Shevchenko, Marek Vasut, linux-renesas-soc, linux-gpio, linux-kernel, Geert Uytterhoeven On Wed, 18 Feb 2026 21:58:09 +0100, Dmitry Torokhov <dmitry.torokhov@gmail.com> said: > The GPIO get callback is expected to return 0 or 1 (or a negative error > code). Ensure that the value returned by rza1_gpio_get() is normalized > to the [0, 1] range. > > Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> > --- > drivers/pinctrl/renesas/pinctrl-rza1.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/pinctrl/renesas/pinctrl-rza1.c b/drivers/pinctrl/renesas/pinctrl-rza1.c > index 3cfa4c8be80e..d83c7d8ee82c 100644 > --- a/drivers/pinctrl/renesas/pinctrl-rza1.c > +++ b/drivers/pinctrl/renesas/pinctrl-rza1.c > @@ -589,7 +589,7 @@ static inline unsigned int rza1_get_bit(struct rza1_port *port, > { > void __iomem *mem = RZA1_ADDR(port->base, reg, port->id); > > - return ioread16(mem) & BIT(bit); > + return !!(ioread16(mem) & BIT(bit)); > } > > /** > -- > 2.53.0.335.g19a08e0c02-goog > > > -- > Dmitry > Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com> ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] pinctrl: renesas: rza1: normalize return value of gpio_get 2026-02-18 20:58 [PATCH] pinctrl: renesas: rza1: normalize return value of gpio_get Dmitry Torokhov 2026-02-19 7:46 ` Andy Shevchenko 2026-02-19 10:39 ` Bartosz Golaszewski @ 2026-02-24 9:04 ` Linus Walleij 2026-03-10 6:16 ` Dmitry Torokhov 2 siblings, 1 reply; 6+ messages in thread From: Linus Walleij @ 2026-02-24 9:04 UTC (permalink / raw) To: Dmitry Torokhov Cc: Geert Uytterhoeven, Bartosz Golaszewski, Andy Shevchenko, Marek Vasut, linux-renesas-soc, linux-gpio, linux-kernel On Wed, Feb 18, 2026 at 9:58 PM Dmitry Torokhov <dmitry.torokhov@gmail.com> wrote: > The GPIO get callback is expected to return 0 or 1 (or a negative error > code). Ensure that the value returned by rza1_gpio_get() is normalized > to the [0, 1] range. > > Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Reviewed-by: Linus Walleij <linusw@kernel.org> I expect Geert will pick this up, else tell me & I'll queue it. Yours, Linus Walleij ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] pinctrl: renesas: rza1: normalize return value of gpio_get 2026-02-24 9:04 ` Linus Walleij @ 2026-03-10 6:16 ` Dmitry Torokhov 2026-03-10 8:21 ` Geert Uytterhoeven 0 siblings, 1 reply; 6+ messages in thread From: Dmitry Torokhov @ 2026-03-10 6:16 UTC (permalink / raw) To: Linus Walleij, Geert Uytterhoeven Cc: Geert Uytterhoeven, Bartosz Golaszewski, Andy Shevchenko, Marek Vasut, linux-renesas-soc, linux-gpio, linux-kernel On Tue, Feb 24, 2026 at 10:04:15AM +0100, Linus Walleij wrote: > On Wed, Feb 18, 2026 at 9:58 PM Dmitry Torokhov > <dmitry.torokhov@gmail.com> wrote: > > > The GPIO get callback is expected to return 0 or 1 (or a negative error > > code). Ensure that the value returned by rza1_gpio_get() is normalized > > to the [0, 1] range. > > > > Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> > > Reviewed-by: Linus Walleij <linusw@kernel.org> > > I expect Geert will pick this up, else tell me & I'll queue it. Geert, will you pick it up please? Thanks. -- Dmitry ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] pinctrl: renesas: rza1: normalize return value of gpio_get 2026-03-10 6:16 ` Dmitry Torokhov @ 2026-03-10 8:21 ` Geert Uytterhoeven 0 siblings, 0 replies; 6+ messages in thread From: Geert Uytterhoeven @ 2026-03-10 8:21 UTC (permalink / raw) To: Dmitry Torokhov Cc: Linus Walleij, Bartosz Golaszewski, Andy Shevchenko, Marek Vasut, linux-renesas-soc, linux-gpio, linux-kernel Hi Dmitry, On Tue, 10 Mar 2026 at 07:16, Dmitry Torokhov <dmitry.torokhov@gmail.com> wrote: > On Tue, Feb 24, 2026 at 10:04:15AM +0100, Linus Walleij wrote: > > On Wed, Feb 18, 2026 at 9:58 PM Dmitry Torokhov > > <dmitry.torokhov@gmail.com> wrote: > > > > > The GPIO get callback is expected to return 0 or 1 (or a negative error > > > code). Ensure that the value returned by rza1_gpio_get() is normalized > > > to the [0, 1] range. > > > > > > Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> > > > > Reviewed-by: Linus Walleij <linusw@kernel.org> > > > > I expect Geert will pick this up, else tell me & I'll queue it. > > Geert, will you pick it up please? Sorry, I am seriously running behind with patch review. I hadn't realized this is a serious issue, but apparently the 0/1 behavior is enforced since commit 86ef402d805d606a ("gpiolib: sanitize the return value of gpio_chip::get()"), thus rendering the RZ/A1 GPIO driver broken since v6.15-rc1. Unfortunately this doesn't show up in my limited boot testing of RSK+RZA1 :-( So: Fixes: 86ef402d805d606a ("gpiolib: sanitize the return value of gpio_chip::get()") Oh, that got relaxed again in commit ec2cceadfae72304 ("gpiolib: normalize the return value of gc->get() on behalf of buggy drivers") in v7.0-rc3, so apparently we're not the only ones... BTW, that's all info I would have liked to see before ;-) Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> i.e. will queue in renesas-pinctrl-fixes for v7.0. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-03-10 8:22 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-02-18 20:58 [PATCH] pinctrl: renesas: rza1: normalize return value of gpio_get Dmitry Torokhov 2026-02-19 7:46 ` Andy Shevchenko 2026-02-19 10:39 ` Bartosz Golaszewski 2026-02-24 9:04 ` Linus Walleij 2026-03-10 6:16 ` Dmitry Torokhov 2026-03-10 8:21 ` Geert Uytterhoeven
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox