From 53a9600c634e3bfd6230e0597aca159bf4d4d010 Mon Sep 17 00:00:00 2001 From: Ben Dooks Date: Fri, 25 Jul 2008 01:46:03 -0700 Subject: mfd: sm501 fix gpio number calculation for upper bank The sm501_gpio_pin2nr() routine returns the wrong values for gpios in the upper bank. Signed-off-by: Ben Dooks Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/mfd/sm501.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/mfd/sm501.c b/drivers/mfd/sm501.c index 79d7aea5510..7aebad4c06f 100644 --- a/drivers/mfd/sm501.c +++ b/drivers/mfd/sm501.c @@ -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) -- cgit v1.2.3-70-g09d2