703-phy-add-detach-callback-to-struct-phy_driver.patch 699 B

123456789101112131415161718192021222324252627
  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
  4. struct mii_bus *bus;
  5. int i;
  6. + if (phydev->drv && phydev->drv->detach)
  7. + phydev->drv->detach(phydev);
  8. +
  9. phydev->attached_dev->phydev = NULL;
  10. phydev->attached_dev = NULL;
  11. phy_suspend(phydev);
  12. --- a/include/linux/phy.h
  13. +++ b/include/linux/phy.h
  14. @@ -515,6 +515,12 @@ struct phy_driver {
  15. */
  16. int (*did_interrupt)(struct phy_device *phydev);
  17. + /*
  18. + * Called before an ethernet device is detached
  19. + * from the PHY.
  20. + */
  21. + void (*detach)(struct phy_device *phydev);
  22. +
  23. /* Clears up any memory if needed */
  24. void (*remove)(struct phy_device *phydev);