RE: [PATCH v2 3/4] pinctrl: renesas: rzt2h: fix reading pin value in IRQ function

From: Cosmin-Gabriel Tanislav

Date: Sun Sep 13 2026 - 03:56:04 EST


> From: Andy Shevchenko <andriy.shevchenko@xxxxxxxxx>
> Sent: Sunday, September 13, 2026 10:52 AM
>
> [You don't often get email from andriy.shevchenko@xxxxxxxxx. Learn why this is important at
> https://aka.ms/LearnAboutSenderIdentification ]
>
> On Thu, Sep 10, 2026 at 07:02:25PM +0300, Cosmin Tanislav wrote:
> > rzt2h_gpio_get() only reports a level for pins in input or output mode
> > and returns -EINVAL otherwise. When a pin is requested as an interrupt
> > it is switched to IRQ function and its I/O mode is set to Hi-Z, so its
> > value can no longer be read.
> >
> > gpiolib calls gpiod_get_value_cansleep() to determine the edge's
> > direction when a line is watched with GPIO_V2_LINE_FLAG_EDGE_BOTH.
> > Non-zero values are translated to a rising edge, zero to a falling edge.
> >
> > Since gpiod_get_value_cansleep() ends up calling rzt2h_gpio_get() which
> > returns -EINVAL when the pin is in IRQ function, every edge is reported
> > as rising.
> >
> > When using the IRQ function, the input buffers are enabled and the PINm
> > registers reflect the live state of the input.
> >
> > Report the input level even when the pin is used as an IRQ.
>
> ...
>
> > +static u8 rzt2h_pin_read_pfc(struct rzt2h_pinctrl *pctrl, u8 port, u8 pin)
> > +{
> > + u64 reg64 = rzt2h_pinctrl_readq(pctrl, port, PFC(port));
> > +
> > + return field_get(PFC_PIN_MASK(pin), reg64);
> > +}
>
> This is a dead code. Add it when it has users.
> Especially this is weird to have in the patch with Fixes tag and Cc to stable@.
> Bad rebase?
>

I forgot to move it further in the chain when the original usage (which
used to be in this patch) was removed...

Sorry about that, I'll send a new version to fix it.

> --
> With Best Regards,
> Andy Shevchenko
>