Commit 53a9600c634e3bfd6230e0597aca159bf4d4d010

Authored by Ben Dooks
Committed by Linus Torvalds
1 parent f2999209d7

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>

Showing 1 changed file with 3 additions and 1 deletions Side-by-side Diff

... ... @@ -1108,7 +1108,9 @@
1108 1108 static inline int sm501_gpio_pin2nr(struct sm501_devdata *sm, unsigned int pin)
1109 1109 {
1110 1110 struct sm501_gpio *gpio = &sm->gpio;
1111   - return pin + (pin < 32) ? gpio->low.gpio.base : gpio->high.gpio.base;
  1111 + int base = (pin < 32) ? gpio->low.gpio.base : gpio->high.gpio.base;
  1112 +
  1113 + return (pin % 32) + base;
1112 1114 }
1113 1115  
1114 1116 static inline int sm501_gpio_isregistered(struct sm501_devdata *sm)