Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2495332imm; Mon, 24 Sep 2018 05:27:37 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbJ+t6Xm2QbIr6h0aXQ5ODhLxa4QN0EtrweFATv9EGJwMC36Do52nR2yF8/I1nDjO9SruFR X-Received: by 2002:a62:d206:: with SMTP id c6-v6mr2310414pfg.8.1537792057015; Mon, 24 Sep 2018 05:27:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537792056; cv=none; d=google.com; s=arc-20160816; b=pXFIo/zBHTpYWoitWmGV0wQHWm1v+jeW4LIYKof2ImlZibbtAryFqGw40xJ8imp3BS VVH/ZIN25ws8Tads2DJ73MYscFAeqFSN2+sNzBNGNNWxVp4vSuq+HTTZIRAeWI45iOIQ aezju3cEcbApq2i0/oIhGJh6YL4aeJrlZi/Php1Oel4mBBDehHccu5pq3WXDVZdO4pvE mx0wgEFl+fGOxuovtVpeod0P1AKIuktWzXeJfuv7H9h7S1QFHoki6mHAx23gtG4/bDcL PpBz1po3i7ygFXoa5ms4BGexxVnF8Tfk9PwrZnSA3LlUv/WnmzyRm2CFhf9IAaE3hIlc 6D+Q== 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=Mp4xcQKglASBYimRbMqAXSCWDUM/SzaHzYZ/B0B82u0=; b=x9zu/O77gFFG745bQx19W5a+KSja3MtDHE8Dejeuuhj+bTVUBDzvOhJxeVWnpG1ufu OGOzWQiPo30couc4Dym2kA759XwAsPas8dG+at+H7B1AaZxRNj2YyS5qtVf0r/1lktDo O4lj/0iNElXFNC4tTsM1fqoCfnf8CKxDGnN1aEZEjowVU1tQ6yUww7Wp3D0LMv3Q3LnZ 2sbiim+W003rRYWAGbUCODDhJ8HHa3mn0dAFt63US/2fAvqe8JM2CLjPAn+RBW6gynnZ nys9aTDd4LvoBAk1cNqqE1HZUDSwNszHuKvf4jlukeVKWe6/e31kdOpJ6zxGcCktdOaX G67w== 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 w24-v6si2578468pgi.313.2018.09.24.05.27.21; Mon, 24 Sep 2018 05:27:36 -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 S1732890AbeIXS06 (ORCPT + 99 others); Mon, 24 Sep 2018 14:26:58 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:56914 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732326AbeIXS06 (ORCPT ); Mon, 24 Sep 2018 14:26:58 -0400 Received: from localhost (ip-213-127-77-73.ip.prioritytelecom.net [213.127.77.73]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 27A3F1098; Mon, 24 Sep 2018 12:25:03 +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.14 157/173] pinctrl: msm: Fix msm_config_group_get() to be compliant Date: Mon, 24 Sep 2018 13:53:11 +0200 Message-Id: <20180924113126.789565814@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180924113114.334025954@linuxfoundation.org> References: <20180924113114.334025954@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.14-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 @@ -238,22 +238,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);