diff options
author | Alexandre Courbot <acourbot@nvidia.com> | 2014-05-17 01:54:50 -0400 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2014-05-21 05:14:46 -0400 |
commit | f01d907582f8461546379aa415a7c6d5cfb8e5fd (patch) | |
tree | b1e0520a32e14d14650f2eea7ad07dd149f81444 /include/linux/of_gpio.h | |
parent | 1aeede0b3c055665fb722a012d3cd834146fc112 (diff) |
gpio: make of_get_named_gpiod_flags() private
of_get_named_gpiod_flags() is visible and directly usable by GPIO
consumers, but it really should not as the gpiod interface relies
on the simpler gpiod_get() to provide properly-configured GPIOs.
of_get_named_gpiod_flags() is just used internally by gpiolib to
implement gpiod_get(), and by the old of_get_named_gpio_flags()
function, therefore it makes sense to make it gpiolib-private.
As a side-effect, the unused (and unneeded) of_get_gpiod_flags()
inline function is also removed, and of_get_named_gpio_flags() is moved
from a static inline function to a regular one in gpiolib-of.c
This results in all references to gpiod_* functions in of_gpio.h being
gone, which is the way it should be since this file is part of the old
integer GPIO interface.
Changes since v1:
- Fixed compilation error when CONFIG_OF_GPIO is not defined
- Fixed warning due to of_gpio_flags enum not being declared
in private gpiolib.h header
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'include/linux/of_gpio.h')
-rw-r--r-- | include/linux/of_gpio.h | 35 |
1 files changed, 3 insertions, 32 deletions
diff --git a/include/linux/of_gpio.h b/include/linux/of_gpio.h index f14123a5a9df..38fc05036015 100644 --- a/include/linux/of_gpio.h +++ b/include/linux/of_gpio.h | |||
@@ -19,7 +19,6 @@ | |||
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 | #include <linux/of.h> |
22 | #include <linux/gpio/consumer.h> | ||
23 | 22 | ||
24 | struct device_node; | 23 | struct device_node; |
25 | 24 | ||
@@ -48,7 +47,7 @@ static inline struct of_mm_gpio_chip *to_of_mm_gpio_chip(struct gpio_chip *gc) | |||
48 | return container_of(gc, struct of_mm_gpio_chip, gc); | 47 | return container_of(gc, struct of_mm_gpio_chip, gc); |
49 | } | 48 | } |
50 | 49 | ||
51 | extern struct gpio_desc *of_get_named_gpiod_flags(struct device_node *np, | 50 | extern int of_get_named_gpio_flags(struct device_node *np, |
52 | const char *list_name, int index, enum of_gpio_flags *flags); | 51 | const char *list_name, int index, enum of_gpio_flags *flags); |
53 | 52 | ||
54 | extern int of_mm_gpiochip_add(struct device_node *np, | 53 | extern int of_mm_gpiochip_add(struct device_node *np, |
@@ -63,10 +62,10 @@ extern int of_gpio_simple_xlate(struct gpio_chip *gc, | |||
63 | #else /* CONFIG_OF_GPIO */ | 62 | #else /* CONFIG_OF_GPIO */ |
64 | 63 | ||
65 | /* Drivers may not strictly depend on the GPIO support, so let them link. */ | 64 | /* Drivers may not strictly depend on the GPIO support, so let them link. */ |
66 | static inline struct gpio_desc *of_get_named_gpiod_flags(struct device_node *np, | 65 | static inline int of_get_named_gpio_flags(struct device_node *np, |
67 | const char *list_name, int index, enum of_gpio_flags *flags) | 66 | const char *list_name, int index, enum of_gpio_flags *flags) |
68 | { | 67 | { |
69 | return ERR_PTR(-ENOSYS); | 68 | return -ENOSYS; |
70 | } | 69 | } |
71 | 70 | ||
72 | static inline int of_gpio_simple_xlate(struct gpio_chip *gc, | 71 | static inline int of_gpio_simple_xlate(struct gpio_chip *gc, |
@@ -81,18 +80,6 @@ static inline void of_gpiochip_remove(struct gpio_chip *gc) { } | |||
81 | 80 | ||
82 | #endif /* CONFIG_OF_GPIO */ | 81 | #endif /* CONFIG_OF_GPIO */ |
83 | 82 | ||
84 | static inline int of_get_named_gpio_flags(struct device_node *np, | ||
85 | const char *list_name, int index, enum of_gpio_flags *flags) | ||
86 | { | ||
87 | struct gpio_desc *desc; | ||
88 | desc = of_get_named_gpiod_flags(np, list_name, index, flags); | ||
89 | |||
90 | if (IS_ERR(desc)) | ||
91 | return PTR_ERR(desc); | ||
92 | else | ||
93 | return desc_to_gpio(desc); | ||
94 | } | ||
95 | |||
96 | /** | 83 | /** |
97 | * of_gpio_named_count() - Count GPIOs for a device | 84 | * of_gpio_named_count() - Count GPIOs for a device |
98 | * @np: device node to count GPIOs for | 85 | * @np: device node to count GPIOs for |
@@ -129,22 +116,6 @@ static inline int of_gpio_count(struct device_node *np) | |||
129 | return of_gpio_named_count(np, "gpios"); | 116 | return of_gpio_named_count(np, "gpios"); |
130 | } | 117 | } |
131 | 118 | ||
132 | /** | ||
133 | * of_get_gpiod_flags() - Get a GPIO descriptor and flags to use with GPIO API | ||
134 | * @np: device node to get GPIO from | ||
135 | * @index: index of the GPIO | ||
136 | * @flags: a flags pointer to fill in | ||
137 | * | ||
138 | * Returns GPIO descriptor to use with Linux generic GPIO API, or a errno | ||
139 | * value on the error condition. If @flags is not NULL the function also fills | ||
140 | * in flags for the GPIO. | ||
141 | */ | ||
142 | static inline struct gpio_desc *of_get_gpiod_flags(struct device_node *np, | ||
143 | int index, enum of_gpio_flags *flags) | ||
144 | { | ||
145 | return of_get_named_gpiod_flags(np, "gpios", index, flags); | ||
146 | } | ||
147 | |||
148 | static inline int of_get_gpio_flags(struct device_node *np, int index, | 119 | static inline int of_get_gpio_flags(struct device_node *np, int index, |
149 | enum of_gpio_flags *flags) | 120 | enum of_gpio_flags *flags) |
150 | { | 121 | { |