Skip to content

Commit ecc3e42

Browse files
beanhuoLorenzo Pieralisi
authored andcommitted
PCI: kirin: Return -EPROBE_DEFER in case the gpio isn't ready
PCI host bridge driver can be probed before the gpiochip it requires, so, of_get_named_gpio() can return -EPROBE_DEFER. Current code lets the kirin_pcie_probe() directly return -ENODEV, which results in the PCI host controller driver probe failure; with this error code the PCI host controller driver will not be probed again when the gpiochip driver is loaded. Fix the above issue by letting kirin_pcie_probe() return -EPROBE_DEFER in such a case. Link: https://lore.kernel.org/r/20200918123800.19983-1-huobean@gmail.com Signed-off-by: Bean Huo <beanhuo@micron.com> [lorenzo.pieralisi@arm.com: commit log] Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
1 parent 9123e3a commit ecc3e42

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

‎drivers/pci/controller/dwc/pcie-kirin.c‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,8 +507,12 @@ static int kirin_pcie_probe(struct platform_device *pdev)
507507

508508
kirin_pcie->gpio_id_reset = of_get_named_gpio(dev->of_node,
509509
"reset-gpios", 0);
510-
if (kirin_pcie->gpio_id_reset < 0)
510+
if (kirin_pcie->gpio_id_reset == -EPROBE_DEFER) {
511+
return -EPROBE_DEFER;
512+
} else if (!gpio_is_valid(kirin_pcie->gpio_id_reset)) {
513+
dev_err(dev, "unable to get a valid gpio pin\n");
511514
return -ENODEV;
515+
}
512516

513517
ret = kirin_pcie_power_on(kirin_pcie);
514518
if (ret)

0 commit comments

Comments
 (0)