Update gpiommc to use configfs
[openwrt.git] / target / linux / brcm47xx / patches-2.6.25 / 710-add-gpio-is-valid.patch
1 Add gpio_is_valid() for bcm47xx
2 Index: linux-2.6.25.10/arch/mips/bcm47xx/gpio.c
3 ===================================================================
4 --- linux-2.6.25.10.orig/arch/mips/bcm47xx/gpio.c       2008-07-20 20:48:44.000000000 +0200
5 +++ linux-2.6.25.10/arch/mips/bcm47xx/gpio.c    2008-07-20 20:57:55.000000000 +0200
6 @@ -77,3 +77,15 @@ int bcm47xx_gpio_direction_output(unsign
7  }
8  EXPORT_SYMBOL_GPL(bcm47xx_gpio_direction_output);
9  
10 +int bcm47xx_gpio_is_valid(int gpio)
11 +{
12 +       if (ssb_bcm47xx.chipco.dev) {
13 +               if (gpio >= 0 && gpio < BCM47XX_CHIPCO_GPIO_LINES)
14 +                       return 1;
15 +       } else if (ssb_bcm47xx.extif.dev) {
16 +               if (gpio >= 0 && gpio < BCM47XX_EXTIF_GPIO_LINES)
17 +                       return 1;
18 +       }
19 +       return 0;
20 +}
21 +EXPORT_SYMBOL_GPL(bcm47xx_gpio_is_valid);
22 Index: linux-2.6.25.10/include/asm-mips/mach-bcm47xx/gpio.h
23 ===================================================================
24 --- linux-2.6.25.10.orig/include/asm-mips/mach-bcm47xx/gpio.h   2008-07-20 20:48:44.000000000 +0200
25 +++ linux-2.6.25.10/include/asm-mips/mach-bcm47xx/gpio.h        2008-07-20 20:49:20.000000000 +0200
26 @@ -17,6 +17,7 @@ extern int bcm47xx_gpio_get_value(unsign
27  extern void bcm47xx_gpio_set_value(unsigned gpio, int value);
28  extern int bcm47xx_gpio_direction_input(unsigned gpio);
29  extern int bcm47xx_gpio_direction_output(unsigned gpio, int value);
30 +extern int bcm47xx_gpio_is_valid(int gpio);
31  
32  static inline int gpio_request(unsigned gpio, const char *label)
33  {
34 @@ -52,6 +53,10 @@ static inline int gpio_direction_output(
35         return bcm47xx_gpio_direction_output(gpio, value);
36  }
37  
38 +static inline int gpio_is_valid(int gpio)
39 +{
40 +       return bcm47xx_gpio_is_valid(gpio);
41 +}
42  
43  /* cansleep wrappers */
44  #include <asm-generic/gpio.h>