bd8f64dcbe0a74ed74a0cd8388c9a2e0edc5ebb3
[openwrt/openwrt.git] / target / linux / mvebu / patches-4.19 / 404-sfp-provide-netdev-sfp_bus-and-use-for-start-stop.patch
1 From 0068a89747e7c1d9a0bbb7282a34382a4274638a Mon Sep 17 00:00:00 2001
2 From: Russell King <rmk+kernel@armlinux.org.uk>
3 Date: Fri, 14 Apr 2017 16:41:55 +0100
4 Subject: [PATCH] sfp: provide netdev sfp_bus and use for start/stop
5
6 Add a netdev sfp_bus pointer for propagating the phylink start/stop
7 actions to the SFP cage: the SFP cage may not be directly connected to
8 phylink, but may be the other side of a fixed PHY, and SFP needs to
9 know when the netdev is brought up or taken down.
10
11 Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
12 ---
13 drivers/net/phy/phylink.c | 8 ++++----
14 1 file changed, 4 insertions(+), 4 deletions(-)
15
16 --- a/drivers/net/phy/phylink.c
17 +++ b/drivers/net/phy/phylink.c
18 @@ -943,8 +943,8 @@ void phylink_start(struct phylink *pl)
19
20 if (pl->link_an_mode == MLO_AN_FIXED && !IS_ERR(pl->link_gpio))
21 mod_timer(&pl->link_poll, jiffies + HZ);
22 - if (pl->sfp_bus)
23 - sfp_upstream_start(pl->sfp_bus);
24 + if (pl->netdev->sfp_bus)
25 + sfp_upstream_start(pl->netdev->sfp_bus);
26 if (pl->phydev)
27 phy_start(pl->phydev);
28 }
29 @@ -965,8 +965,8 @@ void phylink_stop(struct phylink *pl)
30
31 if (pl->phydev)
32 phy_stop(pl->phydev);
33 - if (pl->sfp_bus)
34 - sfp_upstream_stop(pl->sfp_bus);
35 + if (pl->netdev->sfp_bus)
36 + sfp_upstream_stop(pl->netdev->sfp_bus);
37 if (pl->link_an_mode == MLO_AN_FIXED && !IS_ERR(pl->link_gpio))
38 del_timer_sync(&pl->link_poll);
39