Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

gpio: Export gpiod_get_from_of_node()

This function already exist inside gpiolib, we were just
reluctant to make it available to the kernel at large as
the devm_* seemed to be enough for anyone.

However we found out that regulators need to do their own
lifecycle/refcounting on GPIO descriptors and explicitly
call gpiod_put() when done with a descriptor, so export
this function so we can hand the refcounting over to the
regulator core for these descriptors after retrieveal.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Marek Szyprowski <m.szyprowski@samsung.com>
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Linus Walleij and committed by
Mark Brown
fe6c473e 894077d5

+13 -6
-6
drivers/gpio/gpiolib.h
··· 201 201 struct gpio_array *array_info, 202 202 unsigned long *value_bitmap); 203 203 204 - /* This is just passed between gpiolib and devres */ 205 - struct gpio_desc *gpiod_get_from_of_node(struct device_node *node, 206 - const char *propname, int index, 207 - enum gpiod_flags dflags, 208 - const char *label); 209 - 210 204 extern struct spinlock gpio_lock; 211 205 extern struct list_head gpio_devices; 212 206
+13
include/linux/gpio/consumer.h
··· 172 172 struct device_node; 173 173 struct fwnode_handle; 174 174 175 + struct gpio_desc *gpiod_get_from_of_node(struct device_node *node, 176 + const char *propname, int index, 177 + enum gpiod_flags dflags, 178 + const char *label); 175 179 struct gpio_desc *devm_gpiod_get_from_of_node(struct device *dev, 176 180 struct device_node *node, 177 181 const char *propname, int index, ··· 520 516 /* Child properties interface */ 521 517 struct device_node; 522 518 struct fwnode_handle; 519 + 520 + static inline 521 + struct gpio_desc *gpiod_get_from_of_node(struct device_node *node, 522 + const char *propname, int index, 523 + enum gpiod_flags dflags, 524 + const char *label) 525 + { 526 + return ERR_PTR(-ENOSYS); 527 + } 523 528 524 529 static inline 525 530 struct gpio_desc *devm_gpiod_get_from_of_node(struct device *dev,