Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3486133imu; Sun, 11 Nov 2018 16:11:08 -0800 (PST) X-Google-Smtp-Source: AJdET5c+MgY9hYwwTz81rv91Jl3U+F3kpy/pxBMySJl5AhZtsO512Q4ea91PRxnt7StugNbcbuaB X-Received: by 2002:a17:902:20eb:: with SMTP id v40-v6mr8345429plg.234.1541981468429; Sun, 11 Nov 2018 16:11:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541981468; cv=none; d=google.com; s=arc-20160816; b=d3TEyuTDhwzA2cbLNZxvpWkxBCzMuPa6OlZhfNmdDxqPolFtMkuzcLO2Yci7zYJf+K AGibLiSqm/H5GS2tRbuHhWukAgMkd1MKiFGqSvFxS6L2gW1RR+Xr2I51Leb4QL3o41i1 /j9w22W5r5EEk1ZqEg8WZIzgWriO40rUM+HteGFRWUpjHT8UKGcL8VIwDNMNxAc5NRIp twTNaWEUoWEymulL8G9/xNT0D0shfd4JqzE6toUg5rbW/aqRmnPBgnRBszfQ0J0z6eaW fuhER15ihbjnaOWE/x9UzY+d0ieZYeiyBeYK0rEb96oBpVEziir4j3TSwUS0ZSk7dkvI Q4XA== 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:dkim-signature; bh=+3Wc4ot5/aacrXNo9ETdabvFjlseGrGzWoFsiS2O0sk=; b=DIeaWeY1urCvJfrVdH1rUgCW+KalRIF1MduQn5Dual8XYlKRMn4qCSnELDR1KVm9Dd CUnSQ3p1k6O9vUikfmOCPzgYsCYDTERNbJTXQoUZqTVX7RqZdJXxQ19ZuVa1oVT0/xCo zsXYp7mK0xnuS9Qebq7RY1Z0hV8buPVKFIMxE33YuQg/oXtoI7tZ8hIrPmtFXlKqcXhP kD+Jv3EqAjvHqbALZ7psNk54yoMF6QCYdV8KC/dxO5Ey4GOtGAoCtkNFcdt3Yhzw9tG0 6kjiGOcMnTqPAiSY4mKdvvzcg9Z0UG2npAQxhpDvrv0pKu3m7shEEsh7V5y8uzaD4XKV q+FA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=pSOK5h0L; 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 12-v6si4736113plb.324.2018.11.11.16.10.53; Sun, 11 Nov 2018 16:11:08 -0800 (PST) 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=pSOK5h0L; 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 S1731622AbeKLKAz (ORCPT + 99 others); Mon, 12 Nov 2018 05:00:55 -0500 Received: from mail.kernel.org ([198.145.29.99]:60706 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730696AbeKLIR0 (ORCPT ); Mon, 12 Nov 2018 03:17:26 -0500 Received: from localhost (unknown [206.108.79.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 23440214DB; Sun, 11 Nov 2018 22:27:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541975250; bh=LVTJGNhh3gcRh5yCZG6FkzkgNWSNasVvSQDnUjJoJAU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pSOK5h0LkF6CtrTF/kO+p1c+LuzWg+uiigVfdLTw1QEB2kK8QRIReliejRzlU3p7C EBPA8teH0p5/ONADKxkAg0tELmi2zEuJq9YBxvY+2dNEeKiLXz/zlYqEtEAO42XtvO jMBTcF7G7sqbVAU8Z/Q3SCr4yCL+w+0ErS39/zcc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Douglas Anderson , Stephen Boyd , Bjorn Andersson , Linus Walleij , Sasha Levin Subject: [PATCH 4.19 113/361] pinctrl: ssbi-gpio: Fix pm8xxx_pin_config_get() to be compliant Date: Sun, 11 Nov 2018 14:17:40 -0800 Message-Id: <20181111221635.671740227@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181111221619.915519183@linuxfoundation.org> References: <20181111221619.915519183@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.19-stable review patch. If anyone has any objections, please let me know. ------------------ 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 Signed-off-by: Greg Kroah-Hartman --- drivers/pinctrl/qcom/pinctrl-ssbi-gpio.c | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) --- 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 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 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;