Merge branch 'sbp2-spindown' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee139...
[pandora-kernel.git] / include / asm-generic / gpio.h
index f29a502..6be061d 100644 (file)
@@ -1,8 +1,12 @@
 #ifndef _ASM_GENERIC_GPIO_H
 #define _ASM_GENERIC_GPIO_H
 
+#include <linux/types.h>
+
 #ifdef CONFIG_HAVE_GPIO_LIB
 
+#include <linux/compiler.h>
+
 /* Platforms may implement their GPIO interface with library code,
  * at a small performance cost for non-inlined operations and some
  * extra memory (for code and for per-GPIO table entries).
 #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;
+struct module;
 
 /**
  * struct gpio_chip - abstract a GPIO controller
@@ -48,6 +59,7 @@ struct seq_file;
  */
 struct gpio_chip {
        char                    *label;
+       struct module           *owner;
 
        int                     (*direction_input)(struct gpio_chip *chip,
                                                unsigned offset);
@@ -66,6 +78,7 @@ struct gpio_chip {
 
 extern const char *gpiochip_is_requested(struct gpio_chip *chip,
                        unsigned offset);
+extern int __must_check gpiochip_reserve(int start, int ngpio);
 
 /* add/remove chips */
 extern int gpiochip_add(struct gpio_chip *chip);
@@ -97,6 +110,12 @@ extern int __gpio_cansleep(unsigned gpio);
 
 #else
 
+static inline int gpio_is_valid(int number)
+{
+       /* only non-negative numbers are valid */
+       return number >= 0;
+}
+
 /* platforms that don't directly support access to GPIOs through I2C, SPI,
  * or other blocking infrastructure can use these wrappers.
  */