pinctrl: renesas: gpio: isolate function gpiochip from parent fwnode

The sh-pfc driver registers two separate gpiochip instances: one for
real GPIOs and another for function GPIOs. Since both share the same
parent platform device, gpiolib's fallback logic causes both chips to
share the same firmware node (fwnode).

This causes ambiguity when using software nodes to describe GPIOs, as
gpiolib may apply hogs meant for one chip to the other if they share the
same node.

Explicitly set gc->fwnode to ERR_PTR(-ENODEV) for the function GPIO
chip. This satisfies gpiolib's check for an existing fwnode and prevents
it from falling back to the parent device's node, while ensuring that no
actual properties or hogs are found on the function chip unless
explicitly assigned later.

Assisted-by: Gemini:gemini-3.1-pro
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Acked-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Reviewed-by: Linus Walleij <linusw@kernel.org>
Signed-off-by: Linus Walleij <linusw@kernel.org>
This commit is contained in:
Dmitry Torokhov 2026-05-20 22:13:17 -07:00 committed by Linus Walleij
parent dc59e4fea9
commit 4c870bbaba

View File

@ -278,6 +278,12 @@ static int gpio_function_setup(struct sh_pfc_chip *chip)
gc->request = gpio_function_request;
/*
* Explicitly mask the parent's fwnode to prevent gpiolib from
* reusing it for function GPIOs.
*/
gc->fwnode = ERR_PTR(-ENODEV);
gc->label = pfc->info->name;
gc->owner = THIS_MODULE;
gc->base = pfc->nr_gpio_pins;