diff options
Diffstat (limited to 'net/dsa/dsa.c')
-rw-r--r-- | net/dsa/dsa.c | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c index d8fb47fca..c28c47463 100644 --- a/net/dsa/dsa.c +++ b/net/dsa/dsa.c @@ -430,35 +430,30 @@ static void dsa_switch_destroy(struct dsa_switch *ds) hwmon_device_unregister(ds->hwmon_dev); #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 (!(dsa_is_cpu_port(ds, port) || dsa_is_dsa_port(ds, 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++) { port_dn = cd->port_dn[port]; if (of_phy_is_fixed_link(port_dn)) { phydev = of_phy_find_device(port_dn); if (phydev) { - int addr = phydev->mdio.addr; - phy_device_free(phydev); of_node_put(port_dn); - fixed_phy_del(addr); + fixed_phy_unregister(phydev); } } } - /* 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); } |