linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V2] GPIO: gpio-pxa: fix bug when get gpio value
@ 2012-09-26  1:46 Neil Zhang
  2012-09-26  6:44 ` Haojian Zhuang
  2012-09-30  8:30 ` Linus Walleij
  0 siblings, 2 replies; 4+ messages in thread
From: Neil Zhang @ 2012-09-26  1:46 UTC (permalink / raw)
  To: grant.likely, linus.walleij, haojian.zhuang; +Cc: linux-kernel, Neil Zhang

We need to return 0 or 1 when get gpio value.

Signed-off-by: Neil Zhang <zhangwm@marvell.com>
---
 drivers/gpio/gpio-pxa.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/gpio/gpio-pxa.c b/drivers/gpio/gpio-pxa.c
index 9cac88a..3c9dc8c 100644
--- a/drivers/gpio/gpio-pxa.c
+++ b/drivers/gpio/gpio-pxa.c
@@ -269,7 +269,9 @@ static int pxa_gpio_direction_output(struct gpio_chip *chip,
 
 static int pxa_gpio_get(struct gpio_chip *chip, unsigned offset)
 {
-	return readl_relaxed(gpio_chip_base(chip) + GPLR_OFFSET) & (1 << offset);
+	u32 gplr = readl_relaxed(gpio_chip_base(chip) + GPLR_OFFSET);
+
+	return (gplr & (1 << offset)) ? 1 : 0;
 }
 
 static void pxa_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
-- 
1.7.4.1


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

end of thread, other threads:[~2012-09-30  8:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-26  1:46 [PATCH V2] GPIO: gpio-pxa: fix bug when get gpio value Neil Zhang
2012-09-26  6:44 ` Haojian Zhuang
2012-09-27  1:25   ` Neil Zhang
2012-09-30  8:30 ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).