public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sonic Zhang <sonic.adi@gmail.com>
To: Linus Walleij <linus.walleij@linaro.org>, Axel Lin <axel.lin@ingics.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	<adi-buildroot-devel@lists.sourceforge.net>,
	Sonic Zhang <sonic.zhang@analog.com>
Subject: [PATCH] pinctrl: pinctrl-adi2: GPIO output value should be set after the GPIO interrupt is disabled.
Date: Tue, 8 Oct 2013 15:31:21 +0800	[thread overview]
Message-ID: <1381217481-17252-1-git-send-email-sonic.adi@gmail.com> (raw)

From: Sonic Zhang <sonic.zhang@analog.com>

Use BIT macro as well.

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
---
 drivers/pinctrl/pinctrl-adi2.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-adi2.c b/drivers/pinctrl/pinctrl-adi2.c
index a74e6f4..7a39562 100644
--- a/drivers/pinctrl/pinctrl-adi2.c
+++ b/drivers/pinctrl/pinctrl-adi2.c
@@ -766,9 +766,9 @@ static void adi_gpio_set_value(struct gpio_chip *chip, unsigned offset,
 	spin_lock_irqsave(&port->lock, flags);
 
 	if (value)
-		writew(1 << offset, &regs->data_set);
+		writew(BIT(offset), &regs->data_set);
 	else
-		writew(1 << offset, &regs->data_clear);
+		writew(BIT(offset), &regs->data_clear);
 
 	spin_unlock_irqrestore(&port->lock, flags);
 }
@@ -780,12 +780,14 @@ static int adi_gpio_direction_output(struct gpio_chip *chip, unsigned offset,
 	struct gpio_port_t *regs = port->regs;
 	unsigned long flags;
 
-	adi_gpio_set_value(chip, offset, value);
-
 	spin_lock_irqsave(&port->lock, flags);
 
-	writew(readw(&regs->inen) & ~(1 << offset), &regs->inen);
-	writew(1 << offset, &regs->dir_set);
+	writew(readw(&regs->inen) & ~BIT(offset), &regs->inen);
+	if (value)
+		writew(BIT(offset), &regs->data_set);
+	else
+		writew(BIT(offset), &regs->data_clear);
+	writew(BIT(offset), &regs->dir_set);
 
 	spin_unlock_irqrestore(&port->lock, flags);
 
-- 
1.8.2.3



             reply	other threads:[~2013-10-08  7:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-08  7:31 Sonic Zhang [this message]
2013-10-08  7:48 ` [PATCH] pinctrl: pinctrl-adi2: GPIO output value should be set after the GPIO interrupt is disabled Axel Lin
2013-10-08  7:59   ` Sonic Zhang
2013-10-09 11:09 ` 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=1381217481-17252-1-git-send-email-sonic.adi@gmail.com \
    --to=sonic.adi@gmail.com \
    --cc=adi-buildroot-devel@lists.sourceforge.net \
    --cc=axel.lin@ingics.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sonic.zhang@analog.com \
    /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