5c4ecfe870f5478fbdbb32e6763a473b351278db
[openwrt/svn-archive/archive.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 Index: linux-2.6.28.5/arch/mips/include/asm/mach-bcm47xx/gpio.h
10 ===================================================================
11 --- linux-2.6.28.5.orig/arch/mips/include/asm/mach-bcm47xx/gpio.h 2009-02-14 20:52:31.000000000 +0100
12 +++ linux-2.6.28.5/arch/mips/include/asm/mach-bcm47xx/gpio.h 2009-02-14 21:01:20.000000000 +0100
13 @@ -31,24 +31,28 @@ static inline void gpio_set_value(unsign
14
15 static inline int gpio_direction_input(unsigned gpio)
16 {
17 - return ssb_gpio_outen(&ssb_bcm47xx, 1 << gpio, 0);
18 + ssb_gpio_outen(&ssb_bcm47xx, 1 << gpio, 0);
19 + return 0;
20 }
21
22 static inline int gpio_direction_output(unsigned gpio, int value)
23 {
24 - return ssb_gpio_outen(&ssb_bcm47xx, 1 << gpio, 1 << gpio);
25 + ssb_gpio_outen(&ssb_bcm47xx, 1 << gpio, 1 << gpio);
26 + return 0;
27 }
28
29 -static int gpio_intmask(unsigned gpio, int value)
30 +static inline int gpio_intmask(unsigned gpio, int value)
31 {
32 - return ssb_gpio_intmask(&ssb_bcm47xx, 1 << gpio,
33 - value ? 1 << gpio : 0);
34 + ssb_gpio_intmask(&ssb_bcm47xx, 1 << gpio,
35 + value ? 1 << gpio : 0);
36 + return 0;
37 }
38
39 -static int gpio_polarity(unsigned gpio, int value)
40 +static inline int gpio_polarity(unsigned gpio, int value)
41 {
42 - return ssb_gpio_polarity(&ssb_bcm47xx, 1 << gpio,
43 - value ? 1 << gpio : 0);
44 + ssb_gpio_polarity(&ssb_bcm47xx, 1 << gpio,
45 + value ? 1 << gpio : 0);
46 + return 0;
47 }
48
49