Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2515565imm; Mon, 24 Sep 2018 05:46:40 -0700 (PDT) X-Google-Smtp-Source: ACcGV60Yv/uOK2X0nH9qSaPrbUiKrye3tNPVhzhIFbB1SOvKM5/YqPHfTy1ZXei+LZQHD7Ngnxlx X-Received: by 2002:a17:902:d685:: with SMTP id v5-v6mr10524496ply.42.1537793199995; Mon, 24 Sep 2018 05:46:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537793199; cv=none; d=google.com; s=arc-20160816; b=kw7sz1OXCJ97R3+NIsjY2BNVdpBBv6tpu9JU4YKmh54Dd1BDdSnoYAKXQlh/+Fu627 zuVV8IIq9jV7ep1Yhocn0c4r8M0JI0Lx2pm9EHDlz2qVRJwQbgiB4t4+9tJdGsg/aArQ 0LrLu1fEVukVlvn4pPen9ClmrqoGdZiiVjFtFkrM69q1jZXUu/N8BghEOvqjM+Hh5KdQ NKw7ttEVyuxlLHLdoR8z51il7Ltc74a9mytoF+zpaXTN4MHu4MOg1K0NijGCsZDEAy1K 9adybpzaKtWo1W2Ur9MOvwtNmW5S0rqCBB8lgqLwcw5Bm7Qqn61rSD23PAj+5icG5GeH eZQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from; bh=EBsUg1/4HGQ1X8l7+KVGQLZLEe9MZ0j1+brU2G6qHOg=; b=q3RXSrQn406ilvhwKyzJsESzfsHBaKvtyxhlgHQzq52C3K9QxiNnL+aC3kd4roOZQm 3X+peJo6GjTlqzKghutklykq9hJftBib10JDEWnSY2u4j5xt6qQCpvxbh5oH7gWUh8wo RZ6iSBsev5qGLmpgfenEnulmub1Y0XxRAgx9R7Dzyjo3EPfiMeyIvgESTkZlX3vnHpU5 s5bA8A9SUiKcZXKj0CWb+sdeqXdEMyTplooaxMwN8NawoN8HDmxPEyrsMnE0IpTCsLJ8 BNsp6Ht/rjF3y38HqHqOkqHaPPpNxTGmaWILJOQGn1yOijES7K2hqYyhcEj+RJfSuiTu J4/A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g12-v6si14957070pgi.467.2018.09.24.05.46.25; Mon, 24 Sep 2018 05:46:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389337AbeIXSrY (ORCPT + 99 others); Mon, 24 Sep 2018 14:47:24 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:59778 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730081AbeIXSrX (ORCPT ); Mon, 24 Sep 2018 14:47:23 -0400 Received: from localhost (ip-213-127-77-73.ip.prioritytelecom.net [213.127.77.73]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id C9B95109A; Mon, 24 Sep 2018 12:45:23 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Douglas Anderson , Linus Walleij , Sasha Levin Subject: [PATCH 4.18 231/235] pinctrl: msm: Fix msm_config_group_get() to be compliant Date: Mon, 24 Sep 2018 13:53:37 +0200 Message-Id: <20180924113125.942993670@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180924113103.999624566@linuxfoundation.org> References: <20180924113103.999624566@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Douglas Anderson [ Upstream commit 05e0c828955c1cab58dd71a04539442e5375d917 ] If you do this on an sdm845 board: cat /sys/kernel/debug/pinctrl/3400000.pinctrl/pinconf-groups ...it looks like nonsense. For every pin you see listed: input bias bus hold, input bias disabled, input bias pull down, input bias pull up That's because msm_config_group_get() isn't complying with the rules that pinconf_generic_dump_one() expects. Specifically for boolean parameters (anything with a "struct pin_config_item" where has_arg is false) the function expects that the function should return its value not through the "config" parameter but should return "0" if the value is set and "-EINVAL" if the value isn't set. Let's fix this. >From a quick sample of other pinctrl drivers, it appears to be tradition to also return 1 through the config parameter for these boolean parameters when they exist. I'm not one to knock tradition, so I'll follow tradition and return 1 in these cases. While I'm at it, I'll also continue searching for four leaf clovers, kocking on wood three times, and trying not to break mirrors. Fixes: f365be092572 ("pinctrl: Add Qualcomm TLMM driver") Signed-off-by: Douglas Anderson Signed-off-by: Linus Walleij Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/pinctrl/qcom/pinctrl-msm.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) --- a/drivers/pinctrl/qcom/pinctrl-msm.c +++ b/drivers/pinctrl/qcom/pinctrl-msm.c @@ -250,22 +250,30 @@ static int msm_config_group_get(struct p /* Convert register value to pinconf value */ switch (param) { case PIN_CONFIG_BIAS_DISABLE: - arg = arg == MSM_NO_PULL; + if (arg != MSM_NO_PULL) + return -EINVAL; + arg = 1; break; case PIN_CONFIG_BIAS_PULL_DOWN: - arg = arg == MSM_PULL_DOWN; + if (arg != MSM_PULL_DOWN) + return -EINVAL; + arg = 1; break; case PIN_CONFIG_BIAS_BUS_HOLD: if (pctrl->soc->pull_no_keeper) return -ENOTSUPP; - arg = arg == MSM_KEEPER; + if (arg != MSM_KEEPER) + return -EINVAL; + arg = 1; break; case PIN_CONFIG_BIAS_PULL_UP: if (pctrl->soc->pull_no_keeper) arg = arg == MSM_PULL_UP_NO_KEEPER; else arg = arg == MSM_PULL_UP; + if (!arg) + return -EINVAL; break; case PIN_CONFIG_DRIVE_STRENGTH: arg = msm_regval_to_drive(arg);