Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3433976imu; Sun, 11 Nov 2018 15:01:43 -0800 (PST) X-Google-Smtp-Source: AJdET5cAFQNACoX4WpfqlpjvFIcB3g9Nc+yuCHUl7knb1QKudsbr3hXOBED1/H0hv7PO6dFLa2nt X-Received: by 2002:a62:cdc1:: with SMTP id o184-v6mr18455945pfg.181.1541977303422; Sun, 11 Nov 2018 15:01:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541977303; cv=none; d=google.com; s=arc-20160816; b=qQ/Nqp1KgBA2e0ZM7ZfYembKEI58aj1xwGl0gzunoOOq07Gnjtx0gw/63pUGZcLMGb JD+LGVAP8I7f2ZPt6fFI3f35ldqy7FL6cMXlKWeZT+uqvZ0aB+409e/fS0Hyhb1W1Z3C t4WWJIHB0qdblL0MmKCAO1Cm4KRXnFTP0DV4G+mmsH+QsE2zhkdSoSraBHQqdWECp3Ke PAHwCNgxgeBKHepiaMANUvkWuGmAMkA6sWeaA1nXXYUBHt5eWO5/je2hnQLdqVCNY+Mi h+7z5McchoYUI9VMk7K3AZ9GrajewhHLnulXWdDc5GPrIlfJW6Wd2VRcgE2nZdUh/Zhn g6bg== 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=d0iHNdJ6S7Vikbn3yxFIwAPmQArjml3+t3sCWHDE+FU=; b=a50ia52PdIX1uI/YXjMPmDMg1cEd6+o+RsY0lJNE1AWh06TXqhlUwc0+E5OyR7gz5i iD6QMleTr6qSlYLqAXxP08DufKFBu6etEarlH7Fplfb24d4uhGZSxCoCAWBV2IgtmvHQ hDD1FGIe722Wg/deizJBS3kmz0khQq6RIRhur+yoMxp0bIkrLWhzMQnhJRqA1s2raEUt Wt5N/BK38hSM9E9tmR46VPbOECOnejPehJthIIvHsfufWOOIsXgLHQlqpT6ieI+hRdXA DSnNSd9+TCrWWEXzGNfGvAz+PRZuWLSin3atwgrG5fLiWogr+9JTZQGFKUlZvPI2gYZr XfoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=HHzLZMRt; 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 l185si14052047pgd.253.2018.11.11.15.01.28; Sun, 11 Nov 2018 15:01:43 -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=HHzLZMRt; 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 S2390818AbeKLIvP (ORCPT + 99 others); Mon, 12 Nov 2018 03:51:15 -0500 Received: from mail.kernel.org ([198.145.29.99]:51248 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390690AbeKLIWc (ORCPT ); Mon, 12 Nov 2018 03:22:32 -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 003D822443; Sun, 11 Nov 2018 22:32:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541975555; bh=QdEHpqWdNLv4O2e7iWhxdrseszvCW9hdLH0wk6h6MTA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HHzLZMRtuGnpzyA8zVFkPFhjgB3WxAeYnhNMvcwkBDgp6sTOwgYM6FPvgsyAasKu8 2CHqkldNLyZpSA82ZTMsuQVri/g4C27tH+zY1hQyH5yvZKdHdGBbrM8SoUWNS0rI0Y 5SmtcyWQ9BPEumTcGJ3ECocMV/FQ7Z/jsvMUlKXI= 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.14 070/222] pinctrl: ssbi-gpio: Fix pm8xxx_pin_config_get() to be compliant Date: Sun, 11 Nov 2018 14:22:47 -0800 Message-Id: <20181111221654.343988265@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181111221647.665769131@linuxfoundation.org> References: <20181111221647.665769131@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 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;