[adm5120] use mips_machine code
[openwrt.git] / target / linux / brcm47xx / patches-2.6.25 / 710-add-gpio-is-valid.patch
1 Add gpio_is_valid() for bcm47xx
2 --- a/arch/mips/bcm47xx/gpio.c
3 +++ b/arch/mips/bcm47xx/gpio.c
4 @@ -77,3 +77,15 @@ int bcm47xx_gpio_direction_output(unsign
5 }
6 EXPORT_SYMBOL_GPL(bcm47xx_gpio_direction_output);
7
8 +int bcm47xx_gpio_is_valid(int gpio)
9 +{
10 + if (ssb_bcm47xx.chipco.dev) {
11 + if (gpio >= 0 && gpio < BCM47XX_CHIPCO_GPIO_LINES)
12 + return 1;
13 + } else if (ssb_bcm47xx.extif.dev) {
14 + if (gpio >= 0 && gpio < BCM47XX_EXTIF_GPIO_LINES)
15 + return 1;
16 + }
17 + return 0;
18 +}
19 +EXPORT_SYMBOL_GPL(bcm47xx_gpio_is_valid);
20 --- a/include/asm-mips/mach-bcm47xx/gpio.h
21 +++ b/include/asm-mips/mach-bcm47xx/gpio.h
22 @@ -17,6 +17,7 @@ extern int bcm47xx_gpio_get_value(unsign
23 extern void bcm47xx_gpio_set_value(unsigned gpio, int value);
24 extern int bcm47xx_gpio_direction_input(unsigned gpio);
25 extern int bcm47xx_gpio_direction_output(unsigned gpio, int value);
26 +extern int bcm47xx_gpio_is_valid(int gpio);
27
28 static inline int gpio_request(unsigned gpio, const char *label)
29 {
30 @@ -52,6 +53,8 @@ static inline int gpio_direction_output(
31 return bcm47xx_gpio_direction_output(gpio, value);
32 }
33
34 +#define gpio_is_valid bcm47xx_gpio_is_valid
35 +
36
37 /* cansleep wrappers */
38 #include <asm-generic/gpio.h>
This page took 0.048527 seconds and 5 git commands to generate.