5b3caaf0fd6688afc70fd10024426641e73cdbcd
[openwrt/staging/jogo.git] / target / linux / generic / backport-5.4 / 721-v5.5-net-sfp-move-tx-disable-on-device-down-to-main-state.patch
1 From 7e89b737c97a9e7a81dd1584000bc136b92f12fd Mon Sep 17 00:00:00 2001
2 From: Russell King <rmk+kernel@armlinux.org.uk>
3 Date: Fri, 11 Oct 2019 22:14:47 +0100
4 Subject: [PATCH 619/660] net: sfp: move tx disable on device down to main
5 state machine
6
7 Move the tx disable assertion on device down to the main state
8 machine.
9
10 Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
11 ---
12 drivers/net/phy/sfp.c | 10 ++--------
13 1 file changed, 2 insertions(+), 8 deletions(-)
14
15 --- a/drivers/net/phy/sfp.c
16 +++ b/drivers/net/phy/sfp.c
17 @@ -1489,15 +1489,8 @@ static void sfp_sm_device(struct sfp *sf
18 break;
19
20 case SFP_DEV_UP:
21 - if (event == SFP_E_DEV_DOWN) {
22 - /* If the module has a PHY, avoid raising TX disable
23 - * as this resets the PHY. Otherwise, raise it to
24 - * turn the laser off.
25 - */
26 - if (!sfp->mod_phy)
27 - sfp_module_tx_disable(sfp);
28 + if (event == SFP_E_DEV_DOWN)
29 sfp->sm_dev_state = SFP_DEV_DOWN;
30 - }
31 break;
32 }
33 }
34 @@ -1559,6 +1552,7 @@ static void sfp_sm_main(struct sfp *sfp,
35 sfp_sm_link_down(sfp);
36 if (sfp->mod_phy)
37 sfp_sm_phy_detach(sfp);
38 + sfp_module_tx_disable(sfp);
39 sfp_sm_next(sfp, SFP_S_DOWN, 0);
40 return;
41 }