Re: [PATCH v6 1/4] pinctrl: make the CONFIG_PINCTRL=n gpio config stubs return -ENOTSUPP
From: Bartosz Golaszewski
Date: Wed Sep 16 2026 - 05:44:06 EST
On Tue, 15 Sep 2026 10:04:58 +0200, Mehmet Fide <mehmet.fide@xxxxxxxxx> said:
> From: Mehmet Fide <mehmet.fide@xxxxxxxxxxxxxxxxxx>
>
> With CONFIG_PINCTRL=n, pinctrl_gpio_get_config() and
> pinctrl_gpio_set_config() are stubs that return 0. The getter reports
> success without touching the config it was asked to fill, so a caller
> reads the packed parameter it passed in back as if it were the pin's
> state; the setter reports success for a configuration nobody applied.
>
> With CONFIG_PINCTRL=y the same callers already get -ENOTSUPP from
> gpiochip_generic_config() and gpiochip_generic_get_config() for a chip
> without pin ranges, and gpiolib treats that value as "the backend cannot
> do this" and carries on. Return it from the stubs too, so a kernel
> without pinctrl behaves like a chip without pin ranges instead of
> claiming success.
>
> Suggested-by: Haibo Chen <haibo.chen@xxxxxxx>
> Signed-off-by: Mehmet Fide <mehmet.fide@xxxxxxxxxxxxxxxxxx>
> ---
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxxxxxxxx>