aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-generic/gpio.h
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
commitc71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch)
treeecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /include/asm-generic/gpio.h
parentea53c912f8a86a8567697115b6a0d8152beee5c8 (diff)
parent6a00f206debf8a5c8899055726ad127dbeeed098 (diff)
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts: litmus/sched_cedf.c
Diffstat (limited to 'include/asm-generic/gpio.h')
-rw-r--r--include/asm-generic/gpio.h24
1 files changed, 7 insertions, 17 deletions
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
index 8ca18e26d7e3..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
38static inline int gpio_is_valid(int number) 38static 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
43struct device; 43struct device;
@@ -170,16 +170,6 @@ extern int __gpio_cansleep(unsigned gpio);
170 170
171extern int __gpio_to_irq(unsigned gpio); 171extern 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
195extern int gpio_request_one(unsigned gpio, unsigned long flags, const char *label); 185extern int gpio_request_one(unsigned gpio, unsigned long flags, const char *label);
196extern int gpio_request_array(struct gpio *array, size_t num); 186extern int gpio_request_array(const struct gpio *array, size_t num);
197extern void gpio_free_array(struct gpio *array, size_t num); 187extern 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
@@ -210,9 +200,9 @@ extern void gpio_unexport(unsigned gpio);
210 200
211#endif /* CONFIG_GPIO_SYSFS */ 201#endif /* CONFIG_GPIO_SYSFS */
212 202
213#else /* !CONFIG_HAVE_GPIO_LIB */ 203#else /* !CONFIG_GPIOLIB */
214 204
215static inline int gpio_is_valid(int number) 205static 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;
@@ -239,7 +229,7 @@ static inline void gpio_set_value_cansleep(unsigned gpio, int value)
239 gpio_set_value(gpio, value); 229 gpio_set_value(gpio, value);
240} 230}
241 231
242#endif /* !CONFIG_HAVE_GPIO_LIB */ 232#endif /* !CONFIG_GPIOLIB */
243 233
244#ifndef CONFIG_GPIO_SYSFS 234#ifndef CONFIG_GPIO_SYSFS
245 235