[PATCH 1/8] arm: at91: add gpio_is_valid support

Jean-Christophe PLAGNIOL-VILLARD plagnioj at jcrosoft.com
Sat Oct 27 20:24:05 EDT 2012


Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj at jcrosoft.com>
---
 arch/arm/mach-at91/include/mach/gpio.h |   11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/arch/arm/mach-at91/include/mach/gpio.h b/arch/arm/mach-at91/include/mach/gpio.h
index 3533bf9..4edfd25 100644
--- a/arch/arm/mach-at91/include/mach/gpio.h
+++ b/arch/arm/mach-at91/include/mach/gpio.h
@@ -22,6 +22,17 @@
 
 /* these pin numbers double as IRQ numbers, like AT91xxx_ID_* values */
 
+#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	AT91_PIN_PA0	(PIN_BASE + 0x00 + 0)
 #define	AT91_PIN_PA1	(PIN_BASE + 0x00 + 1)
 #define	AT91_PIN_PA2	(PIN_BASE + 0x00 + 2)
-- 
1.7.10.4




More information about the barebox mailing list