Skip to content

Commit cfab6dc

Browse files
author
Bartosz Golaszewski
committed
gpio: shared: ignore special __symbols__ node when traversing device tree
The __symbols__ node is a special, internal node and its properties must not be considered when scanning the device-tree for shared GPIOs. Fixes: a060b8c ("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>
1 parent 7b78b26 commit cfab6dc

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

drivers/gpio/gpiolib-shared.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,19 @@ gpio_shared_find_entry(struct fwnode_handle *controller_node,
7373
return NULL;
7474
}
7575

76+
/* Handle all special nodes that we should ignore. */
77+
static bool gpio_shared_of_node_ignore(struct device_node *node)
78+
{
79+
/*
80+
* __symbols__ is a special, internal node and should not be considered
81+
* when scanning for shared GPIOs.
82+
*/
83+
if (of_node_name_eq(node, "__symbols__"))
84+
return true;
85+
86+
return false;
87+
}
88+
7689
static int gpio_shared_of_traverse(struct device_node *curr)
7790
{
7891
struct gpio_shared_entry *entry;
@@ -84,6 +97,9 @@ static int gpio_shared_of_traverse(struct device_node *curr)
8497
const char *suffix;
8598
int ret, count, i;
8699

100+
if (gpio_shared_of_node_ignore(curr))
101+
return 0;
102+
87103
for_each_property_of_node(curr, prop) {
88104
/*
89105
* The standard name for a GPIO property is "foo-gpios"

0 commit comments

Comments
 (0)