summaryrefslogtreecommitdiff
path: root/target/linux/generic-2.6/patches-2.6.25/920-backport-gpio-is-valid.patch
blob: 966270b78e13e0b16bcc2cdb3f6d3aed5a55b23e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Backport gpio_is_valid() for gpiolib from linux-2.6.26
Index: linux-2.6.25.10/include/asm-generic/gpio.h
===================================================================
--- linux-2.6.25.10.orig/include/asm-generic/gpio.h	2008-07-03 05:46:47.000000000 +0200
+++ linux-2.6.25.10/include/asm-generic/gpio.h	2008-07-20 20:32:12.000000000 +0200
@@ -16,6 +16,12 @@
 #define ARCH_NR_GPIOS		256
 #endif
 
+static inline int gpio_is_valid(int number)
+{
+	/* only some non-negative numbers are valid */
+	return ((unsigned)number) < ARCH_NR_GPIOS;
+}
+
 struct seq_file;
 
 /**