net: sfp: move tx disable on device down to main state machine
authorRussell King <rmk+kernel@armlinux.org.uk>
Sun, 10 Nov 2019 14:06:18 +0000 (14:06 +0000)
committerDavid S. Miller <davem@davemloft.net>
Tue, 12 Nov 2019 00:17:00 +0000 (16:17 -0800)
Move the tx disable assertion on device down to the main state
machine.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/phy/sfp.c

index 9d341ab4c96b8d7e857ae6e0b60c926a2c4d8457..04169681dd8686451e670533a468a141b8ff133b 100644 (file)
@@ -1554,15 +1554,8 @@ static void sfp_sm_device(struct sfp *sfp, unsigned int event)
                break;
 
        case SFP_DEV_UP:
-               if (event == SFP_E_DEV_DOWN) {
-                       /* If the module has a PHY, avoid raising TX disable
-                        * as this resets the PHY. Otherwise, raise it to
-                        * turn the laser off.
-                        */
-                       if (!sfp->mod_phy)
-                               sfp_module_tx_disable(sfp);
+               if (event == SFP_E_DEV_DOWN)
                        sfp->sm_dev_state = SFP_DEV_DOWN;
-               }
                break;
        }
 }
@@ -1624,6 +1617,7 @@ static void sfp_sm_main(struct sfp *sfp, unsigned int event)
                        sfp_sm_link_down(sfp);
                if (sfp->mod_phy)
                        sfp_sm_phy_detach(sfp);
+               sfp_module_tx_disable(sfp);
                sfp_sm_next(sfp, SFP_S_DOWN, 0);
                return;
        }