1
0

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

1234567891011121314151617181920212223242526272829303132333435363738
  1. From: Gabor Juhos <juhosg@openwrt.org>
  2. Subject: generic: add detach callback to struct phy_driver
  3. lede-commit: fe61fc2d7d0b3fb348b502f68f98243b3ddf5867
  4. Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  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. @@ -1102,6 +1102,9 @@ void phy_detach(struct phy_device *phyde
  12. struct module *ndev_owner = dev->dev.parent->driver->owner;
  13. struct mii_bus *bus;
  14. + if (phydev->drv && phydev->drv->detach)
  15. + phydev->drv->detach(phydev);
  16. +
  17. if (phydev->sysfs_links) {
  18. sysfs_remove_link(&dev->dev.kobj, "phydev");
  19. sysfs_remove_link(&phydev->mdio.dev.kobj, "attached_dev");
  20. --- a/include/linux/phy.h
  21. +++ b/include/linux/phy.h
  22. @@ -559,6 +559,12 @@ struct phy_driver {
  23. */
  24. int (*did_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. /* Clears up any memory if needed */
  32. void (*remove)(struct phy_device *phydev);