Skip to contentSkip to conversation

mxc/gpio: make _set_value work with values != 0/1

PATCH New Peter Korsgaard 1 participant 1 message Oct 11, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 mxc/gpio: make _set_value work with values != 0/1

Documentation/gpio.txt specifies that the value argument to gpio_set_value() should be handled as a boolean (E.G. != 0 is high), so use the same logic as in _set_direction().

---
Use !! form, get rid of extra line

 arch/arm/plat-mxc/gpio.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/plat-mxc/gpio.c +1 -1
index 57ec4a8..9d38da0 100644
@@ -235,7 +235,7 @@ static void mxc_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
 	unsigned long flags;
 
 	spin_lock_irqsave(&port->lock, flags);
-	l = (__raw_readl(reg) & (~(1 << offset))) | (value << offset);
+	l = (__raw_readl(reg) & (~(1 << offset))) | (!!value << offset);
 	__raw_writel(l, reg);
 	spin_unlock_irqrestore(&port->lock, flags);
 }
Signature · 1 line
1.7.1