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: 46965 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f71.google.com (mail-wg0-f71.google.com [74.125.82.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 9C9DB21416 for ; Thu, 9 Apr 2015 15:19:19 +0000 (UTC) Received: by wgiv13 with SMTP id v13sf27002546wgi.3 for ; Thu, 09 Apr 2015 08:19:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=UJc5dXSombvdOXxokBeRmn8WfFEGAsR5Cn2jGaoCE4Y=; b=gX0C4hkqX/RW73vyw6oPgJYexxFytmh5P/u1vHDeCzQXuP5v2lwwTgCDRW7xhVA3AG CLbHvjr4V+yDkV1/xVy1q8+QDuWrn1Bdxf6uPNHXS5u9kV2f4hbcf0U9ortdGJWyUT9V AACyYt/eXDAWKFmeMFMER2jghxz6cgdQQmfqnaluSSdsJHmd6CjAj8J/yMh2OYrZlAMm lCSFK3b3xDR6Sn1FnQsWjq9WWsy/g8o0gGlu16K/9WOsGLUgzT+lhxdXqknEJ0Ha2LZc Avs8u8arkbH0BoR/tEK/6BgDE1BWOman8CrkXOY3tifZz+GNa8IjRXhDvnxRkpJyicx5 Yszg== X-Gm-Message-State: ALoCoQlm+sCQcP4TDXWfHnbGZIIKoTEgV44iEOnaADJXvOxkfcDyp/4sTbknl5qJVvbTgo2hhKGs X-Received: by 10.180.97.68 with SMTP id dy4mr714114wib.0.1428592758792; Thu, 09 Apr 2015 08:19:18 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.179.131 with SMTP id dg3ls327701lac.74.gmail; Thu, 09 Apr 2015 08:19:18 -0700 (PDT) X-Received: by 10.152.2.105 with SMTP id 9mr4762713lat.16.1428592758503; Thu, 09 Apr 2015 08:19:18 -0700 (PDT) Received: from mail-lb0-f177.google.com (mail-lb0-f177.google.com. [209.85.217.177]) by mx.google.com with ESMTPS id un5si11694169lbc.53.2015.04.09.08.19.18 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Apr 2015 08:19:18 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.177 as permitted sender) client-ip=209.85.217.177; Received: by lbbzk7 with SMTP id zk7so93723909lbb.0 for ; Thu, 09 Apr 2015 08:19:18 -0700 (PDT) X-Received: by 10.152.36.2 with SMTP id m2mr4833109laj.72.1428592758385; Thu, 09 Apr 2015 08:19:18 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.67.65 with SMTP id l1csp535819lbt; Thu, 9 Apr 2015 08:19:17 -0700 (PDT) X-Received: by 10.66.139.70 with SMTP id qw6mr56831331pab.112.1428592756462; Thu, 09 Apr 2015 08:19:16 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id qn13si4467693pdb.53.2015.04.09.08.19.15; Thu, 09 Apr 2015 08:19:16 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755740AbbDIPSw (ORCPT + 27 others); 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 Received: by wgin8 with SMTP id n8so123761875wgi.0 for ; Thu, 09 Apr 2015 08:18:41 -0700 (PDT) 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-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ivan.ivanov@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.177 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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(-) -- 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/ 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");