summaryrefslogtreecommitdiff
path: root/drivers/gpio/gpiolib.c
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2017-12-30 00:52:02 +0300
committerLinus Walleij <linus.walleij@linaro.org>2018-01-12 13:05:24 +0300
commit92542edc42496ac4b8f5ba0ae81ab5776db9473b (patch)
tree42b722f5798e1f9969d5cd3027ad7a48149a2d30 /drivers/gpio/gpiolib.c
parent6392cca42de603d49c2d929c838c92801d4ee761 (diff)
downloadlinux-92542edc42496ac4b8f5ba0ae81ab5776db9473b.tar.xz
gpio: Export devm_gpiod_get_from_of_node() for consumers
We have been holding back on adding an API for fetching GPIO handles directly from device nodes, strongly preferring to get it from the spawn devices instead. The fwnode interface however already contains an API for doing this, as it is used for opaque device tree nodes or ACPI nodes for getting handles to LEDs and keys that use GPIO: those are specified as one child per LED/key in the device tree and are not individual devices. However regulators present a special problem as they already have helper functions to traverse the device tree from a regulator node and two levels down to fill in data, and as it already traverses GPIO nodes in its own way, and already holds a pointer to each regulators device tree node, it makes most sense to export an API to fetch the GPIO descriptor directly from the node. We only support the devm_* version for now, hopefully no non-devres version will be needed. Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio/gpiolib.c')
-rw-r--r--drivers/gpio/gpiolib.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 6df94492e93e..bf083bc58d30 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -3682,10 +3682,10 @@ EXPORT_SYMBOL_GPL(gpiod_get_index);
*
* In case of error an ERR_PTR() is returned.
*/
-static struct gpio_desc *gpiod_get_from_of_node(struct device_node *node,
- const char *propname, int index,
- enum gpiod_flags dflags,
- const char *label)
+struct gpio_desc *gpiod_get_from_of_node(struct device_node *node,
+ const char *propname, int index,
+ enum gpiod_flags dflags,
+ const char *label)
{
struct gpio_desc *desc = ERR_PTR(-ENODEV);
unsigned long lflags = 0;
@@ -3736,6 +3736,7 @@ static struct gpio_desc *gpiod_get_from_of_node(struct device_node *node,
return desc;
}
+EXPORT_SYMBOL(gpiod_get_from_of_node);
/**
* fwnode_get_named_gpiod - obtain a GPIO from firmware node