X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=include%2Fasm-generic%2Fgpio.h;h=ecf675a59d2197d00f934aa89f4506028a725839;hb=13c48c490208d9e70d8d66d56f96c5054db69af7;hp=f29a502f4a6c3d1a656ae5142f52b98fe6421408;hpb=655d2ce073f5927194dbc28d2bd3c062a4a3caac;p=linux-2.6 diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h index f29a502f4a..ecf675a59d 100644 --- a/include/asm-generic/gpio.h +++ b/include/asm-generic/gpio.h @@ -16,7 +16,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 +55,7 @@ struct seq_file; */ struct gpio_chip { char *label; + struct module *owner; int (*direction_input)(struct gpio_chip *chip, unsigned offset); @@ -66,6 +74,7 @@ struct gpio_chip { extern const char *gpiochip_is_requested(struct gpio_chip *chip, unsigned offset); +extern int __init __must_check gpiochip_reserve(int start, int ngpio); /* add/remove chips */ extern int gpiochip_add(struct gpio_chip *chip); @@ -97,6 +106,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. */