mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Neil Zhang <zhangwm@marvell.com>
To: grant.likely@secretlab.ca, linus.walleij@linaro.org,
	haojian.zhuang@gmail.com
Cc: linux-kernel@vger.kernel.org, Neil Zhang <zhangwm@marvell.com>
Subject: [PATCH V2] GPIO: gpio-pxa: fix bug when get gpio value
Date: Wed, 26 Sep 2012 09:46:47 +0800	[thread overview]
Message-ID: <1348624007-16634-1-git-send-email-zhangwm@marvell.com> (raw)

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


             reply	other threads:[~2012-09-26  1:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-26  1:46 Neil Zhang [this message]
2012-09-26  6:44 ` Haojian Zhuang
2012-09-27  1:25   ` Neil Zhang
2012-09-30  8:30 ` Linus Walleij

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1348624007-16634-1-git-send-email-zhangwm@marvell.com \
    --to=zhangwm@marvell.com \
    --cc=grant.likely@secretlab.ca \
    --cc=haojian.zhuang@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®