ar71xx: fix random wireless mac address on the TEW-632BRP/DIR-615 boards
[openwrt.git] / target / linux / brcm47xx / patches-2.6.28 / 811-bcm47xx-fix-gpio-direction-retval.patch
1 The GPIO API is supposed to return 0 or a negative error code,
2 but the SSB GPIO functions return the bitmask of the GPIO register.
3 Fix this by ignoring the bitmask and always returning 0. The SSB GPIO functions can't fail.
4
5 --mb
6
7
8
9 --- a/arch/mips/include/asm/mach-bcm47xx/gpio.h
10 +++ b/arch/mips/include/asm/mach-bcm47xx/gpio.h
11 @@ -31,24 +31,28 @@ static inline void gpio_set_value(unsign
12  
13  static inline int gpio_direction_input(unsigned gpio)
14  {
15 -       return ssb_gpio_outen(&ssb_bcm47xx, 1 << gpio, 0);
16 +       ssb_gpio_outen(&ssb_bcm47xx, 1 << gpio, 0);
17 +       return 0;
18  }
19  
20  static inline int gpio_direction_output(unsigned gpio, int value)
21  {
22 -       return ssb_gpio_outen(&ssb_bcm47xx, 1 << gpio, 1 << gpio);
23 +       ssb_gpio_outen(&ssb_bcm47xx, 1 << gpio, 1 << gpio);
24 +       return 0;
25  }
26  
27 -static int gpio_intmask(unsigned gpio, int value)
28 +static inline int gpio_intmask(unsigned gpio, int value)
29  {
30 -       return ssb_gpio_intmask(&ssb_bcm47xx, 1 << gpio,
31 -                               value ? 1 << gpio : 0);
32 +       ssb_gpio_intmask(&ssb_bcm47xx, 1 << gpio,
33 +                        value ? 1 << gpio : 0);
34 +       return 0;
35  }
36  
37 -static int gpio_polarity(unsigned gpio, int value)
38 +static inline int gpio_polarity(unsigned gpio, int value)
39  {
40 -       return ssb_gpio_polarity(&ssb_bcm47xx, 1 << gpio,
41 -                                value ? 1 << gpio : 0);
42 +       ssb_gpio_polarity(&ssb_bcm47xx, 1 << gpio,
43 +                         value ? 1 << gpio : 0);
44 +       return 0;
45  }
46  
47