net: dsa: allow deferred probing
authorFlorian Fainelli <f.fainelli@gmail.com>
Thu, 5 Mar 2015 20:35:05 +0000 (12:35 -0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 6 Mar 2015 05:18:20 +0000 (00:18 -0500)
In preparation for allowing a different model to register DSA switches,
update dsa_of_probe() and dsa_probe() to return -EPROBE_DEFER where
appropriate.

Failure to find a phandle or Device Tree property is still fatal, but
looking up the internal device structure associated with a Device Tree
node is something that might need to be delayed based on driver probe
ordering.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/dsa/dsa.c

index d804364150bd9892a17997c64e937b15345e098e..79879d01488afea8640ea8739d02915d9ca9a1bc 100644 (file)
@@ -583,7 +583,7 @@ static int dsa_of_probe(struct device *dev)
 
        mdio_bus = of_mdio_find_bus(mdio);
        if (!mdio_bus)
-               return -EINVAL;
+               return -EPROBE_DEFER;
 
        ethernet = of_parse_phandle(np, "dsa,ethernet", 0);
        if (!ethernet)
@@ -591,7 +591,7 @@ static int dsa_of_probe(struct device *dev)
 
        ethernet_dev = of_find_device_by_node(ethernet);
        if (!ethernet_dev)
-               return -ENODEV;
+               return -EPROBE_DEFER;
 
        pd = kzalloc(sizeof(*pd), GFP_KERNEL);
        if (!pd)
@@ -718,7 +718,7 @@ static int dsa_probe(struct platform_device *pdev)
 
        dev = dev_to_net_device(pd->netdev);
        if (dev == NULL) {
-               ret = -EINVAL;
+               ret = -EPROBE_DEFER;
                goto out;
        }