From feb836992437c9b8b53988da30880e0e6e93ac8b Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Mon, 24 Oct 2011 15:24:10 +0200 Subject: gpiolib: Ensure struct gpio is always defined Currently struct gpio is only defined when using gpiolib which makes the stub gpio_request_array() much less useful in drivers than is ideal as they can't work with struct gpio. Since there are no other definitions in kernel instead make the define always available no matter if gpiolib is selectable or selected, ensuring that drivers can always use the type. Signed-off-by: Mark Brown Signed-off-by: Grant Likely --- include/asm-generic/gpio.h | 13 +------------ include/linux/gpio.h | 22 ++++++++++++---------- 2 files changed, 13 insertions(+), 22 deletions(-) (limited to 'include') diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h index d494001b122..dbb2832b76f 100644 --- a/include/asm-generic/gpio.h +++ b/include/asm-generic/gpio.h @@ -41,6 +41,7 @@ static inline bool gpio_is_valid(int number) } struct device; +struct gpio; struct seq_file; struct module; struct device_node; @@ -170,18 +171,6 @@ extern int __gpio_cansleep(unsigned gpio); extern int __gpio_to_irq(unsigned gpio); -/** - * struct gpio - a structure describing a GPIO with configuration - * @gpio: the GPIO number - * @flags: GPIO configuration as specified by GPIOF_* - * @label: a literal description string of this GPIO - */ -struct gpio { - unsigned gpio; - unsigned long flags; - const char *label; -}; - extern int gpio_request_one(unsigned gpio, unsigned long flags, const char *label); extern int gpio_request_array(const struct gpio *array, size_t num); extern void gpio_free_array(const struct gpio *array, size_t num); diff --git a/include/linux/gpio.h b/include/linux/gpio.h index 17b5a0d80e4..38ac48b7d3a 100644 --- a/include/linux/gpio.h +++ b/include/linux/gpio.h @@ -14,6 +14,18 @@ #define GPIOF_OUT_INIT_LOW (GPIOF_DIR_OUT | GPIOF_INIT_LOW) #define GPIOF_OUT_INIT_HIGH (GPIOF_DIR_OUT | GPIOF_INIT_HIGH) +/** + * struct gpio - a structure describing a GPIO with configuration + * @gpio: the GPIO number + * @flags: GPIO configuration as specified by GPIOF_* + * @label: a literal description string of this GPIO + */ +struct gpio { + unsigned gpio; + unsigned long flags; + const char *label; +}; + #ifdef CONFIG_GENERIC_GPIO #include @@ -24,18 +36,8 @@ #include struct device; -struct gpio; struct gpio_chip; -/* - * Some platforms don't support the GPIO programming interface. - * - * In case some driver uses it anyway (it should normally have - * depended on GENERIC_GPIO), these routines help the compiler - * optimize out much GPIO-related code ... or trigger a runtime - * warning when something is wrongly called. - */ - static inline bool gpio_is_valid(int number) { return false; -- cgit v1.2.3 From eb9ae7f2a38135761496d317c08c87f38c7cafe3 Mon Sep 17 00:00:00 2001 From: Hamo Date: Fri, 21 Oct 2011 09:38:32 +0800 Subject: gpio: fix build error in include/asm-generic/gpio.h Should call the platform-specific __gpio_{get,set}_value instead of generic gpio_{get,set}_value Signed-off-by: Yang Bai Acked-by: Arnd Bergmann Signed-off-by: Grant Likely --- include/asm-generic/gpio.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h index dbb2832b76f..8c8621097fa 100644 --- a/include/asm-generic/gpio.h +++ b/include/asm-generic/gpio.h @@ -209,13 +209,13 @@ static inline int gpio_cansleep(unsigned gpio) static inline int gpio_get_value_cansleep(unsigned gpio) { might_sleep(); - return gpio_get_value(gpio); + return __gpio_get_value(gpio); } static inline void gpio_set_value_cansleep(unsigned gpio, int value) { might_sleep(); - gpio_set_value(gpio, value); + __gpio_set_value(gpio, value); } #endif /* !CONFIG_GPIOLIB */ -- cgit v1.2.3 From 76c05c8a0d56faf210cb9681786bb3e17cd59793 Mon Sep 17 00:00:00 2001 From: Rob Herring Date: Wed, 10 Aug 2011 16:31:46 -0500 Subject: gpio: pl061: add DT binding support This adds devicetree binding support to the ARM pl061 driver removing the platform_data dependency. When DT binding is used, the gpio numbering is assigned dynamically. For now, interrupts are not supported with DT until irqdomains learn dynamic irq assignment. Rather than add another case of -1, updating the driver to use NO_IRQ. Signed-off-by: Rob Herring Acked-by: Baruch Siach Signed-off-by: Grant Likely --- include/linux/amba/pl061.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'include') diff --git a/include/linux/amba/pl061.h b/include/linux/amba/pl061.h index 5ddd9ad4b19..2412af944f1 100644 --- a/include/linux/amba/pl061.h +++ b/include/linux/amba/pl061.h @@ -7,8 +7,7 @@ struct pl061_platform_data { unsigned gpio_base; /* number of the first IRQ. - * If the IRQ functionality in not desired this must be set to - * (unsigned) -1. + * If the IRQ functionality in not desired this must be set to NO_IRQ. */ unsigned irq_base; -- cgit v1.2.3