Skip to content

Commit

Permalink
dsa: Register netdev before phy
Browse files Browse the repository at this point in the history
When the phy is connected, an info message is printed. If the netdev
it is attached to has not been registered yet, the name
'uninitialised' in the output. By registering the netdev first, then
connecting they phy, we can avoid this.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Andrew Lunn authored and David S. Miller committed Jan 7, 2016
1 parent 5cf11be commit 0071f56
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions net/dsa/slave.c
Original file line number Diff line number Diff line change
Expand Up @@ -1189,13 +1189,6 @@ int dsa_slave_create(struct dsa_switch *ds, struct device *parent,
p->old_link = -1;
p->old_duplex = -1;

ret = dsa_slave_phy_setup(p, slave_dev);
if (ret) {
netdev_err(master, "error %d setting up slave phy\n", ret);
free_netdev(slave_dev);
return ret;
}

ds->ports[port] = slave_dev;
ret = register_netdev(slave_dev);
if (ret) {
Expand All @@ -1209,6 +1202,13 @@ int dsa_slave_create(struct dsa_switch *ds, struct device *parent,

netif_carrier_off(slave_dev);

ret = dsa_slave_phy_setup(p, slave_dev);
if (ret) {
netdev_err(master, "error %d setting up slave phy\n", ret);
free_netdev(slave_dev);
return ret;
}

return 0;
}

Expand Down

0 comments on commit 0071f56

Please sign in to comment.