Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755739AbbDIPSw (ORCPT ); Thu, 9 Apr 2015 11:18:52 -0400 Received: from mail-wg0-f54.google.com ([74.125.82.54]:33423 "EHLO mail-wg0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755511AbbDIPSm (ORCPT ); Thu, 9 Apr 2015 11:18:42 -0400 From: "Ivan T. Ivanov" To: Linus Walleij Cc: Bjorn Andersson , Arnd Bergmann , Soren Brinkmann , 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 Message-Id: <1428592717-21706-2-git-send-email-ivan.ivanov@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1428592717-21706-1-git-send-email-ivan.ivanov@linaro.org> References: <1428592717-21706-1-git-send-email-ivan.ivanov@linaro.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1305 Lines: 40 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 --- 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/