aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2011-10-24 09:24:10 -0400
committerGrant Likely <grant.likely@secretlab.ca>2011-10-24 10:04:06 -0400
commitfeb836992437c9b8b53988da30880e0e6e93ac8b (patch)
tree1fa88109514310e32112acd017c1c506d13444b5 /include
parent825de2e9007439977aed63771db570fc2235e8cd (diff)
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 <broonie@opensource.wolfsonmicro.com> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Diffstat (limited to 'include')
-rw-r--r--include/asm-generic/gpio.h13
-rw-r--r--include/linux/gpio.h22
2 files changed, 13 insertions, 22 deletions
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
index d494001b1226..dbb2832b76fd 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)
41} 41}
42 42
43struct device; 43struct device;
44struct gpio;
44struct seq_file; 45struct seq_file;
45struct module; 46struct module;
46struct device_node; 47struct device_node;
@@ -170,18 +171,6 @@ extern int __gpio_cansleep(unsigned gpio);
170 171
171extern int __gpio_to_irq(unsigned gpio); 172extern int __gpio_to_irq(unsigned gpio);
172 173
173/**
174 * struct gpio - a structure describing a GPIO with configuration
175 * @gpio: the GPIO number
176 * @flags: GPIO configuration as specified by GPIOF_*
177 * @label: a literal description string of this GPIO
178 */
179struct gpio {
180 unsigned gpio;
181 unsigned long flags;
182 const char *label;
183};
184
185extern int gpio_request_one(unsigned gpio, unsigned long flags, const char *label); 174extern int gpio_request_one(unsigned gpio, unsigned long flags, const char *label);
186extern int gpio_request_array(const struct gpio *array, size_t num); 175extern int gpio_request_array(const struct gpio *array, size_t num);
187extern void gpio_free_array(const struct gpio *array, size_t num); 176extern void gpio_free_array(const struct gpio *array, size_t num);
diff --git a/include/linux/gpio.h b/include/linux/gpio.h
index 17b5a0d80e42..38ac48b7d3a8 100644
--- a/include/linux/gpio.h
+++ b/include/linux/gpio.h
@@ -14,6 +14,18 @@
14#define GPIOF_OUT_INIT_LOW (GPIOF_DIR_OUT | GPIOF_INIT_LOW) 14#define GPIOF_OUT_INIT_LOW (GPIOF_DIR_OUT | GPIOF_INIT_LOW)
15#define GPIOF_OUT_INIT_HIGH (GPIOF_DIR_OUT | GPIOF_INIT_HIGH) 15#define GPIOF_OUT_INIT_HIGH (GPIOF_DIR_OUT | GPIOF_INIT_HIGH)
16 16
17/**
18 * struct gpio - a structure describing a GPIO with configuration
19 * @gpio: the GPIO number
20 * @flags: GPIO configuration as specified by GPIOF_*
21 * @label: a literal description string of this GPIO
22 */
23struct gpio {
24 unsigned gpio;
25 unsigned long flags;
26 const char *label;
27};
28
17#ifdef CONFIG_GENERIC_GPIO 29#ifdef CONFIG_GENERIC_GPIO
18#include <asm/gpio.h> 30#include <asm/gpio.h>
19 31
@@ -24,18 +36,8 @@
24#include <linux/errno.h> 36#include <linux/errno.h>
25 37
26struct device; 38struct device;
27struct gpio;
28struct gpio_chip; 39struct gpio_chip;
29 40
30/*
31 * Some platforms don't support the GPIO programming interface.
32 *
33 * In case some driver uses it anyway (it should normally have
34 * depended on GENERIC_GPIO), these routines help the compiler
35 * optimize out much GPIO-related code ... or trigger a runtime
36 * warning when something is wrongly called.
37 */
38
39static inline bool gpio_is_valid(int number) 41static inline bool gpio_is_valid(int number)
40{ 42{
41 return false; 43 return false;