[PATCH 11/14] gpio: move gpio_is_valid to include/gpio.h

Sascha Hauer s.hauer at pengutronix.de
Fri Nov 28 06:29:03 PST 2014


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 at pengutronix.de>
---
 include/asm-generic/gpio.h | 11 -----------
 include/gpio.h             | 11 +++++++++++
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
index 95fdd05..7674970 100644
--- a/include/asm-generic/gpio.h
+++ b/include/asm-generic/gpio.h
@@ -1,17 +1,6 @@
 #ifndef __ASM_GENERIC_GPIO_H
 #define __ASM_GENERIC_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;
-}
-
 void gpio_set_value(unsigned gpio, int value);
 int gpio_get_value(unsigned gpio);
 int gpio_direction_output(unsigned gpio, int value);
diff --git a/include/gpio.h b/include/gpio.h
index 4a97521..f116ea6 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)
 
-- 
2.1.3




More information about the barebox mailing list