Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp174385imd; Wed, 31 Oct 2018 16:49:13 -0700 (PDT) X-Google-Smtp-Source: AJdET5dIHheGpKZqTwgH+74mlXUCghoZ4jgyEbx6sEWRVieson+fW8klU3sYyQfIitnU8gQEczE1 X-Received: by 2002:a63:2109:: with SMTP id h9mr5018153pgh.277.1541029753584; Wed, 31 Oct 2018 16:49:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541029753; cv=none; d=google.com; s=arc-20160816; b=S4fkP2e/+l/5V/pr2Qn+Cp/tu2nOX3DvyIVDLWzL7LW+SplYqCR33dHew0xc/56IqA 0Lb92vxI/ZIG4SS/IL4gEQNxqmTrz694JYsVnBTWTOqx/4Fmf9RydTpeqeqkcGZzQAZT hapTdJu6VuaoFyk96oPFd19F3reJogJJU8smTgIu+VihbRd9Hb+cNJV+JuDRjpxhLmFL dW9hiaBen4PAE3YRlCY4Hc5d9oJZeRDTd60bNQmprtEFKlzDUFx4iiZiHFfJaAFsAOlQ /aixCoPx6+21PvieHEpr8CPQ4BbyUEVHw/bzCFWNeFYWI9bXZ/QjUM+wMJ2wQF9DNX4G 5Gcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=doXh85FlemOB3PRDlyGmgo6wPbTlQwgSPo9JESZdh8E=; b=P6lz6IeugLko5+Hso/QCsGjAjQtof5VdSkZZiRrqz1E5V+4pPploj9/q73tX9OzRLw sxj/dvq+tSWwznWbM4ipCRd370yMUC2IYyiw9gwkTSNewYedsm090xineSnEUyIiEXsX eLFz2g76yGfuPBJ9o/Yyyg2Rt5OZNijfxuB1p5bm4ahXHrswJUBz59zDxF2PRBAKEvmz MYMtSvcLJs/0DiJRZEVUUrmcg4cFOHfHijzFxRMYD28vuLDlf9iEp5w3BX5ZrLafj8gC YngG5Yz+lefh6taW3QUWOjlLKt0mpHF+y1akD2r96dhKyC2nfDXcpArVXAAYAeO3E9qD /ZXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="KE0/Hfdf"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q82-v6si13739369pfk.266.2018.10.31.16.48.58; Wed, 31 Oct 2018 16:49:13 -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; dkim=pass header.i=@kernel.org header.s=default header.b="KE0/Hfdf"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728713AbeKAIsw (ORCPT + 99 others); Thu, 1 Nov 2018 04:48:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:54244 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728436AbeKAIGz (ORCPT ); Thu, 1 Nov 2018 04:06:55 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8960120823; Wed, 31 Oct 2018 23:06:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541027205; bh=bpwEIpuDJAR+VO4q+16AnizZZU0OE1U7XBaW6GcsE0k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KE0/HfdfRDx2N79vkB4cRvkN+LftwaVIU6QWGJNI8nRXEI/bf+DFXL/Y0ZFDWN/5D mpZXQgOdZHQULp59eWKQis0eadbSTSgTLO8U0aEhakAKncGIAF26ueEwRtsqCXDMCv h2ASrY2bnAZC6je3nU/usUJaTDgvEQkhIdoHBbp4= From: Sasha Levin To: stable@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Douglas Anderson , Linus Walleij , Sasha Levin Subject: [PATCH AUTOSEL 4.19 068/146] pinctrl: ssbi-gpio: Fix pm8xxx_pin_config_get() to be compliant Date: Wed, 31 Oct 2018 19:04:23 -0400 Message-Id: <20181031230541.28822-68-sashal@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181031230541.28822-1-sashal@kernel.org> References: <20181031230541.28822-1-sashal@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Douglas Anderson [ Upstream commit b432414b996d32a1bd9afe2bd595bd5729c1477f ] If you look at "pinconf-groups" in debugfs for ssbi-gpio you'll notice it looks like nonsense. The problem is fairly well described in commit 1cf86bc21257 ("pinctrl: qcom: spmi-gpio: Fix pmic_gpio_config_get() to be compliant") and commit 05e0c828955c ("pinctrl: msm: Fix msm_config_group_get() to be compliant"), but it was pointed out that ssbi-gpio has the same problem. Let's fix it there too. Fixes: b4c45fe974bc ("pinctrl: qcom: ssbi: Family A gpio & mpp drivers") Signed-off-by: Douglas Anderson Reviewed-by: Stephen Boyd Reviewed-by: Bjorn Andersson Signed-off-by: Linus Walleij Signed-off-by: Sasha Levin --- drivers/pinctrl/qcom/pinctrl-ssbi-gpio.c | 28 ++++++++++++++++++------ 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/drivers/pinctrl/qcom/pinctrl-ssbi-gpio.c b/drivers/pinctrl/qcom/pinctrl-ssbi-gpio.c index f53e32a9d8fc..0e153bae322e 100644 --- a/drivers/pinctrl/qcom/pinctrl-ssbi-gpio.c +++ b/drivers/pinctrl/qcom/pinctrl-ssbi-gpio.c @@ -260,22 +260,32 @@ static int pm8xxx_pin_config_get(struct pinctrl_dev *pctldev, switch (param) { case PIN_CONFIG_BIAS_DISABLE: - arg = pin->bias == PM8XXX_GPIO_BIAS_NP; + if (pin->bias != PM8XXX_GPIO_BIAS_NP) + return -EINVAL; + arg = 1; break; case PIN_CONFIG_BIAS_PULL_DOWN: - arg = pin->bias == PM8XXX_GPIO_BIAS_PD; + if (pin->bias != PM8XXX_GPIO_BIAS_PD) + return -EINVAL; + arg = 1; break; case PIN_CONFIG_BIAS_PULL_UP: - arg = pin->bias <= PM8XXX_GPIO_BIAS_PU_1P5_30; + if (pin->bias > PM8XXX_GPIO_BIAS_PU_1P5_30) + return -EINVAL; + arg = 1; break; case PM8XXX_QCOM_PULL_UP_STRENGTH: arg = pin->pull_up_strength; break; case PIN_CONFIG_BIAS_HIGH_IMPEDANCE: - arg = pin->disable; + if (!pin->disable) + return -EINVAL; + arg = 1; break; case PIN_CONFIG_INPUT_ENABLE: - arg = pin->mode == PM8XXX_GPIO_MODE_INPUT; + if (pin->mode != PM8XXX_GPIO_MODE_INPUT) + return -EINVAL; + arg = 1; break; case PIN_CONFIG_OUTPUT: if (pin->mode & PM8XXX_GPIO_MODE_OUTPUT) @@ -290,10 +300,14 @@ static int pm8xxx_pin_config_get(struct pinctrl_dev *pctldev, arg = pin->output_strength; break; case PIN_CONFIG_DRIVE_PUSH_PULL: - arg = !pin->open_drain; + if (pin->open_drain) + return -EINVAL; + arg = 1; break; case PIN_CONFIG_DRIVE_OPEN_DRAIN: - arg = pin->open_drain; + if (!pin->open_drain) + return -EINVAL; + arg = 1; break; default: return -EINVAL; -- 2.17.1