U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Ralph Siemsen <ralph.siemsen@linaro.org>
To: Marek Vasut <marek.vasut@mailbox.org>
Cc: u-boot@lists.u-boot-project.org,
	Nobuhiro Iwamatsu <iwamatsu@nigauri.org>,
	Tom Rini <trini@konsulko.com>
Subject: Re: [PATCH v2] pinctrl: renesas: r906g032: handle pin subgroups
Date: Sat, 15 Aug 2026 09:53:39 -0400	[thread overview]
Message-ID: <aoBvY59NI-gp7lpk@maple.netwinder.org> (raw)
In-Reply-To: <68bf41a9-8b6f-4d55-a0d4-9b999022b06a@mailbox.org>

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.

Ralph

  reply	other threads:[~2026-08-15 13:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-14 18:26 [PATCH v2] pinctrl: renesas: r906g032: handle pin subgroups Ralph Siemsen
2026-08-14 22:00 ` Marek Vasut via U-Boot
2026-08-15 13:53   ` Ralph Siemsen [this message]
2026-08-16 12:07     ` Marek Vasut via U-Boot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aoBvY59NI-gp7lpk@maple.netwinder.org \
    --to=ralph.siemsen@linaro.org \
    --cc=iwamatsu@nigauri.org \
    --cc=marek.vasut@mailbox.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.u-boot-project.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox