Skip to contentSkip to conversation

gpio-lynxpoint: force gpio_get() to return "1" and "0" only

PATCH In review Mathias Nyman 2 participants 2 messages Mar 27, 2014 – Mar 28, 2014 GPIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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)

---
 drivers/gpio/gpio-lynxpoint.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpio-lynxpoint.c +1 -1
index 66b1853..803ea3c 100644
@@ -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)
Signature · 1 line
1.8.3.2