Re: [PATCH v2] pinctrl: renesas: r906g032: handle pin subgroups
Marek Vasut via U-Boot <[email protected]>
| Newsgroups | org.u-boot-project.lists.u-boot |
|---|---|
| Message-ID | <[email protected]> |
On 8/15/26 3:53 PM, Ralph Siemsen wrote:
> On Sat, Aug 15, 2026 at 12:00:23AM +0200, Marek Vasut wrote:
>>> diff --git a/drivers/pinctrl/renesas/pinctrl-rzn1.c b/drivers/
>>> pinctrl/renesas/pinctrl-rzn1.c
>>> index fdc43c8e714..6c8d40e9639 100644
>>> --- a/drivers/pinctrl/renesas/pinctrl-rzn1.c
>>> +++ b/drivers/pinctrl/renesas/pinctrl-rzn1.c
>>> @@ -298,11 +298,24 @@ static int rzn1_pinconf_set(struct
>>> rzn1_pinctrl_priv *priv, unsigned int pin,
>>> static int rzn1_pinctrl_set_state(struct udevice *dev, struct
>>> udevice *config)
>>> {
>>> struct rzn1_pinctrl_priv *priv = dev_get_priv(dev);
>>> + struct udevice *child;
>>> int size;
>>> int ret;
>>> u32 val;
>>> u32 bias;
>>> + /*
>>> + * Handle subnodes recursively, so that pin groups work.
>>> + * Note that properties are *NOT* inherited from parent.
>>> + */
>>> + device_foreach_child(child, config) {
>>> + ret = rzn1_pinctrl_set_state(dev, child);
>
>> Can there really be infinite nested subgroups , or are there always
>> only groups with subgroups and that is where it ends ? Linux
>> Documentation/devicetree/bindings/pinctrl/renesas,rzn1-pinctrl.yaml
>> makes it look like the later, so maybe the recursion is not necessary
>> here, instead call device_foreach_child() { device_foreach_child()
>> { .. } } to prevent the possibility of infinite recursion ?
>
> Realistically there will only be groups with one level of subgroups.
> Perhaps if there was a phandle it could go a few levels deeper.
>
> Unbounded recursion is not really possible here unless:
> - the device tree is infinitely deep, or
> - there is a very serious bug in device_foreach_child()
>
> As these both seem unlikely, I opted for the simple recursive call, but
> I am happy to change it if you feel it is better.
Let's go with bounded one-level-deep parsing, that's what the bindings
describe too.