aboutsummaryrefslogtreecommitdiffstats
path: root/net/dsa/slave.c
diff options
context:
space:
mode:
authorAndrew Lunn <andrew@lunn.ch>2016-01-06 20:11:20 +0100
committerDavid S. Miller <davem@davemloft.net>2016-01-07 14:31:26 -0500
commit0071f56e46dadb88dc3ad1f8d9cf9c3ae014735d (patch)
tree2cd405f123e3b39a85e50d015676c48d316a447e /net/dsa/slave.c
parentphy_device: Move phy attributes into phy_device (diff)
downloadlinux-dev-0071f56e46dadb88dc3ad1f8d9cf9c3ae014735d.tar.xz
linux-dev-0071f56e46dadb88dc3ad1f8d9cf9c3ae014735d.zip
dsa: Register netdev before phy
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>
Diffstat (limited to 'net/dsa/slave.c')
-rw-r--r--net/dsa/slave.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index 2771713714f1..40b9ca72aae3 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -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) {
@@ -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;
}