diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2015-05-04 08:16:20 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2015-05-05 13:53:15 +0200 |
commit | c05380f61e1edf4d8eb5b8a60c0d85b451c4fd13 (patch) | |
tree | db3a1ecaf2567ed7f1c72569716c6e21ed6a27be | |
parent | cbc24926213be28321fc129bdb8226d1588a3918 (diff) | |
download | barebox-c05380f61e1edf4d8eb5b8a60c0d85b451c4fd13.tar.gz barebox-c05380f61e1edf4d8eb5b8a60c0d85b451c4fd13.tar.xz |
net: phy: Do not double remove phy device
This fixes: 80264a8 driver: Call bus->remove instead of driver->remove
On mvebu it happens that:
Upon device shutdown, when iterating through the active device list,
the phy0 device is removed before mdio-mvebu. Then, when the mdio bus
device is removed, the phy0 device is removed again, here:
mdio_bus_remove(on mdio-mvebu)
mvebu_mdio_remove
mdiobus_unregister
unregister_device
mdio_bus_remove(on phy0)
Fix this by setting the mdio busses phy_map[phy->addr] to NULL when
unregistering the phy device, so that mdiobus_unregister no longer
finds a valid phy_device when iterating over the busses device list.
Reported-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Tested-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
-rw-r--r-- | drivers/net/phy/mdio_bus.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c index f526cfcd89..0959c45e62 100644 --- a/drivers/net/phy/mdio_bus.c +++ b/drivers/net/phy/mdio_bus.c @@ -331,12 +331,14 @@ static void mdio_bus_remove(struct device_d *_dev) { struct phy_device *dev = to_phy_device(_dev); struct phy_driver *drv = to_phy_driver(_dev->driver); + struct mii_bus *bus = dev->bus; if (drv->remove) drv->remove(dev); free(dev->cdev.name); devfs_remove(&dev->cdev); + bus->phy_map[dev->addr] = NULL; } struct bus_type mdio_bus_type = { |