of/gpio: Add new method for getting gpios under different property names
PATCH 1/1 of/gpio: Add new method for getting gpios under different property names
This patch adds a new routine, of_get_named_gpio_flags(), which takes the property name as a parameter rather than assuming "gpios".
of_get_gpio_flags() is modified to call of_get_named_gpio_flags() with "gpios" as the property parameter.
Signed-off-by John Bonesio <[email protected]>
---
drivers/of/gpio.c | 12 +++++++----- include/linux/of_gpio.h | 42 ++++++++++++++++++++++++++++++++++++++---- 2 files changed, 45 insertions(+), 9 deletions(-)
drivers/of/gpio.c +7 -5
@@ -20,9 +20,11 @@#include <linux/of_gpio.h> #include <linux/slab.h> +/** -* of_get_gpio_flags - Get a GPIO number and flags to use with GPIO API +* of_get_named_gpio_flags - Get a GPIO number and flags to use with GPIO API * @np: device node to get GPIO from +* @list_name: property name that contains a list * @index: index of the GPIO * @flags: a flags pointer to fill in *
@@ -30,8 +32,8 @@* value on the error condition. If @flags is not NULL the function also fills * in flags for the GPIO. */ -int of_get_gpio_flags (struct device_node *np,int index, -enum of_gpio_flags *flags) +int of_get_named_gpio_flags (struct device_node *np,const char *list_name, +int index,enum of_gpio_flags *flags) {int ret;struct device_node *gpio_np;
@@ -40,7 +42,7 @@ int of_get_gpio_flags(struct device_node *np, int index,const void *gpio_spec;const __be32 *gpio_cells; - ret =of_parse_phandles_with_args (np,"gpios" ,"#gpio-cells" , index, + ret =of_parse_phandles_with_args (np, list_name,"#gpio-cells" , index, &gpio_np, &gpio_spec);if (ret) {pr_debug ("%s: can't parse gpios property\n" , __func__);
@@ -79,7 +81,7 @@ err0:pr_debug ("%s exited with status %d\n" , __func__, ret);return ret; } -EXPORT_SYMBOL (of_get_gpio_flags); +EXPORT_SYMBOL (of_get_named_gpio_flags);/** * of_gpio_count - Count GPIOs for a device
include/linux/of_gpio.h +38 -4
60 lines not on this page · raw message