The sm501_gpio_pin2nr() routine returns the wrong values
for gpios in the upper bank.

Signed-off-by: Ben Dooks

Index: linux-2.6.26-rc8-quilt3/drivers/mfd/sm501.c
================================================== =================
--- linux-2.6.26-rc8-quilt3.orig/drivers/mfd/sm501.c 2008-07-02 14:17:49.000000000 +0100
+++ linux-2.6.26-rc8-quilt3/drivers/mfd/sm501.c 2008-07-02 14:44:06.000000000 +0100
@@ -1108,7 +1108,9 @@ static void sm501_gpio_remove(struct sm5
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)

--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/