712-v5.3-net-sfp-remove-sfp-bus-use-of-netdevs.patch 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. From 60d756717d772be90d07a07cd2cc140c76da3e4a Mon Sep 17 00:00:00 2001
  2. From: Russell King <[email protected]>
  3. Date: Tue, 28 May 2019 10:57:39 +0100
  4. Subject: [PATCH 610/660] net: sfp: remove sfp-bus use of netdevs
  5. The sfp-bus code now no longer has any use for the network device
  6. structure, so remove its use.
  7. Signed-off-by: Russell King <[email protected]>
  8. Reviewed-by: Andrew Lunn <[email protected]>
  9. Signed-off-by: David S. Miller <[email protected]>
  10. Signed-off-by: Russell King <[email protected]>
  11. ---
  12. drivers/net/phy/phylink.c | 3 +--
  13. drivers/net/phy/sfp-bus.c | 10 +++-------
  14. include/linux/sfp.h | 6 ++----
  15. 3 files changed, 6 insertions(+), 13 deletions(-)
  16. --- a/drivers/net/phy/phylink.c
  17. +++ b/drivers/net/phy/phylink.c
  18. @@ -555,8 +555,7 @@ static int phylink_register_sfp(struct p
  19. return ret;
  20. }
  21. - pl->sfp_bus = sfp_register_upstream(ref.fwnode, pl->netdev, pl,
  22. - &sfp_phylink_ops);
  23. + pl->sfp_bus = sfp_register_upstream(ref.fwnode, pl, &sfp_phylink_ops);
  24. if (!pl->sfp_bus)
  25. return -ENOMEM;
  26. --- a/drivers/net/phy/sfp-bus.c
  27. +++ b/drivers/net/phy/sfp-bus.c
  28. @@ -23,7 +23,6 @@ struct sfp_bus {
  29. const struct sfp_upstream_ops *upstream_ops;
  30. void *upstream;
  31. - struct net_device *netdev;
  32. struct phy_device *phydev;
  33. bool registered;
  34. @@ -442,13 +441,11 @@ static void sfp_upstream_clear(struct sf
  35. {
  36. bus->upstream_ops = NULL;
  37. bus->upstream = NULL;
  38. - bus->netdev = NULL;
  39. }
  40. /**
  41. * sfp_register_upstream() - Register the neighbouring device
  42. * @fwnode: firmware node for the SFP bus
  43. - * @ndev: network device associated with the interface
  44. * @upstream: the upstream private data
  45. * @ops: the upstream's &struct sfp_upstream_ops
  46. *
  47. @@ -459,7 +456,7 @@ static void sfp_upstream_clear(struct sf
  48. * On error, returns %NULL.
  49. */
  50. struct sfp_bus *sfp_register_upstream(struct fwnode_handle *fwnode,
  51. - struct net_device *ndev, void *upstream,
  52. + void *upstream,
  53. const struct sfp_upstream_ops *ops)
  54. {
  55. struct sfp_bus *bus = sfp_bus_get(fwnode);
  56. @@ -469,7 +466,6 @@ struct sfp_bus *sfp_register_upstream(st
  57. rtnl_lock();
  58. bus->upstream_ops = ops;
  59. bus->upstream = upstream;
  60. - bus->netdev = ndev;
  61. if (bus->sfp) {
  62. ret = sfp_register_bus(bus);
  63. @@ -591,7 +587,7 @@ struct sfp_bus *sfp_register_socket(stru
  64. bus->sfp = sfp;
  65. bus->socket_ops = ops;
  66. - if (bus->netdev) {
  67. + if (bus->upstream_ops) {
  68. ret = sfp_register_bus(bus);
  69. if (ret)
  70. sfp_socket_clear(bus);
  71. @@ -611,7 +607,7 @@ EXPORT_SYMBOL_GPL(sfp_register_socket);
  72. void sfp_unregister_socket(struct sfp_bus *bus)
  73. {
  74. rtnl_lock();
  75. - if (bus->netdev)
  76. + if (bus->upstream_ops)
  77. sfp_unregister_bus(bus);
  78. sfp_socket_clear(bus);
  79. rtnl_unlock();
  80. --- a/include/linux/sfp.h
  81. +++ b/include/linux/sfp.h
  82. @@ -464,7 +464,6 @@ enum {
  83. struct fwnode_handle;
  84. struct ethtool_eeprom;
  85. struct ethtool_modinfo;
  86. -struct net_device;
  87. struct sfp_bus;
  88. /**
  89. @@ -510,7 +509,7 @@ int sfp_get_module_eeprom(struct sfp_bus
  90. void sfp_upstream_start(struct sfp_bus *bus);
  91. void sfp_upstream_stop(struct sfp_bus *bus);
  92. struct sfp_bus *sfp_register_upstream(struct fwnode_handle *fwnode,
  93. - struct net_device *ndev, void *upstream,
  94. + void *upstream,
  95. const struct sfp_upstream_ops *ops);
  96. void sfp_unregister_upstream(struct sfp_bus *bus);
  97. #else
  98. @@ -555,8 +554,7 @@ static inline void sfp_upstream_stop(str
  99. }
  100. static inline struct sfp_bus *sfp_register_upstream(
  101. - struct fwnode_handle *fwnode,
  102. - struct net_device *ndev, void *upstream,
  103. + struct fwnode_handle *fwnode, void *upstream,
  104. const struct sfp_upstream_ops *ops)
  105. {
  106. return (struct sfp_bus *)-1;