linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ivan T. Ivanov" <ivan.ivanov@linaro.org>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: Bjorn Andersson <bjorn.andersson@sonymobile.com>,
	Arnd Bergmann <arnd@arndb.de>,
	Soren Brinkmann <soren.brinkmann@xilinx.com>,
	linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-msm@vger.kernel.org
Subject: [PATCH 2/3] pinctrl: qcom-spmi-gpio: Fix input value report
Date: Thu,  9 Apr 2015 18:18:36 +0300	[thread overview]
Message-ID: <1428592717-21706-2-git-send-email-ivan.ivanov@linaro.org> (raw)
In-Reply-To: <1428592717-21706-1-git-send-email-ivan.ivanov@linaro.org>

Read input buffer when input is enabled, not when it is
disabled. Also fix interpretation of the pmic_gpio_read()
return code, negative value means an error.

Signed-off-by: Ivan T. Ivanov <ivan.ivanov@linaro.org>
---
 drivers/pinctrl/qcom/pinctrl-spmi-gpio.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c b/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c
index 4b21aac..e8b74c6 100644
--- a/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c
+++ b/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c
@@ -466,12 +466,13 @@ static void pmic_gpio_config_dbg_show(struct pinctrl_dev *pctldev,
 		seq_puts(s, " ---");
 	} else {

-		if (!pad->input_enabled) {
+		if (pad->input_enabled) {
 			ret = pmic_gpio_read(state, pad, PMIC_MPP_REG_RT_STS);
-			if (!ret) {
-				ret &= PMIC_MPP_REG_RT_STS_VAL_MASK;
-				pad->out_value = ret;
-			}
+			if (ret < 0)
+				return;
+
+			ret &= PMIC_MPP_REG_RT_STS_VAL_MASK;
+			pad->out_value = ret;
 		}

 		seq_printf(s, " %-4s", pad->output_enabled ? "out" : "in");
--
1.9.1

  reply	other threads:[~2015-04-09 15:18 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-09 15:18 [PATCH 1/3] pinctrl: qcom-spmi-gpio: Fix output type configuration Ivan T. Ivanov
2015-04-09 15:18 ` Ivan T. Ivanov [this message]
2015-04-09 16:01   ` [PATCH 2/3] pinctrl: qcom-spmi-gpio: Fix input value report Bjorn Andersson
2015-04-28 12:49   ` Linus Walleij
2015-04-09 15:18 ` [PATCH 3/3] pinctrl: qcom-spmi-mpp: " Ivan T. Ivanov
2015-04-09 16:03   ` Bjorn Andersson
2015-04-28 12:53   ` Linus Walleij
2015-04-09 15:53 ` [PATCH 1/3] pinctrl: qcom-spmi-gpio: Fix output type configuration Bjorn Andersson
2015-04-28 12:48 ` 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=1428592717-21706-2-git-send-email-ivan.ivanov@linaro.org \
    --to=ivan.ivanov@linaro.org \
    --cc=arnd@arndb.de \
    --cc=bjorn.andersson@sonymobile.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=soren.brinkmann@xilinx.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;
as well as URLs for NNTP newsgroup(s).