linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jon Hunter <jonathanh@nvidia.com>
To: Bartosz Golaszewski <brgl@bgdev.pl>,
	Linus Walleij <linus.walleij@linaro.org>,
	Bartosz Golaszewski <brgl@kernel.org>
Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
	Bartosz Golaszewski <bartosz.golaszewski@linaro.org>,
	"linux-tegra@vger.kernel.org" <linux-tegra@vger.kernel.org>
Subject: Re: [PATCH 1/2] gpio: shared: ignore special __symbols__ node when traversing device tree
Date: Wed, 26 Nov 2025 20:56:40 +0000	[thread overview]
Message-ID: <080dd053-972b-43f7-a91b-920750dadcff@nvidia.com> (raw)
In-Reply-To: <20251126-gpio-shared-fixes-v1-1-18309c0e87b5@linaro.org>



On 26/11/2025 16:49, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> 
> The __symbols__ node is a special, internal node and its properties must
> not be considered when scanning the device-tree for shared GPIOs.
> 
> Fixes: a060b8c511ab ("gpiolib: implement low-level, shared GPIO support")
> Reported-by: Jon Hunter <jonathanh@nvidia.com>
> Closes: https://lore.kernel.org/all/0829a21c-f97d-41b6-90bc-2acaec42caab@nvidia.com/
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> ---
>   drivers/gpio/gpiolib-shared.c | 16 ++++++++++++++++
>   1 file changed, 16 insertions(+)
> 
> diff --git a/drivers/gpio/gpiolib-shared.c b/drivers/gpio/gpiolib-shared.c
> index 3803b5c938f9933dab01c6d777c349ed3b42ce9b..62f32489a8a6f70c567ed93645f1e36a81612def 100644
> --- a/drivers/gpio/gpiolib-shared.c
> +++ b/drivers/gpio/gpiolib-shared.c
> @@ -73,6 +73,19 @@ gpio_shared_find_entry(struct fwnode_handle *controller_node,
>   	return NULL;
>   }
>   
> +/* Handle all special nodes that we should ignore. */
> +static bool gpio_shared_of_node_ignore(struct device_node *node)
> +{
> +	/*
> +	 * __symbols__ is a special, internal node and should not be considered
> +	 * when scanning for shared GPIOs.
> +	 */
> +	if (of_node_name_eq(node, "__symbols__"))
> +		return true;
> +
> +	return false;
> +}
> +
>   static int gpio_shared_of_traverse(struct device_node *curr)
>   {
>   	struct gpio_shared_entry *entry;
> @@ -84,6 +97,9 @@ static int gpio_shared_of_traverse(struct device_node *curr)
>   	const char *suffix;
>   	int ret, count, i;
>   
> +	if (gpio_shared_of_node_ignore(curr))
> +		return 0;
> +
>   	for_each_property_of_node(curr, prop) {
>   		/*
>   		 * The standard name for a GPIO property is "foo-gpios"
> 

Fixes it for me!

Tested-by: Jon Hunter <jonathanh@nvidia.com>
Acked-by: Jon Hunter <jonathanh@nvidia.com>

Thanks
Jon

-- 
nvpublic


  reply	other threads:[~2025-11-26 20:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-26 16:49 [PATCH 0/2] gpio: shared: fix some corner cases Bartosz Golaszewski
2025-11-26 16:49 ` [PATCH 1/2] gpio: shared: ignore special __symbols__ node when traversing device tree Bartosz Golaszewski
2025-11-26 20:56   ` Jon Hunter [this message]
2025-11-26 16:49 ` [PATCH 2/2] gpio: shared: ignore GPIO hogs when traversing the " Bartosz Golaszewski
2025-11-28  8:30 ` [PATCH 0/2] gpio: shared: fix some corner cases Bartosz Golaszewski

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=080dd053-972b-43f7-a91b-920750dadcff@nvidia.com \
    --to=jonathanh@nvidia.com \
    --cc=bartosz.golaszewski@linaro.org \
    --cc=brgl@bgdev.pl \
    --cc=brgl@kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).