Linus Walleij wrote: > On Sat, Feb 17, 2024 at 6:44 PM Emil Renner Berthing > <emil.renner.berthing@xxxxxxxxxxxxx> wrote: > > > --- a/drivers/gpio/gpiolib.c > > +++ b/drivers/gpio/gpiolib.c > > @@ -2042,6 +2042,11 @@ EXPORT_SYMBOL_GPL(gpiochip_generic_free); > > int gpiochip_generic_config(struct gpio_chip *gc, unsigned int offset, > > unsigned long config) > > { > > +#ifdef CONFIG_PINCTRL > > Please do this: > > if (IS_ENABLED(CONFIG_PINCTRL) && list_empty(&gc->gpiodev->pin_ranges)) > ... > > The ifdef is so ugly. I agree, but I'm not sure it will work in this case since the pin_ranges member is only there when CONFIG_PINCTRL=y. That would also explain why gpiochip_generic_request() and gpiochip_generic_free() use ifdefs. > > > + if (list_empty(&gc->gpiodev->pin_ranges)) > > + return -ENOTSUPP; > > +#endif > > That looks like a reasonable fix, I try to wrap my head around if it > would affect > any users but can't figure it out, we have to test. > > Can you please send it as a proper patch? With the above fixed: > Reviewed-by: Linus Walleij <linus.walleij@xxxxxxxxxx> Will do, thanks! /Emil