1 From 0db7fba746b5608c30d4e2ba1c99a2a309e2d288 Mon Sep 17 00:00:00 2001
2 From: Russell King <rmk+kernel@armlinux.org.uk>
3 Date: Fri, 8 Nov 2019 15:22:48 +0000
4 Subject: [PATCH 649/660] net: phylink: re-split __phylink_connect_phy()
6 In order to support Clause 45 PHYs on SFP+ modules, which have an
7 indeterminant phy interface mode, we need to be able to call
8 phylink_bringup_phy() with a different interface mode to that used when
9 binding the PHY. Reduce __phylink_connect_phy() to an attach operation,
10 and move the call to phylink_bringup_phy() to its call sites.
12 Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
14 drivers/net/phy/phylink.c | 39 ++++++++++++++++++++++++---------------
15 1 file changed, 24 insertions(+), 15 deletions(-)
17 --- a/drivers/net/phy/phylink.c
18 +++ b/drivers/net/phy/phylink.c
19 @@ -765,11 +765,9 @@ static int phylink_bringup_phy(struct ph
23 -static int __phylink_connect_phy(struct phylink *pl, struct phy_device *phy,
24 - phy_interface_t interface)
25 +static int phylink_attach_phy(struct phylink *pl, struct phy_device *phy,
26 + phy_interface_t interface)
30 if (WARN_ON(pl->link_an_mode == MLO_AN_FIXED ||
31 (pl->link_an_mode == MLO_AN_INBAND &&
32 phy_interface_mode_is_8023z(interface))))
33 @@ -778,15 +776,7 @@ static int __phylink_connect_phy(struct
37 - ret = phy_attach_direct(pl->netdev, phy, 0, interface);
41 - ret = phylink_bringup_phy(pl, phy);
46 + return phy_attach_direct(pl->netdev, phy, 0, interface);
50 @@ -806,13 +796,23 @@ static int __phylink_connect_phy(struct
52 int phylink_connect_phy(struct phylink *pl, struct phy_device *phy)
56 /* Use PHY device/driver interface */
57 if (pl->link_interface == PHY_INTERFACE_MODE_NA) {
58 pl->link_interface = phy->interface;
59 pl->link_config.interface = pl->link_interface;
62 - return __phylink_connect_phy(pl, phy, pl->link_interface);
63 + ret = phylink_attach_phy(pl, phy, pl->link_interface);
67 + ret = phylink_bringup_phy(pl, phy);
73 EXPORT_SYMBOL_GPL(phylink_connect_phy);
75 @@ -1814,8 +1814,17 @@ static void phylink_sfp_link_up(void *up
76 static int phylink_sfp_connect_phy(void *upstream, struct phy_device *phy)
78 struct phylink *pl = upstream;
81 - return __phylink_connect_phy(upstream, phy, pl->link_config.interface);
82 + ret = phylink_attach_phy(pl, phy, pl->link_config.interface);
86 + ret = phylink_bringup_phy(pl, phy);
93 static void phylink_sfp_disconnect_phy(void *upstream)