summaryrefslogtreecommitdiffstats
path: root/drivers/mfd
diff options
context:
space:
mode:
authorBen Dooks <ben-linux@fluff.org>2008-07-25 10:46:03 +0200
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-25 19:53:30 +0200
commit53a9600c634e3bfd6230e0597aca159bf4d4d010 (patch)
treee1cef8dd88dc0cef7012c6668cc33698c1448a0c /drivers/mfd
parentmfd: sm501 build fixes when CONFIG_MFD_SM501_GPIO unset (diff)
downloadlinux-53a9600c634e3bfd6230e0597aca159bf4d4d010.tar.xz
linux-53a9600c634e3bfd6230e0597aca159bf4d4d010.zip
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 <ben-linux@fluff.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/mfd')
-rw-r--r--drivers/mfd/sm501.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/mfd/sm501.c b/drivers/mfd/sm501.c
index 79d7aea5510b..7aebad4c06ff 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)