Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <jerome.blin@intel.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

authored by

Mathias Nyman and committed by
Linus Walleij
8650ea1e c3626fde

+1 -1
+1 -1
drivers/gpio/gpio-lynxpoint.c
··· 188 188 static int lp_gpio_get(struct gpio_chip *chip, unsigned offset) 189 189 { 190 190 unsigned long reg = lp_gpio_reg(chip, offset, LP_CONFIG1); 191 - return inl(reg) & IN_LVL_BIT; 191 + return !!(inl(reg) & IN_LVL_BIT); 192 192 } 193 193 194 194 static void lp_gpio_set(struct gpio_chip *chip, unsigned offset, int value)