From: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
To: Bean Huo <huobean@gmail.com>
Cc: songxiaowei@hisilicon.com, wangbinghui@hisilicon.com,
bhelgaas@google.com, linux-pci@vger.kernel.org,
linux-kernel@vger.kernel.org, beanhuo@micron.com
Subject: Re: [PATCH] PCI: kirin: Return -EPROBE_DEFER in case the gpio isn't ready
Date: Mon, 21 Sep 2020 12:22:09 +0100 [thread overview]
Message-ID: <20200921112209.GA2220@e121166-lin.cambridge.arm.com> (raw)
In-Reply-To: <20200918123800.19983-1-huobean@gmail.com>
On Fri, Sep 18, 2020 at 02:38:00PM +0200, Bean Huo wrote:
> From: Bean Huo <beanhuo@micron.com>
>
> PCI driver might be probed before the gpiochip, so, of_get_named_gpio()
> can return -EPROBE_DEFER. And let kirin_pcie_probe() directly return
> -ENODEV, which will result in the PCIe probe failure and the PCIe
> will not be probed again after the gpiochip driver is loaded.
>
> Fix the above issue by letting kirin_pcie_probe() return -EPROBE_DEFER in
> such a case.
>
> Fixes: 6e0832fa432e ("PCI: Collect all native drivers under drivers/pci/controller")
This is certainly not the commit that triggered the issue so I would
remove it. Kirin maintainers are CC'ed, waiting for their ACK.
Lorenzo
> Signed-off-by: Bean Huo <beanhuo@micron.com>
> ---
> drivers/pci/controller/dwc/pcie-kirin.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/pci/controller/dwc/pcie-kirin.c b/drivers/pci/controller/dwc/pcie-kirin.c
> index e496f51e0152..74b88d158072 100644
> --- a/drivers/pci/controller/dwc/pcie-kirin.c
> +++ b/drivers/pci/controller/dwc/pcie-kirin.c
> @@ -507,8 +507,12 @@ static int kirin_pcie_probe(struct platform_device *pdev)
>
> kirin_pcie->gpio_id_reset = of_get_named_gpio(dev->of_node,
> "reset-gpios", 0);
> - if (kirin_pcie->gpio_id_reset < 0)
> + if (kirin_pcie->gpio_id_reset == -EPROBE_DEFER) {
> + return -EPROBE_DEFER;
> + } else if (!gpio_is_valid(kirin_pcie->gpio_id_reset)) {
> + dev_err(dev, "unable to get a valid gpio pin\n");
> return -ENODEV;
> + }
>
> ret = kirin_pcie_power_on(kirin_pcie);
> if (ret)
> --
> 2.17.1
>
next prev parent reply other threads:[~2020-09-21 11:22 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-18 12:38 [PATCH] PCI: kirin: Return -EPROBE_DEFER in case the gpio isn't ready Bean Huo
2020-09-21 11:22 ` Lorenzo Pieralisi [this message]
2020-09-21 11:28 ` Bean Huo
2020-09-26 7:49 ` Bean Huo
2020-09-28 17:05 ` Lorenzo Pieralisi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200921112209.GA2220@e121166-lin.cambridge.arm.com \
--to=lorenzo.pieralisi@arm.com \
--cc=beanhuo@micron.com \
--cc=bhelgaas@google.com \
--cc=huobean@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=songxiaowei@hisilicon.com \
--cc=wangbinghui@hisilicon.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).