summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBartosz Golaszewski <bartosz.golaszewski@linaro.org>2025-11-26 17:49:06 +0100
committerBartosz Golaszewski <bartosz.golaszewski@linaro.org>2025-11-28 09:29:14 +0100
commit114e594e6cb791ce7c839ccfbe153ecfa3e7abce (patch)
treefca8201fb18c06cef616974167e08e3be8699983
parentcfab6dc0700c3b9120dab726fc184c3b4500cc5b (diff)
gpio: shared: ignore GPIO hogs when traversing the device tree
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/ Link: https://lore.kernel.org/r/20251126-gpio-shared-fixes-v1-2-18309c0e87b5@linaro.org Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
-rw-r--r--drivers/gpio/gpiolib-shared.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/gpio/gpiolib-shared.c b/drivers/gpio/gpiolib-shared.c
index 3a6d4cd54081..cd4dd6fc76ab 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;
}