1 --- a/drivers/net/phy/phy_device.c
2 +++ b/drivers/net/phy/phy_device.c
3 @@ -674,6 +674,9 @@ void phy_detach(struct phy_device *phyde
7 + if (phydev->drv && phydev->drv->detach)
8 + phydev->drv->detach(phydev);
10 if (phydev->bus->dev.driver)
11 module_put(phydev->bus->dev.driver->owner);
13 --- a/include/linux/phy.h
14 +++ b/include/linux/phy.h
15 @@ -502,6 +502,12 @@ struct phy_driver {
17 int (*did_interrupt)(struct phy_device *phydev);
20 + * Called before an ethernet device is detached
23 + void (*detach)(struct phy_device *phydev);
25 /* Clears up any memory if needed */
26 void (*remove)(struct phy_device *phydev);