Commit 3a44514f authored by Andrew Lunn's avatar Andrew Lunn Committed by David S. Miller

dsa: Destroy fixed link phys after the phy has been disconnected

The phy is disconnected from the slave in dsa_slave_destroy(). Don't
destroy fixed link phys until after this, since there can be fixed
linked phys connected to ports.
Signed-off-by: default avatarAndrew Lunn <andrew@lunn.ch>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b71be352
...@@ -430,7 +430,18 @@ static void dsa_switch_destroy(struct dsa_switch *ds) ...@@ -430,7 +430,18 @@ static void dsa_switch_destroy(struct dsa_switch *ds)
hwmon_device_unregister(ds->hwmon_dev); hwmon_device_unregister(ds->hwmon_dev);
#endif #endif
/* Disable configuration of the CPU and DSA ports */ /* Destroy network devices for physical switch ports. */
for (port = 0; port < DSA_MAX_PORTS; port++) {
if (!(ds->phys_port_mask & (1 << port)))
continue;
if (!ds->ports[port])
continue;
dsa_slave_destroy(ds->ports[port]);
}
/* Remove any fixed link PHYs */
for (port = 0; port < DSA_MAX_PORTS; port++) { for (port = 0; port < DSA_MAX_PORTS; port++) {
if (!(dsa_is_cpu_port(ds, port) || dsa_is_dsa_port(ds, port))) if (!(dsa_is_cpu_port(ds, port) || dsa_is_dsa_port(ds, port)))
continue; continue;
...@@ -448,17 +459,6 @@ static void dsa_switch_destroy(struct dsa_switch *ds) ...@@ -448,17 +459,6 @@ static void dsa_switch_destroy(struct dsa_switch *ds)
} }
} }
/* Destroy network devices for physical switch ports. */
for (port = 0; port < DSA_MAX_PORTS; port++) {
if (!(ds->phys_port_mask & (1 << port)))
continue;
if (!ds->ports[port])
continue;
dsa_slave_destroy(ds->ports[port]);
}
mdiobus_unregister(ds->slave_mii_bus); mdiobus_unregister(ds->slave_mii_bus);
} }
......
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