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

123456789101112131415161718192021222324252627
  1. --- a/drivers/net/phy/phy_device.c
  2. +++ b/drivers/net/phy/phy_device.c
  3. @@ -613,6 +613,9 @@ EXPORT_SYMBOL(phy_attach);
  4. */
  5. void phy_detach(struct phy_device *phydev)
  6. {
  7. + if (phydev->drv && phydev->drv->detach)
  8. + phydev->drv->detach(phydev);
  9. +
  10. phydev->attached_dev->phydev = NULL;
  11. phydev->attached_dev = NULL;
  12. --- a/include/linux/phy.h
  13. +++ b/include/linux/phy.h
  14. @@ -432,6 +432,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);