Commit b324c07a authored by Florian Fainelli's avatar Florian Fainelli Committed by David S. Miller

net: dsa: allow deferred probing

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: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f1a26a06
...@@ -583,7 +583,7 @@ static int dsa_of_probe(struct device *dev) ...@@ -583,7 +583,7 @@ static int dsa_of_probe(struct device *dev)
mdio_bus = of_mdio_find_bus(mdio); mdio_bus = of_mdio_find_bus(mdio);
if (!mdio_bus) if (!mdio_bus)
return -EINVAL; return -EPROBE_DEFER;
ethernet = of_parse_phandle(np, "dsa,ethernet", 0); ethernet = of_parse_phandle(np, "dsa,ethernet", 0);
if (!ethernet) if (!ethernet)
...@@ -591,7 +591,7 @@ static int dsa_of_probe(struct device *dev) ...@@ -591,7 +591,7 @@ static int dsa_of_probe(struct device *dev)
ethernet_dev = of_find_device_by_node(ethernet); ethernet_dev = of_find_device_by_node(ethernet);
if (!ethernet_dev) if (!ethernet_dev)
return -ENODEV; return -EPROBE_DEFER;
pd = kzalloc(sizeof(*pd), GFP_KERNEL); pd = kzalloc(sizeof(*pd), GFP_KERNEL);
if (!pd) if (!pd)
...@@ -718,7 +718,7 @@ static int dsa_probe(struct platform_device *pdev) ...@@ -718,7 +718,7 @@ static int dsa_probe(struct platform_device *pdev)
dev = dev_to_net_device(pd->netdev); dev = dev_to_net_device(pd->netdev);
if (dev == NULL) { if (dev == NULL) {
ret = -EINVAL; ret = -EPROBE_DEFER;
goto out; goto out;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment