Skip to content

Commit

Permalink
mfd: sm501 fix gpio number calculation for upper bank
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Ben Dooks authored and torvalds committed Jul 25, 2008
1 parent f299920 commit 53a9600
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/mfd/sm501.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 53a9600

Please sign in to comment.