Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp813440ybl; Wed, 11 Dec 2019 07:55:13 -0800 (PST) X-Google-Smtp-Source: APXvYqzgriDoEh4Nq47c16OX7/gYyS2fu6uIYVC/IW1iiiVfMw0DibW6/E/7IBshVMsSz/jcEQmt X-Received: by 2002:aca:d544:: with SMTP id m65mr3375917oig.177.1576079713279; Wed, 11 Dec 2019 07:55:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576079713; cv=none; d=google.com; s=arc-20160816; b=k1Ifypjnwkm9iUF6p//2nYy/PGaTD/hYe3dTgERY337bHuJcAOY/9meYYA2plp8UKs zCQiSE58HYY6w0lCorVFru8fAN6nyW6nvRUQNowIEiFV7zaKJxFBAzAWKASQUD9Gb4RA aO4x4Z+HvZAPw/j/n7cC49FJ68CAIYnLlEeby/UD6paK9+2ljlJ3Rk7Gnzug+gFVNHJ9 NLyKdCobixJCsXW37TAlQt2YlFMqSDBlbrIeiFBlOevbgCFsiTjbo5qcu9XXrOJ4IcH/ sSRQiJ5ljblQls/l4IktGaBbZrXUJzJm/10LgQW25MCZiP8Ssb6p7UJ/eo1P9nkavuMj h/hw== 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=mL38A0X3OmiqFxtBeNn0XU44R465eeRriyDzzMwTNBE=; b=d31lXPITy768nmmnvkEQ3oG3iR8M2c5E7yuMHYggpsVYAciizcoldhhCAPp5gNql8t kTEJAoX4HCfXyX9vl9luKgRtkKHwzVtLQQEEE+ikElr6yOzE48dCUxVxApbU7o8azR+D 4xAmBRX5KoqGnk5fBzhK3nwQV7f716A3yLyeJb7MVEh6QA6O/nOTrIPqn0/JzBINAQq3 oyHw68wb3UFrK3o2dmaVuotNEFu02VBWpGHeN9w1mbi/pwgKePS6QaaxSCu8UzRwfig+ 1JXnxOnkkEDs1xZcT/MY8OxH8W7t7cfCXNLO2USRaoj73NjNaa6xKKQl3eGp5SMn4qbO 8Ang== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=bIIoOSaV; 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 e6si1219767otq.217.2019.12.11.07.55.00; Wed, 11 Dec 2019 07:55:13 -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=bIIoOSaV; 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 S1731867AbfLKPSc (ORCPT + 99 others); Wed, 11 Dec 2019 10:18:32 -0500 Received: from mail.kernel.org ([198.145.29.99]:46300 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729513AbfLKPSV (ORCPT ); Wed, 11 Dec 2019 10:18:21 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 1EA7F208C3; Wed, 11 Dec 2019 15:18:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576077500; bh=6+yjYSY49o8+g1oGXaNGGFl0LCIv+8rYNvgXwSC2khc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bIIoOSaVeEBDBSRObpF3xi+eWpqNA0wrUFrLjxf3PganS52n8s8TbBHZPn/dJ/Oe0 /hiVuVw4rmKdbn2DYnclUXj2hiP15o2xDSuE+tC3SQlm4hEYsj7UsWAOZeKZTwv02U kSOf26fVcWuiBRHD598ikFQOLIF4sEa6/fj/Nw7I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Brian Masney , Bjorn Andersson , Linus Walleij , Sasha Levin Subject: [PATCH 4.19 061/243] pinctrl: qcom: ssbi-gpio: fix gpio-hog related boot issues Date: Wed, 11 Dec 2019 16:03:43 +0100 Message-Id: <20191211150343.217792470@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191211150339.185439726@linuxfoundation.org> References: <20191211150339.185439726@linuxfoundation.org> User-Agent: quilt/0.66 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 From: Brian Masney [ Upstream commit 7ed07855773814337b9814f1c3e866df52ebce68 ] When attempting to setup up a gpio hog, device probing will repeatedly fail with -EPROBE_DEFERED errors. It is caused by a circular dependency between the gpio and pinctrl frameworks. If the gpio-ranges property is present in device tree, then the gpio framework will handle the gpio pin registration and eliminate the circular dependency. See Christian Lamparter's commit a86caa9ba5d7 ("pinctrl: msm: fix gpio-hog related boot issues") for a detailed commit message that explains the issue in much more detail. The code comment in this commit came from Christian's commit. I did not test this change against any hardware supported by this particular driver, however I was able to validate this same fix works for pinctrl-spmi-gpio.c using a LG Nexus 5 (hammerhead) phone. Signed-off-by: Brian Masney Reviewed-by: Bjorn Andersson Signed-off-by: Linus Walleij Signed-off-by: Sasha Levin --- drivers/pinctrl/qcom/pinctrl-ssbi-gpio.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/drivers/pinctrl/qcom/pinctrl-ssbi-gpio.c b/drivers/pinctrl/qcom/pinctrl-ssbi-gpio.c index 0e153bae322ee..6bed433e54205 100644 --- a/drivers/pinctrl/qcom/pinctrl-ssbi-gpio.c +++ b/drivers/pinctrl/qcom/pinctrl-ssbi-gpio.c @@ -762,12 +762,23 @@ static int pm8xxx_gpio_probe(struct platform_device *pdev) return ret; } - ret = gpiochip_add_pin_range(&pctrl->chip, - dev_name(pctrl->dev), - 0, 0, pctrl->chip.ngpio); - if (ret) { - dev_err(pctrl->dev, "failed to add pin range\n"); - goto unregister_gpiochip; + /* + * For DeviceTree-supported systems, the gpio core checks the + * pinctrl's device node for the "gpio-ranges" property. + * If it is present, it takes care of adding the pin ranges + * for the driver. In this case the driver can skip ahead. + * + * In order to remain compatible with older, existing DeviceTree + * files which don't set the "gpio-ranges" property or systems that + * utilize ACPI the driver has to call gpiochip_add_pin_range(). + */ + if (!of_property_read_bool(pctrl->dev->of_node, "gpio-ranges")) { + ret = gpiochip_add_pin_range(&pctrl->chip, dev_name(pctrl->dev), + 0, 0, pctrl->chip.ngpio); + if (ret) { + dev_err(pctrl->dev, "failed to add pin range\n"); + goto unregister_gpiochip; + } } platform_set_drvdata(pdev, pctrl); -- 2.20.1