diff options
author | Linus Walleij <linus.walleij@linaro.org> | 2012-11-06 11:16:39 -0500 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2012-11-11 13:06:07 -0500 |
commit | 50309a9c2e576ac4ad29e30f5854acb87bdc2ac4 (patch) | |
tree | 12ded8b5c94195b0a26763f4ba322351463ea423 | |
parent | 1e63d7b9363f0c57d00991f9f2e0af374dfc591a (diff) |
gpiolib: iron out include ladder mistakes
The <*/gpio.h> includes are updated again: now we need to account
for the problem introduced by commit:
595679a8038584df7b9398bf34f61db3c038bfea
"gpiolib: fix up function prototypes etc"
Actually we need static inlines in include/asm-generic/gpio.h
as well since we may have GPIOLIB but not PINCTRL.
Make sure to move all the CONFIG_PINCTRL business
to the end of the file so we are sure we have
declared struct gpio_chip.
And we need to keep the static inlines in <linux/gpio.h>
but here for the !CONFIG_GENERIC_GPIO case, and then we
may as well throw in a few warnings like the other
prototypes there, if someone would have the bad taste
of compiling without GENERIC_GPIO even.
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-rw-r--r-- | include/asm-generic/gpio.h | 56 | ||||
-rw-r--r-- | include/linux/gpio.h | 7 |
2 files changed, 38 insertions, 25 deletions
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h index 50d995e7e44a..2b84fc32fae2 100644 --- a/include/asm-generic/gpio.h +++ b/include/asm-generic/gpio.h | |||
@@ -48,27 +48,6 @@ struct seq_file; | |||
48 | struct module; | 48 | struct module; |
49 | struct device_node; | 49 | struct device_node; |
50 | 50 | ||
51 | #ifdef CONFIG_PINCTRL | ||
52 | |||
53 | /** | ||
54 | * struct gpio_pin_range - pin range controlled by a gpio chip | ||
55 | * @head: list for maintaining set of pin ranges, used internally | ||
56 | * @pctldev: pinctrl device which handles corresponding pins | ||
57 | * @range: actual range of pins controlled by a gpio controller | ||
58 | */ | ||
59 | |||
60 | struct gpio_pin_range { | ||
61 | struct list_head node; | ||
62 | struct pinctrl_dev *pctldev; | ||
63 | struct pinctrl_gpio_range range; | ||
64 | }; | ||
65 | |||
66 | int gpiochip_add_pin_range(struct gpio_chip *chip, const char *pinctl_name, | ||
67 | unsigned int pin_base, unsigned int npins); | ||
68 | void gpiochip_remove_pin_ranges(struct gpio_chip *chip); | ||
69 | |||
70 | #endif | ||
71 | |||
72 | /** | 51 | /** |
73 | * struct gpio_chip - abstract a GPIO controller | 52 | * struct gpio_chip - abstract a GPIO controller |
74 | * @label: for diagnostics | 53 | * @label: for diagnostics |
@@ -288,4 +267,39 @@ static inline void gpio_unexport(unsigned gpio) | |||
288 | } | 267 | } |
289 | #endif /* CONFIG_GPIO_SYSFS */ | 268 | #endif /* CONFIG_GPIO_SYSFS */ |
290 | 269 | ||
270 | #ifdef CONFIG_PINCTRL | ||
271 | |||
272 | /** | ||
273 | * struct gpio_pin_range - pin range controlled by a gpio chip | ||
274 | * @head: list for maintaining set of pin ranges, used internally | ||
275 | * @pctldev: pinctrl device which handles corresponding pins | ||
276 | * @range: actual range of pins controlled by a gpio controller | ||
277 | */ | ||
278 | |||
279 | struct gpio_pin_range { | ||
280 | struct list_head node; | ||
281 | struct pinctrl_dev *pctldev; | ||
282 | struct pinctrl_gpio_range range; | ||
283 | }; | ||
284 | |||
285 | int gpiochip_add_pin_range(struct gpio_chip *chip, const char *pinctl_name, | ||
286 | unsigned int pin_base, unsigned int npins); | ||
287 | void gpiochip_remove_pin_ranges(struct gpio_chip *chip); | ||
288 | |||
289 | #else | ||
290 | |||
291 | static inline int | ||
292 | gpiochip_add_pin_range(struct gpio_chip *chip, const char *pinctl_name, | ||
293 | unsigned int pin_base, unsigned int npins) | ||
294 | { | ||
295 | return 0; | ||
296 | } | ||
297 | |||
298 | static inline void | ||
299 | gpiochip_remove_pin_ranges(struct gpio_chip *chip) | ||
300 | { | ||
301 | } | ||
302 | |||
303 | #endif /* CONFIG_PINCTRL */ | ||
304 | |||
291 | #endif /* _ASM_GENERIC_GPIO_H */ | 305 | #endif /* _ASM_GENERIC_GPIO_H */ |
diff --git a/include/linux/gpio.h b/include/linux/gpio.h index 81bbfe5b5de6..7ba2762abbc9 100644 --- a/include/linux/gpio.h +++ b/include/linux/gpio.h | |||
@@ -231,21 +231,20 @@ static inline int irq_to_gpio(unsigned irq) | |||
231 | return -EINVAL; | 231 | return -EINVAL; |
232 | } | 232 | } |
233 | 233 | ||
234 | #ifdef CONFIG_PINCTRL | ||
235 | |||
236 | static inline int | 234 | static inline int |
237 | gpiochip_add_pin_range(struct gpio_chip *chip, const char *pinctl_name, | 235 | gpiochip_add_pin_range(struct gpio_chip *chip, const char *pinctl_name, |
238 | unsigned int pin_base, unsigned int npins) | 236 | unsigned int pin_base, unsigned int npins) |
239 | { | 237 | { |
238 | WARN_ON(1); | ||
239 | return -EINVAL; | ||
240 | } | 240 | } |
241 | 241 | ||
242 | static inline void | 242 | static inline void |
243 | gpiochip_remove_pin_ranges(struct gpio_chip *chip) | 243 | gpiochip_remove_pin_ranges(struct gpio_chip *chip) |
244 | { | 244 | { |
245 | WARN_ON(1); | ||
245 | } | 246 | } |
246 | 247 | ||
247 | #endif /* CONFIG_PINCTRL */ | ||
248 | |||
249 | #endif /* ! CONFIG_GENERIC_GPIO */ | 248 | #endif /* ! CONFIG_GENERIC_GPIO */ |
250 | 249 | ||
251 | #endif /* __LINUX_GPIO_H */ | 250 | #endif /* __LINUX_GPIO_H */ |