Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 53a9600c authored by Ben Dooks's avatar Ben Dooks Committed by Linus Torvalds
Browse files

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: default avatarBen Dooks <ben-linux@fluff.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent f2999209
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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)