summaryrefslogtreecommitdiffstats
path: root/drivers/of
diff options
context:
space:
mode:
authorJohn Bonesio <bones@secretlab.ca>2011-06-27 16:49:57 -0700
committerGrant Likely <grant.likely@secretlab.ca>2011-06-28 15:39:50 -0600
commita6b0919140b49e0871584362ae0cf1d18c476058 (patch)
tree9e9052104053a155ab8ca69ccadd581e9f8eede6 /drivers/of
parentbf859f84a19f8e562af4a990a287b5e3edabc572 (diff)
downloadlinux-a6b0919140b49e0871584362ae0cf1d18c476058.tar.bz2
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 <bones@secretlab.ca> [grant.likely: Tidied up whitespace and tweaked kerneldoc comments.] Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Diffstat (limited to 'drivers/of')
-rw-r--r--drivers/of/gpio.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/of/gpio.c b/drivers/of/gpio.c
index 905960338fb2..3007662ac614 100644
--- a/drivers/of/gpio.c
+++ b/drivers/of/gpio.c
@@ -21,8 +21,9 @@
#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
+ * @propname: property name containing gpio specifier(s)
* @index: index of the GPIO
* @flags: a flags pointer to fill in
*
@@ -30,8 +31,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 *propname,
+ int index, enum of_gpio_flags *flags)
{
int ret;
struct device_node *gpio_np;
@@ -40,7 +41,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, propname, "#gpio-cells", index,
&gpio_np, &gpio_spec);
if (ret) {
pr_debug("%s: can't parse gpios property\n", __func__);
@@ -79,7 +80,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