diff options
Diffstat (limited to 'include/asm-generic/gpio.h')
-rw-r--r-- | include/asm-generic/gpio.h | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h index ff5c66080c8c..d494001b1226 100644 --- a/include/asm-generic/gpio.h +++ b/include/asm-generic/gpio.h | |||
@@ -35,9 +35,9 @@ | |||
35 | * platform data and other tables. | 35 | * platform data and other tables. |
36 | */ | 36 | */ |
37 | 37 | ||
38 | static inline int gpio_is_valid(int number) | 38 | static inline bool gpio_is_valid(int number) |
39 | { | 39 | { |
40 | return ((unsigned)number) < ARCH_NR_GPIOS; | 40 | return number >= 0 && number < ARCH_NR_GPIOS; |
41 | } | 41 | } |
42 | 42 | ||
43 | struct device; | 43 | struct device; |
@@ -170,16 +170,6 @@ extern int __gpio_cansleep(unsigned gpio); | |||
170 | 170 | ||
171 | extern int __gpio_to_irq(unsigned gpio); | 171 | extern int __gpio_to_irq(unsigned gpio); |
172 | 172 | ||
173 | #define GPIOF_DIR_OUT (0 << 0) | ||
174 | #define GPIOF_DIR_IN (1 << 0) | ||
175 | |||
176 | #define GPIOF_INIT_LOW (0 << 1) | ||
177 | #define GPIOF_INIT_HIGH (1 << 1) | ||
178 | |||
179 | #define GPIOF_IN (GPIOF_DIR_IN) | ||
180 | #define GPIOF_OUT_INIT_LOW (GPIOF_DIR_OUT | GPIOF_INIT_LOW) | ||
181 | #define GPIOF_OUT_INIT_HIGH (GPIOF_DIR_OUT | GPIOF_INIT_HIGH) | ||
182 | |||
183 | /** | 173 | /** |
184 | * struct gpio - a structure describing a GPIO with configuration | 174 | * struct gpio - a structure describing a GPIO with configuration |
185 | * @gpio: the GPIO number | 175 | * @gpio: the GPIO number |
@@ -193,8 +183,8 @@ struct gpio { | |||
193 | }; | 183 | }; |
194 | 184 | ||
195 | extern int gpio_request_one(unsigned gpio, unsigned long flags, const char *label); | 185 | extern int gpio_request_one(unsigned gpio, unsigned long flags, const char *label); |
196 | extern int gpio_request_array(struct gpio *array, size_t num); | 186 | extern int gpio_request_array(const struct gpio *array, size_t num); |
197 | extern void gpio_free_array(struct gpio *array, size_t num); | 187 | extern void gpio_free_array(const struct gpio *array, size_t num); |
198 | 188 | ||
199 | #ifdef CONFIG_GPIO_SYSFS | 189 | #ifdef CONFIG_GPIO_SYSFS |
200 | 190 | ||
@@ -212,7 +202,7 @@ extern void gpio_unexport(unsigned gpio); | |||
212 | 202 | ||
213 | #else /* !CONFIG_GPIOLIB */ | 203 | #else /* !CONFIG_GPIOLIB */ |
214 | 204 | ||
215 | static inline int gpio_is_valid(int number) | 205 | static inline bool gpio_is_valid(int number) |
216 | { | 206 | { |
217 | /* only non-negative numbers are valid */ | 207 | /* only non-negative numbers are valid */ |
218 | return number >= 0; | 208 | return number >= 0; |