From: Mathias Nyman Date: Thu, 27 Mar 2014 13:02:08 +0000 (+0200) Subject: gpio-lynxpoint: force gpio_get() to return "1" and "0" only X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=8650ea1ebc31e9b0ab17c31d844dc106e60269db;p=deliverable%2Flinux.git gpio-lynxpoint: force gpio_get() to return "1" and "0" only Don't return the IN_LVL_BIT directly, a high gpio line returned value "1073741824" intestead of "1" because IN_LVL_BIT is BIT(30) Tested-by: Jerome Blin Signed-off-by: Mathias Nyman Signed-off-by: Linus Walleij --- diff --git a/drivers/gpio/gpio-lynxpoint.c b/drivers/gpio/gpio-lynxpoint.c index 41f79cb24a9e..9a82a9074a2c 100644 --- a/drivers/gpio/gpio-lynxpoint.c +++ b/drivers/gpio/gpio-lynxpoint.c @@ -188,7 +188,7 @@ static int lp_irq_type(struct irq_data *d, unsigned type) static int lp_gpio_get(struct gpio_chip *chip, unsigned offset) { unsigned long reg = lp_gpio_reg(chip, offset, LP_CONFIG1); - return inl(reg) & IN_LVL_BIT; + return !!(inl(reg) & IN_LVL_BIT); } static void lp_gpio_set(struct gpio_chip *chip, unsigned offset, int value)