]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
gpio: shared: ignore special __symbols__ node when traversing device tree
authorBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Wed, 26 Nov 2025 16:49:05 +0000 (17:49 +0100)
committerBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Fri, 28 Nov 2025 08:29:14 +0000 (09:29 +0100)
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/
Tested-by: Jon Hunter <jonathanh@nvidia.com>
Acked-by: Jon Hunter <jonathanh@nvidia.com>
Link: https://lore.kernel.org/r/20251126-gpio-shared-fixes-v1-1-18309c0e87b5@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
drivers/gpio/gpiolib-shared.c

index cc8646f563d2fa7b1972c94c734b19c4cb01244c..3a6d4cd54081efb11ac2b7d530a0f0a06f5a9412 100644 (file)
@@ -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"