PCI: kirin: Return -EPROBE_DEFER in case the gpio isn't ready
PATCH 1/1 PCI: kirin: Return -EPROBE_DEFER in case the gpio isn't ready
From: Bean Huo <[email protected]>
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.
--- drivers/pci/controller/dwc/pcie-kirin.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/pci/controller/dwc/pcie-kirin.c +5 -1
@@ -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)
Signature · 1 line
2.17.1
Quoted 11 lines · Bean Huo
From: Bean Huo <[email protected]>
PCI driver might be probed before the gpiochip, so,
of_get_named_gpio()can return -EPROBE_DEFER. And letkirin_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
Quoted 26 lines
Signed-off-by Bean Huo <[email protected]>--- drivers/pci/controller/dwc/pcie-kirin.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)drivers/pci/controller/dwc/pcie-kirin.c +5
-1@@ -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)Signature · 1 line
2.17.1
Quoted 11 lines · Lorenzo Pieralisi
Quoted 6 lines
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
Hi Lorenzo
Thanks very much for your reply. It is true this is a bug which was introduced by the origin commit. It is ok for me to remove this fix tag.
Thanks,
Bean
seems the Hisilicon PCI driver maintainers are absent, however, we are still using their old platform based on Kirin.
hi, Lorenzo
is it possible to take this patch without Hisilicon maintainter's ACK?
Thanks,
Bean
Lorenzo Pieralisi
AppliedQuoted 5 lines · Bean Huo
seems the Hisilicon PCI driver maintainers are absent, however, we are still using their old platform based on Kirin.
hi, Lorenzo
is it possible to take this patch without Hisilicon maintainter's ACK?
I applied it to pci/kirin, tentatively for v5.10.
Lorenzo
Quoted 3 lines
Thanks,
Bean