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>
This commit is contained in:
parent
cbc2492621
commit
c05380f61e
|
@ -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 = {
|
||||
|
|
Loading…
Reference in New Issue