diff options
author | Grant Likely <grant.likely@secretlab.ca> | 2011-12-12 11:25:57 -0500 |
---|---|---|
committer | Grant Likely <grant.likely@secretlab.ca> | 2011-12-12 15:40:16 -0500 |
commit | 15c9a0acc3f7873db4b7d35d016729b2dc229b49 (patch) | |
tree | cfd9d6dd645d8116709521001e90dd75ffc19992 /include/linux/of_gpio.h | |
parent | 1a2d397a6eb5cf40c382d9e3d4bc04aaeb025336 (diff) |
of: create of_phandle_args to simplify return of phandle parsing data
of_parse_phandle_with_args() needs to return quite a bit of data. Rather
than making each datum a separate **out_ argument, this patch creates
struct of_phandle_args to contain all the returned data and reworks the
user of the function. This patch also enables of_parse_phandle_with_args()
to return the device node pointer for the phandle node.
This patch also ends up being fairly major surgery to
of_parse_handle_with_args(). The existing structure didn't work well
when extending to use of_phandle_args, and I discovered bugs during testing.
I also took the opportunity to rename the function to be like the
existing of_parse_phandle().
v2: - moved declaration of of_phandle_args to fix compile on non-DT builds
- fixed incorrect index in example usage
- fixed incorrect return code handling for empty entries
Reviewed-by: Shawn Guo <shawn.guo@freescale.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Diffstat (limited to 'include/linux/of_gpio.h')
-rw-r--r-- | include/linux/of_gpio.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/include/linux/of_gpio.h b/include/linux/of_gpio.h index 52280a2b5e63..b254052a49d7 100644 --- a/include/linux/of_gpio.h +++ b/include/linux/of_gpio.h | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/kernel.h> | 18 | #include <linux/kernel.h> |
19 | #include <linux/errno.h> | 19 | #include <linux/errno.h> |
20 | #include <linux/gpio.h> | 20 | #include <linux/gpio.h> |
21 | #include <linux/of.h> | ||
21 | 22 | ||
22 | struct device_node; | 23 | struct device_node; |
23 | 24 | ||
@@ -57,8 +58,9 @@ extern int of_mm_gpiochip_add(struct device_node *np, | |||
57 | extern void of_gpiochip_add(struct gpio_chip *gc); | 58 | extern void of_gpiochip_add(struct gpio_chip *gc); |
58 | extern void of_gpiochip_remove(struct gpio_chip *gc); | 59 | extern void of_gpiochip_remove(struct gpio_chip *gc); |
59 | extern struct gpio_chip *of_node_to_gpiochip(struct device_node *np); | 60 | extern struct gpio_chip *of_node_to_gpiochip(struct device_node *np); |
60 | extern int of_gpio_simple_xlate(struct gpio_chip *gc, struct device_node *np, | 61 | extern int of_gpio_simple_xlate(struct gpio_chip *gc, |
61 | const void *gpio_spec, u32 *flags); | 62 | const struct of_phandle_args *gpiospec, |
63 | u32 *flags); | ||
62 | 64 | ||
63 | #else /* CONFIG_OF_GPIO */ | 65 | #else /* CONFIG_OF_GPIO */ |
64 | 66 | ||
@@ -75,8 +77,8 @@ static inline unsigned int of_gpio_count(struct device_node *np) | |||
75 | } | 77 | } |
76 | 78 | ||
77 | static inline int of_gpio_simple_xlate(struct gpio_chip *gc, | 79 | static inline int of_gpio_simple_xlate(struct gpio_chip *gc, |
78 | struct device_node *np, | 80 | const struct of_phandle_args *gpiospec, |
79 | const void *gpio_spec, u32 *flags) | 81 | u32 *flags) |
80 | { | 82 | { |
81 | return -ENOSYS; | 83 | return -ENOSYS; |
82 | } | 84 | } |