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