703-phy-add-detach-callback-to-struct-phy_driver.patch 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. From: Gabor Juhos <[email protected]>
  2. Subject: generic: add detach callback to struct phy_driver
  3. lede-commit: fe61fc2d7d0b3fb348b502f68f98243b3ddf5867
  4. Signed-off-by: Gabor Juhos <[email protected]>
  5. ---
  6. drivers/net/phy/phy_device.c | 3 +++
  7. include/linux/phy.h | 6 ++++++
  8. 2 files changed, 9 insertions(+)
  9. --- a/drivers/net/phy/phy_device.c
  10. +++ b/drivers/net/phy/phy_device.c
  11. @@ -1751,6 +1751,9 @@ void phy_detach(struct phy_device *phyde
  12. struct module *ndev_owner = NULL;
  13. struct mii_bus *bus;
  14. + if (phydev->drv && phydev->drv->detach)
  15. + phydev->drv->detach(phydev);
  16. +
  17. if (phydev->sysfs_links) {
  18. if (dev)
  19. sysfs_remove_link(&dev->dev.kobj, "phydev");
  20. --- a/include/linux/phy.h
  21. +++ b/include/linux/phy.h
  22. @@ -843,6 +843,12 @@ struct phy_driver {
  23. /** @handle_interrupt: Override default interrupt handling */
  24. irqreturn_t (*handle_interrupt)(struct phy_device *phydev);
  25. + /*
  26. + * Called before an ethernet device is detached
  27. + * from the PHY.
  28. + */
  29. + void (*detach)(struct phy_device *phydev);
  30. +
  31. /** @remove: Clears up any memory if needed */
  32. void (*remove)(struct phy_device *phydev);