Re: [PATCH 11/11] pinctrl: scmi: select the GPIO function on GPIO requests

From: Andy Shevchenko

Date: Tue Nov 10 2026 - 09:22:54 EST


On Tue, Nov 10, 2026 at 01:49:25PM +0000, Cristian Marussi wrote:
> On Fri, Oct 30, 2026 at 04:58:42PM +0100, Clément Le Goffic wrote:

...

> > +static int pinctrl_scmi_gpio_mux_set(struct scmi_pinctrl *pmx, unsigned int pin)
> > +{
> > + const unsigned int *elems, *pins;
> > + unsigned int nr_elems, nr_pins, i;
> > + bool pin_only, gpio;
> > + int nr_functions, func, ret;

> Beside nr_functions, cannot all of these variable definitions be moved
> inside the scope in which they are exclusively used, i.e. down inside
> the for-loop ?

While it can be done, it's not most recommended style. Is it already in use in
this driver elsewhere? If not, don't do it in a single function. Same if it's
used in like one or two out of dozens of cases. TL;DR: be consistent in the
first place.

--
With Best Regards,
Andy Shevchenko