public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] mxc/gpio: make _set_value work with values != 0/1
@ 2010-10-11 11:59 Peter Korsgaard
  2010-10-11 12:12 ` Marc Kleine-Budde
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Peter Korsgaard @ 2010-10-11 11:59 UTC (permalink / raw)
  To: linux-arm-kernel

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().

Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
---
 arch/arm/plat-mxc/gpio.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/arch/arm/plat-mxc/gpio.c b/arch/arm/plat-mxc/gpio.c
index 57ec4a8..e226801 100644
--- a/arch/arm/plat-mxc/gpio.c
+++ b/arch/arm/plat-mxc/gpio.c
@@ -234,8 +234,13 @@ static void mxc_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
 	u32 l;
 	unsigned long flags;
 
+
 	spin_lock_irqsave(&port->lock, flags);
-	l = (__raw_readl(reg) & (~(1 << offset))) | (value << offset);
+	l = __raw_readl(reg);
+	if (value)
+		l |= 1 << offset;
+	else
+		l &= ~(1 << offset);
 	__raw_writel(l, reg);
 	spin_unlock_irqrestore(&port->lock, flags);
 }
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2010-10-11 13:19 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-11 11:59 [PATCH] mxc/gpio: make _set_value work with values != 0/1 Peter Korsgaard
2010-10-11 12:12 ` Marc Kleine-Budde
2010-10-11 12:18   ` Peter Korsgaard
2010-10-11 12:15 ` Uwe Kleine-König
2010-10-11 12:21   ` Peter Korsgaard
2010-10-11 13:19     ` Michał Nazarewicz
2010-10-11 12:17 ` Baruch Siach
2010-10-11 12:23   ` Peter Korsgaard
2010-10-11 12:39     ` Sascha Hauer
2010-10-11 12:47       ` Peter Korsgaard
2010-10-11 12:54         ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox