0014-phy-add-detach-callback-to-struct-phy_driver.patch 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. From 76e9965a69ff97c3ca973ca54f145a96023bdeca Mon Sep 17 00:00:00 2001
  2. From: Phil Sutter <phil@nwl.cc>
  3. Date: Wed, 14 May 2014 03:24:00 +0200
  4. Subject: [PATCH] phy: add detach callback to struct phy_driver
  5. This is used by ar8216 driver.
  6. ---
  7. drivers/net/phy/phy_device.c | 4 ++++
  8. include/linux/phy.h | 6 ++++++
  9. 2 files changed, 10 insertions(+)
  10. diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
  11. index 3653754..b35ece2 100644
  12. --- a/drivers/net/phy/phy_device.c
  13. +++ b/drivers/net/phy/phy_device.c
  14. @@ -662,6 +662,10 @@ EXPORT_SYMBOL(phy_attach);
  15. void phy_detach(struct phy_device *phydev)
  16. {
  17. int i;
  18. +
  19. + if (phydev->drv && phydev->drv->detach)
  20. + phydev->drv->detach(phydev);
  21. +
  22. phydev->attached_dev->phydev = NULL;
  23. phydev->attached_dev = NULL;
  24. phy_suspend(phydev);
  25. diff --git a/include/linux/phy.h b/include/linux/phy.h
  26. index 9ab0d79..f1441b4 100644
  27. --- a/include/linux/phy.h
  28. +++ b/include/linux/phy.h
  29. @@ -432,6 +432,12 @@ struct phy_driver {
  30. */
  31. int (*did_interrupt)(struct phy_device *phydev);
  32. + /*
  33. + * Called before an ethernet device is detached
  34. + * from the PHY.
  35. + */
  36. + void (*detach)(struct phy_device *phydev);
  37. +
  38. /* Clears up any memory if needed */
  39. void (*remove)(struct phy_device *phydev);
  40. --
  41. 1.8.5.3