1 --- a/drivers/net/phy/phy_device.c
2 +++ b/drivers/net/phy/phy_device.c
3 @@ -734,6 +734,9 @@ void phy_detach(struct phy_device *phyde
7 + if (phydev->drv && phydev->drv->detach)
8 + phydev->drv->detach(phydev);
10 phydev->attached_dev->phydev = NULL;
11 phydev->attached_dev = NULL;
13 --- a/include/linux/phy.h
14 +++ b/include/linux/phy.h
15 @@ -519,6 +519,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);