X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=include%2Fasm-generic%2Fgpio.h;h=6be061d09da9d06fc2dabdb520148c028194621b;hb=252815b0cfe711001eff0327872209986b36d490;hp=f29a502f4a6c3d1a656ae5142f52b98fe6421408;hpb=4f02f8220562591322c118d07a32bebf705318b7;p=linux-2.6 diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h index f29a502f4a..6be061d09d 100644 --- a/include/asm-generic/gpio.h +++ b/include/asm-generic/gpio.h @@ -1,8 +1,12 @@ #ifndef _ASM_GENERIC_GPIO_H #define _ASM_GENERIC_GPIO_H +#include + #ifdef CONFIG_HAVE_GPIO_LIB +#include + /* 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). @@ -16,7 +20,14 @@ #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. */