146-sfp-phylink-hook-up-eeprom-functions.patch 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. From a7091ef24223ed39b39c6b73b77c55c8a607f34a Mon Sep 17 00:00:00 2001
  2. From: Russell King <rmk+kernel@arm.linux.org.uk>
  3. Date: Thu, 8 Oct 2015 23:49:47 +0100
  4. Subject: [PATCH 734/744] sfp/phylink: hook up eeprom functions
  5. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
  6. ---
  7. drivers/net/phy/sfp.c | 19 +++++++++++--------
  8. 1 file changed, 11 insertions(+), 8 deletions(-)
  9. --- a/drivers/net/phy/sfp.c
  10. +++ b/drivers/net/phy/sfp.c
  11. @@ -901,11 +901,9 @@ static void sfp_sm_event(struct sfp *sfp
  12. mutex_unlock(&sfp->sm_mutex);
  13. }
  14. -#if 0
  15. -static int sfp_phy_module_info(struct phy_device *phy,
  16. - struct ethtool_modinfo *modinfo)
  17. +static int sfp_module_info(void *priv, struct ethtool_modinfo *modinfo)
  18. {
  19. - struct sfp *sfp = phy->priv;
  20. + struct sfp *sfp = priv;
  21. /* locking... and check module is present */
  22. @@ -919,10 +917,9 @@ static int sfp_phy_module_info(struct ph
  23. return 0;
  24. }
  25. -static int sfp_phy_module_eeprom(struct phy_device *phy,
  26. - struct ethtool_eeprom *ee, u8 *data)
  27. +static int sfp_module_eeprom(void *priv, struct ethtool_eeprom *ee, u8 *data)
  28. {
  29. - struct sfp *sfp = phy->priv;
  30. + struct sfp *sfp = priv;
  31. unsigned int first, last, len;
  32. int ret;
  33. @@ -953,7 +950,11 @@ static int sfp_phy_module_eeprom(struct
  34. }
  35. return 0;
  36. }
  37. -#endif
  38. +
  39. +static const struct phylink_module_ops sfp_module_ops = {
  40. + .get_module_info = sfp_module_info,
  41. + .get_module_eeprom = sfp_module_eeprom,
  42. +};
  43. static void sfp_timeout(struct work_struct *work)
  44. {
  45. @@ -1029,6 +1030,7 @@ static int sfp_netdev_notify(struct noti
  46. case NETDEV_UNREGISTER:
  47. if (sfp->mod_phy && sfp->phylink)
  48. phylink_disconnect_phy(sfp->phylink);
  49. + phylink_unregister_module(sfp->phylink, sfp);
  50. sfp->phylink = NULL;
  51. dev_put(sfp->ndev);
  52. sfp->ndev = NULL;
  53. @@ -1145,6 +1147,7 @@ static int sfp_probe(struct platform_dev
  54. }
  55. phylink_disable(sfp->phylink);
  56. + phylink_register_module(sfp->phylink, sfp, &sfp_module_ops);
  57. }
  58. sfp->state = sfp_get_state(sfp);