RE: [PATCH v3 7/8] pinctrl: renesas: rzg2l: Simplify rzg2l_pinctrl_set_mux()
From: Biju Das
Date: Tue Apr 28 2026 - 14:42:46 EST
Hi Geert,
Thanks for the feedback.
> -----Original Message-----
> From: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>
> Sent: 28 April 2026 14:20
> Subject: Re: [PATCH v3 7/8] pinctrl: renesas: rzg2l: Simplify rzg2l_pinctrl_set_mux()
>
> Hi Biju,
>
> On Tue, 17 Mar 2026 at 11:16, Biju <biju.das.au@xxxxxxxxx> wrote:
> > From: Biju Das <biju.das.jz@xxxxxxxxxxxxxx>
> >
> > The port and function selectors are evaluated multiple times in
> > rzg2l_pinctrl_set_mux(). Simplify the function by dropping dupicate
> > evaluation storing them in local variables.
> >
> > Signed-off-by: Biju Das <biju.das.jz@xxxxxxxxxxxxxx>
>
> Thanks for your patch!
>
> > --- a/drivers/pinctrl/renesas/pinctrl-rzg2l.c
> > +++ b/drivers/pinctrl/renesas/pinctrl-rzg2l.c
> > @@ -681,16 +681,18 @@ static int rzg2l_pinctrl_set_mux(struct pinctrl_dev *pctldev,
> > for (i = 0; i < group->grp.npins; i++) {
> > u64 *pin_data = pctrl->desc.pins[pins[i]].drv_data;
> > u32 off = RZG2L_PIN_CFG_TO_PORT_OFFSET(*pin_data);
> > + u32 port = RZG2L_PIN_ID_TO_PORT(pins[i]);
> > u32 pin = RZG2L_PIN_ID_TO_PIN(pins[i]);
> > + u8 func;
>
> unsigned int
OK, will fix this in next version.
Cheers,
Biju
>
> >
> > - ret = rzg2l_validate_pin(pctrl, *pin_data, RZG2L_PIN_ID_TO_PORT(pins[i]), pin);
> > + ret = rzg2l_validate_pin(pctrl, *pin_data, port, pin);
> > if (ret)
> > return ret;
> >
> > - dev_dbg(pctrl->dev, "port:%u pin: %u off:%x PSEL:%u\n",
> > - RZG2L_PIN_ID_TO_PORT(pins[i]), pin, off, psel_val[i] - hwcfg->func_base);
> > + func = psel_val[i] - hwcfg->func_base;
> > + dev_dbg(pctrl->dev, "port:%u pin: %u off:%x
> > + PSEL:%u\n", port, pin, off, func);
> >
> > - rzg2l_pinctrl_set_pfc_mode(pctrl, pin, off, psel_val[i] - hwcfg->func_base);
> > + rzg2l_pinctrl_set_pfc_mode(pctrl, pin, off, func);
> > }
> >
> > return 0;
>
> With the above fixed:
> Reviewed-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>
>
> Gr{oetje,eeting}s,
>
> Geert
>
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx
>
> 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