diff options
Diffstat (limited to 'include/asm-generic/gpio.h')
-rw-r--r-- | include/asm-generic/gpio.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h index f29a502f4a6c..ecf675a59d21 100644 --- a/include/asm-generic/gpio.h +++ b/include/asm-generic/gpio.h | |||
@@ -16,7 +16,14 @@ | |||
16 | #define ARCH_NR_GPIOS 256 | 16 | #define ARCH_NR_GPIOS 256 |
17 | #endif | 17 | #endif |
18 | 18 | ||
19 | static inline int gpio_is_valid(int number) | ||
20 | { | ||
21 | /* only some non-negative numbers are valid */ | ||
22 | return ((unsigned)number) < ARCH_NR_GPIOS; | ||
23 | } | ||
24 | |||
19 | struct seq_file; | 25 | struct seq_file; |
26 | struct module; | ||
20 | 27 | ||
21 | /** | 28 | /** |
22 | * struct gpio_chip - abstract a GPIO controller | 29 | * struct gpio_chip - abstract a GPIO controller |
@@ -48,6 +55,7 @@ struct seq_file; | |||
48 | */ | 55 | */ |
49 | struct gpio_chip { | 56 | struct gpio_chip { |
50 | char *label; | 57 | char *label; |
58 | struct module *owner; | ||
51 | 59 | ||
52 | int (*direction_input)(struct gpio_chip *chip, | 60 | int (*direction_input)(struct gpio_chip *chip, |
53 | unsigned offset); | 61 | unsigned offset); |
@@ -66,6 +74,7 @@ struct gpio_chip { | |||
66 | 74 | ||
67 | extern const char *gpiochip_is_requested(struct gpio_chip *chip, | 75 | extern const char *gpiochip_is_requested(struct gpio_chip *chip, |
68 | unsigned offset); | 76 | unsigned offset); |
77 | extern int __init __must_check gpiochip_reserve(int start, int ngpio); | ||
69 | 78 | ||
70 | /* add/remove chips */ | 79 | /* add/remove chips */ |
71 | extern int gpiochip_add(struct gpio_chip *chip); | 80 | extern int gpiochip_add(struct gpio_chip *chip); |
@@ -97,6 +106,12 @@ extern int __gpio_cansleep(unsigned gpio); | |||
97 | 106 | ||
98 | #else | 107 | #else |
99 | 108 | ||
109 | static inline int gpio_is_valid(int number) | ||
110 | { | ||
111 | /* only non-negative numbers are valid */ | ||
112 | return number >= 0; | ||
113 | } | ||
114 | |||
100 | /* platforms that don't directly support access to GPIOs through I2C, SPI, | 115 | /* platforms that don't directly support access to GPIOs through I2C, SPI, |
101 | * or other blocking infrastructure can use these wrappers. | 116 | * or other blocking infrastructure can use these wrappers. |
102 | */ | 117 | */ |