Skip to content

Commit 216c120

Browse files
Bartosz GolaszewskipH5
authored andcommitted
gpio: swnode: allow referencing GPIO chips by firmware nodes
When doing a software node lookup, we require both the fwnode that references a GPIO chip as well as the node associated with that chip to be software nodes. However, we now allow referencing generic firmware nodes from software nodes in driver core so we should allow the same in GPIO core. Make the software node name check optional and dependent on whether the referenced firmware node is a software node. If it's not, just continue with the lookup. Acked-by: Linus Walleij <linus.walleij@linaro.org> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
1 parent d2a6cea commit 216c120

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

drivers/gpio/gpiolib-swnode.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ static struct gpio_device *swnode_get_gpio_device(struct fwnode_handle *fwnode)
3131

3232
gdev_node = to_software_node(fwnode);
3333
if (!gdev_node || !gdev_node->name)
34-
return ERR_PTR(-EINVAL);
34+
goto fwnode_lookup;
3535

3636
/*
3737
* Check for a special node that identifies undefined GPIOs, this is
@@ -41,6 +41,7 @@ static struct gpio_device *swnode_get_gpio_device(struct fwnode_handle *fwnode)
4141
!strcmp(gdev_node->name, GPIOLIB_SWNODE_UNDEFINED_NAME))
4242
return ERR_PTR(-ENOENT);
4343

44+
fwnode_lookup:
4445
gdev = gpio_device_find_by_fwnode(fwnode);
4546
return gdev ?: ERR_PTR(-EPROBE_DEFER);
4647
}

0 commit comments

Comments
 (0)