Re: [PATCH] pinctrl: rp1: Return -EINVAL for pin settings that are not enabled

From: Linus Walleij

Date: Sat Dec 05 2026 - 17:24:54 EST


On Mon, Nov 30, 2026 at 7:30 AM Lin Tzu Yang <rongh7426@xxxxxxxxx> wrote:

> struct pinconf_ops says that pin_config_get() should return -EINVAL for
> a setting that is supported but not enabled. rp1_pinconf_get() returns
> 0 with an argument of 0 instead, so callers can't tell an enabled
> setting from a disabled one.
>
> This shows up in debugfs, where the generic pinconf dump lists every
> bias setting for every pin. With a pull-up set on GPIO17 of a Raspberry
> Pi 5, pinconf-pins shows:
>
> pin 17 (gpio17): input bias disabled, input bias pull down (0 ohms),
> input bias pull up (1 ohms), output drive strength (4 mA), input
> enabled, input schmitt enabled, output enabled, slew rate (0x0)
>
> Return -EINVAL when a boolean setting is not enabled. The slew rate is
> reported as a value, and 0 (slow) is a valid one, so leave it as is.
>
> Tested on a Raspberry Pi 5 with the Raspberry Pi OS 6.18.39 kernel,
> whose rp1_pinconf_get() has the same structure, by setting each bias on
> GPIO17 through gpiolib and reading pinconf-pins:
> - before: all 54 pins list all three bias settings, and all list both
> input and output enabled
> - after: GPIO17 lists only the bias that was set, no pin lists more
> than one bias, and the 26 pins that list both input and output
> enabled really have both enabled
> The mainline change is build tested.
>
> The bug was found and the patch written with the help of an AI coding
> assistant (Claude). I tested it on hardware and reviewed the change.
>
> Fixes: e3ce7b897388 ("pinctrl: rp1: Implement RaspberryPi RP1 pinmux/pinconf support")
> Signed-off-by: Lin Tzu Yang <rongh7426@xxxxxxxxx>

Patch applied as nonurgent fix.
Thanks!

Yours,
Linus Walleij