linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bartosz Golaszewski <brgl@bgdev.pl>
To: 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>,
	 Cosmin Tanislav <demonsingur@gmail.com>
Subject: [PATCH 2/2] gpio: shared: ignore GPIO hogs when traversing the device tree
Date: Wed, 26 Nov 2025 17:49:06 +0100	[thread overview]
Message-ID: <20251126-gpio-shared-fixes-v1-2-18309c0e87b5@linaro.org> (raw)
In-Reply-To: <20251126-gpio-shared-fixes-v1-0-18309c0e87b5@linaro.org>

From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

GPIO hogs have a "gpios" property but it's not a phandle to a remote
node - it references the parent GPIO controller. We must not try to
parse it as a phandle.

Fixes: a060b8c511ab ("gpiolib: implement low-level, shared GPIO support")
Reported-by: Cosmin Tanislav <demonsingur@gmail.com>
Closes: https://lore.kernel.org/all/2d96e464-e17c-4ff5-9a08-b215b77da04f@gmail.com/
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
 drivers/gpio/gpiolib-shared.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/gpio/gpiolib-shared.c b/drivers/gpio/gpiolib-shared.c
index 62f32489a8a6f70c567ed93645f1e36a81612def..7e049f2153a3fcc51803dd185fe5db60daea789f 100644
--- a/drivers/gpio/gpiolib-shared.c
+++ b/drivers/gpio/gpiolib-shared.c
@@ -83,6 +83,13 @@ static bool gpio_shared_of_node_ignore(struct device_node *node)
 	if (of_node_name_eq(node, "__symbols__"))
 		return true;
 
+	/*
+	 * GPIO hogs have a "gpios" property which is not a phandle and can't
+	 * possibly refer to a shared GPIO.
+	 */
+	if (of_property_present(node, "gpio-hog"))
+		return true;
+
 	return false;
 }
 

-- 
2.51.0


  parent reply	other threads:[~2025-11-26 16:49 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
2025-11-26 16:49 ` Bartosz Golaszewski [this message]
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=20251126-gpio-shared-fixes-v1-2-18309c0e87b5@linaro.org \
    --to=brgl@bgdev.pl \
    --cc=bartosz.golaszewski@linaro.org \
    --cc=brgl@kernel.org \
    --cc=demonsingur@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@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).