b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame] | 1 | From df5c4d93c5a59cba0f7479a4cd4e22b50726ce88 Mon Sep 17 00:00:00 2001 |
| 2 | From: Russell King <rmk+kernel@armlinux.org.uk> |
| 3 | Date: Thu, 17 Oct 2019 11:12:42 +0100 |
| 4 | Subject: [PATCH 625/660] net: sfp: control TX_DISABLE and phy only from main |
| 5 | state machine |
| 6 | |
| 7 | We initialise TX_DISABLE when the sfp cage is probed, and then |
| 8 | maintain its state in the main state machine. However, the module |
| 9 | state machine: |
| 10 | - negates it when detecting a newly inserted module when it's already |
| 11 | guaranteed to be negated. |
| 12 | - negates it when the module is removed, but the main state machine |
| 13 | will do this anyway. |
| 14 | |
| 15 | Make TX_DISABLE entirely controlled by the main state machine. |
| 16 | |
| 17 | The main state machine also probes the module for a PHY, and removes |
| 18 | the PHY when the the module is removed. Hence, removing the PHY in |
| 19 | sfp_sm_module_remove() is also redundant, and is a left-over from |
| 20 | when we tried to probe for the PHY from the module state machine. |
| 21 | |
| 22 | Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> |
| 23 | --- |
| 24 | drivers/net/phy/sfp.c | 9 +-------- |
| 25 | 1 file changed, 1 insertion(+), 8 deletions(-) |
| 26 | |
| 27 | --- a/drivers/net/phy/sfp.c |
| 28 | +++ b/drivers/net/phy/sfp.c |
| 29 | @@ -1557,11 +1557,6 @@ static void sfp_sm_mod_remove(struct sfp |
| 30 | |
| 31 | sfp_hwmon_remove(sfp); |
| 32 | |
| 33 | - if (sfp->mod_phy) |
| 34 | - sfp_sm_phy_detach(sfp); |
| 35 | - |
| 36 | - sfp_module_tx_disable(sfp); |
| 37 | - |
| 38 | memset(&sfp->id, 0, sizeof(sfp->id)); |
| 39 | sfp->module_power_mW = 0; |
| 40 | |
| 41 | @@ -1599,10 +1594,8 @@ static void sfp_sm_module(struct sfp *sf |
| 42 | |
| 43 | switch (sfp->sm_mod_state) { |
| 44 | default: |
| 45 | - if (event == SFP_E_INSERT && sfp->attached) { |
| 46 | - sfp_module_tx_disable(sfp); |
| 47 | + if (event == SFP_E_INSERT && sfp->attached) |
| 48 | sfp_sm_mod_next(sfp, SFP_MOD_PROBE, T_SERIAL); |
| 49 | - } |
| 50 | break; |
| 51 | |
| 52 | case SFP_MOD_PROBE: |