PCI: keystone: Defer probing if devm_phy_get() returns -EPROBE_DEFER
authorShawn Lin <shawn.lin@rock-chips.com>
Mon, 7 Mar 2016 04:32:21 +0000 (12:32 +0800)
committerBjorn Helgaas <bhelgaas@google.com>
Fri, 11 Mar 2016 18:21:47 +0000 (12:21 -0600)
A SerDes PHY is optional, so if devm_phy_get() doesn't find one at all,
that's fine.  But if devm_phy_get() finds a PHY that doesn't have a driver
yet, it returns -EPROBE_DEFER.  In that case, defer probing the Keystone
driver.  We may be able to load it later after a PHY driver is loaded.

[bhelgaas: changelog, check for -EPROBE_DEFER first]
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
drivers/pci/host/pci-keystone.c

index 0aa81bd3de12d8eca876851e6f019a87f9b88f64..cd7034523f529eacf6737a244e86469482d0fe79 100644 (file)
@@ -359,6 +359,9 @@ static int __init ks_pcie_probe(struct platform_device *pdev)
 
        /* initialize SerDes Phy if present */
        phy = devm_phy_get(dev, "pcie-phy");
+       if (PTR_ERR_OR_ZERO(phy) == -EPROBE_DEFER)
+               return PTR_ERR(phy);
+
        if (!IS_ERR_OR_NULL(phy)) {
                ret = phy_init(phy);
                if (ret < 0)