From patchwork Thu Apr 9 15:18:36 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ivan T. Ivanov" X-Patchwork-Id: 6188631 Return-Path: X-Original-To: patchwork-linux-arm-msm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 5BA909F2EC for ; Thu, 9 Apr 2015 15:19:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 90BE12037A for ; Thu, 9 Apr 2015 15:19:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B0CB52035C for ; Thu, 9 Apr 2015 15:19:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755703AbbDIPSu (ORCPT ); Thu, 9 Apr 2015 11:18:50 -0400 Received: from mail-wi0-f177.google.com ([209.85.212.177]:36456 "EHLO mail-wi0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755519AbbDIPSm (ORCPT ); Thu, 9 Apr 2015 11:18:42 -0400 Received: by wizk4 with SMTP id k4so96435838wiz.1 for ; Thu, 09 Apr 2015 08:18:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=3IIckyW0KsUm6G3IcrZxI7X9RT1smc1hBGXKsUTKDqA=; b=FWDIeyur3uwMj5IF63asG4wsBrlw0IjuKymJg0nT+V0zUgfYY+jCQwMnhIsseSIWjl kSwNx4mgGcjHqzjuiya/d5Yt+Hvg70zH8t7DpFkqAtF9lC++2qNspe7pcEEBnHP9xiVS OfiRx5PB0xRrAKv94ZJOlV59joC7bLTLl/TRkuqLQ95CZ/kw/ddGOw5MylARxbbnbnrz 1/LjLvR+NDcHnBRbmvrRWWFiz2PyV350DTgkQi0HYx65a9IyXoxtMhBFRsOBM2xd84bC +fWA+65PQE5MunA3DQCIyqg8jNx08EDcXl/+hRof/5MOvyUEDvXgBcXaIql0Mi9Zed4W lPNQ== X-Gm-Message-State: ALoCoQmLNcPr1ENG+GkhVfkUEOOhu2HLnrEQZLtDVt3MpLjl35U3EGpqJPj2r0KtjbCPIs6Rndwh X-Received: by 10.180.218.108 with SMTP id pf12mr7248461wic.13.1428592721819; Thu, 09 Apr 2015 08:18:41 -0700 (PDT) Received: from localhost.localdomain ([37.157.136.206]) by mx.google.com with ESMTPSA id ed14sm10383483wic.11.2015.04.09.08.18.40 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 09 Apr 2015 08:18:41 -0700 (PDT) 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-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Reviewed-by: Bjorn Andersson --- drivers/pinctrl/qcom/pinctrl-spmi-gpio.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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");