]> err.no Git - linux-2.6/commitdiff
mfd: sm501 fix gpio number calculation for upper bank
authorBen Dooks <ben-linux@fluff.org>
Fri, 25 Jul 2008 08:46:03 +0000 (01:46 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 25 Jul 2008 17:53:30 +0000 (10:53 -0700)
The sm501_gpio_pin2nr() routine returns the wrong values for gpios in the
upper bank.

Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/mfd/sm501.c

index 79d7aea5510b41689dd503b31e66bbcc54708192..7aebad4c06ff939114bdff7f5f58874ee197f96d 100644 (file)
@@ -1108,7 +1108,9 @@ static void sm501_gpio_remove(struct sm501_devdata *sm)
 static inline int sm501_gpio_pin2nr(struct sm501_devdata *sm, unsigned int pin)
 {
        struct sm501_gpio *gpio = &sm->gpio;
-       return pin + (pin < 32) ? gpio->low.gpio.base : gpio->high.gpio.base;
+       int base = (pin < 32) ? gpio->low.gpio.base : gpio->high.gpio.base;
+
+       return (pin % 32) + base;
 }
 
 static inline int sm501_gpio_isregistered(struct sm501_devdata *sm)