lkml.org 
[lkml]   [2012]   [Sep]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] GPIO: gpio-pxa: fix bug when get gpio value
Date
We need to return 0 or 1 when get gpio value.

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

diff --git a/drivers/gpio/gpio-pxa.c b/drivers/gpio/gpio-pxa.c
index 9cac88a..1f9a058 100644
--- a/drivers/gpio/gpio-pxa.c
+++ b/drivers/gpio/gpio-pxa.c
@@ -269,7 +269,10 @@ 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 = __raw_readl(gpio_chip_base(chip) + GPLR_OFFSET);
+ u32 mask = 1 << offset;
+
+ return (gplr & mask) != 0;
}

static void pxa_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
--
1.7.4.1


\
 
 \ /
  Last update: 2012-09-25 14:41    [W:0.024 / U:0.168 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site