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

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