diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2014-11-28 07:42:42 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2014-11-28 15:21:27 +0100 |
commit | 604aff317876d15ba1618b89f359b0b71481fdfb (patch) | |
tree | bfef7f685c4356d858be42de74591105dfbba7da /include/gpio.h | |
parent | 21c31b9de2f0343c56aa2abac3b324cf21a5d02e (diff) | |
download | barebox-604aff317876d15ba1618b89f359b0b71481fdfb.tar.gz barebox-604aff317876d15ba1618b89f359b0b71481fdfb.tar.xz |
gpio: move gpio_is_valid to include/gpio.h
No architectue implements its own gpio_is_valid() function, so move
the only existing implementation to include/gpio.h where it's available
for all users.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include/gpio.h')
-rw-r--r-- | include/gpio.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/include/gpio.h b/include/gpio.h index 4a97521aee..f116ea6af7 100644 --- a/include/gpio.h +++ b/include/gpio.h @@ -3,6 +3,17 @@ #include <asm/gpio.h> +#define ARCH_NR_GPIOS 256 + +static inline int gpio_is_valid(int gpio) +{ + if (gpio < 0) + return 0; + if (gpio < ARCH_NR_GPIOS) + return 1; + return 0; +} + #define GPIOF_DIR_OUT (0 << 0) #define GPIOF_DIR_IN (1 << 0) |