From: Jan Luebbe <jluebbe@debian.org>
To: barebox@lists.infradead.org
Subject: [PATCH] gpio-davinci: gpio get should return 0 or 1
Date: Sat, 30 May 2015 14:57:49 +0200 [thread overview]
Message-ID: <1432990669-20515-1-git-send-email-jluebbe@debian.org> (raw)
Returning other values causes problems for client code which wants to
perform calculations with the returned value.
Signed-off-by: Jan Luebbe <jluebbe@debian.org>
---
drivers/gpio/gpio-davinci.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpio/gpio-davinci.c b/drivers/gpio/gpio-davinci.c
index 2b1d82b..61c6e7e 100644
--- a/drivers/gpio/gpio-davinci.c
+++ b/drivers/gpio/gpio-davinci.c
@@ -117,7 +117,7 @@ static int davinci_gpio_get(struct gpio_chip *chip, unsigned offset)
struct davinci_gpio_controller *d = chip2controller(chip);
struct davinci_gpio_regs __iomem *g = d->regs;
- return (1 << offset) & readl_relaxed(&g->in_data);
+ return ((1 << offset) & readl_relaxed(&g->in_data)) ? 1 : 0;
}
/*
--
2.1.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next reply other threads:[~2015-05-30 12:58 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-30 12:57 Jan Luebbe [this message]
2015-06-01 12:07 ` Sascha Hauer
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=1432990669-20515-1-git-send-email-jluebbe@debian.org \
--to=jluebbe@debian.org \
--cc=barebox@lists.infradead.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