Skip to content

Commit

Permalink
net: dsa: allow deferred probing
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Florian Fainelli authored and David S. Miller committed Mar 6, 2015
1 parent f1a26a0 commit b324c07
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions net/dsa/dsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -583,15 +583,15 @@ 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)
return -EINVAL;

ethernet_dev = of_find_device_by_node(ethernet);
if (!ethernet_dev)
return -ENODEV;
return -EPROBE_DEFER;

pd = kzalloc(sizeof(*pd), GFP_KERNEL);
if (!pd)
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit b324c07

Please sign in to comment.