From: Robert ABEL <rabel@cit-ec.uni-bielefeld.de>
To: linux-gpio@vger.kernel.org
Cc: linus.walleij@linaro.org, Robert ABEL <rabel@cit-ec.uni-bielefeld.de>
Subject: [PATCH] GPIOD: fix gpiod_direction_output initial value
Date: Tue, 29 Apr 2014 14:27:22 +0200 [thread overview]
Message-ID: <1398774442-2407-1-git-send-email-rabel@cit-ec.uni-bielefeld.de> (raw)
gpiod_direction_output initial value was used as raw value instead of
logical value. Convert value from logical to raw.
Signed-off-by: Robert ABEL <rabel@cit-ec.uni-bielefeld.de>
---
drivers/gpio/gpiolib.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index f48817d..2309322 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -2032,6 +2032,10 @@ static int _gpiod_direction_output_raw(struct gpio_desc *desc, int value)
return -EIO;
}
+ /* convert logical value to raw value */
+ if (test_bit(FLAG_ACTIVE_LOW, &desc->flags))
+ value = !value;
+
/* Open drain pin should not be driven to 1 */
if (value && test_bit(FLAG_OPEN_DRAIN, &desc->flags))
return gpiod_direction_input(desc);
--
1.9.2
next reply other threads:[~2014-04-29 12:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-29 12:27 Robert ABEL [this message]
2014-05-01 6:28 ` [PATCH] GPIOD: fix gpiod_direction_output initial value Alexandre Courbot
2014-05-05 9:31 ` Robert Abel
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=1398774442-2407-1-git-send-email-rabel@cit-ec.uni-bielefeld.de \
--to=rabel@cit-ec.uni-bielefeld.de \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@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).