From: Neil Zhang <zhangwm@marvell.com>
To: linus.walleij@linaro.org, gnurou@gmail.com,
linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Neil Zhang <zhangwm@marvell.com>
Subject: [PATCH] gpio: pxa: normalize the return value for gpio_get
Date: Fri, 10 Jan 2014 14:03:03 +0800 [thread overview]
Message-ID: <1389333783-3372-1-git-send-email-zhangwm@marvell.com> (raw)
It would be convenient to normalize the return value for gpio_get.
I have checked mach-mmp / mach-pxa / plat-pxa / plat-orion / mach-orion5x.
It's OK for all of them to change this function to return 0 and 1.
Signed-off-by: Neil Zhang <zhangwm@marvell.com>
---
drivers/gpio/gpio-pxa.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/gpio/gpio-pxa.c b/drivers/gpio/gpio-pxa.c
index cc13d1b..42e6e64 100644
--- a/drivers/gpio/gpio-pxa.c
+++ b/drivers/gpio/gpio-pxa.c
@@ -263,7 +263,8 @@ 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));
}
static void pxa_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
--
1.7.9.5
next reply other threads:[~2014-01-10 6:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-10 6:03 Neil Zhang [this message]
2014-01-15 7:57 ` [PATCH] gpio: pxa: normalize the return value for gpio_get Linus Walleij
2014-01-15 8:26 ` Neil Zhang
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=1389333783-3372-1-git-send-email-zhangwm@marvell.com \
--to=zhangwm@marvell.com \
--cc=gnurou@gmail.com \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).