kernel: sfp: re-attempt probing for phy
[openwrt/openwrt.git] / target / linux / generic / pending-4.19 / 757-net-sfp-rename-sm_retries.patch
1 From bfa3cbb01c7ea34d7369c9bd2ec1b2dc67082b04 Mon Sep 17 00:00:00 2001
2 From: Russell King <rmk+kernel@armlinux.org.uk>
3 Date: Mon, 2 Dec 2019 18:06:44 +0000
4 Subject: [PATCH 2/4] net: sfp: rename sm_retries
5
6 Rename sm_retries as sm_fault_retries, as this is what this member is
7 tracking.
8
9 Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
10 ---
11 drivers/net/phy/sfp.c | 10 +++++-----
12 1 file changed, 5 insertions(+), 5 deletions(-)
13
14 --- a/drivers/net/phy/sfp.c
15 +++ b/drivers/net/phy/sfp.c
16 @@ -222,7 +222,7 @@ struct sfp {
17 unsigned char sm_mod_tries;
18 unsigned char sm_dev_state;
19 unsigned short sm_state;
20 - unsigned int sm_retries;
21 + unsigned char sm_fault_retries;
22
23 struct sfp_eeprom_id id;
24 unsigned int module_power_mW;
25 @@ -1414,7 +1414,7 @@ static bool sfp_los_event_inactive(struc
26
27 static void sfp_sm_fault(struct sfp *sfp, unsigned int next_state, bool warn)
28 {
29 - if (sfp->sm_retries && !--sfp->sm_retries) {
30 + if (sfp->sm_fault_retries && !--sfp->sm_fault_retries) {
31 dev_err(sfp->dev,
32 "module persistently indicates fault, disabling\n");
33 sfp_sm_next(sfp, SFP_S_TX_DISABLE, 0);
34 @@ -1811,7 +1811,7 @@ static void sfp_sm_main(struct sfp *sfp,
35 sfp_module_tx_enable(sfp);
36
37 /* Initialise the fault clearance retries */
38 - sfp->sm_retries = N_FAULT_INIT;
39 + sfp->sm_fault_retries = N_FAULT_INIT;
40
41 /* We need to check the TX_FAULT state, which is not defined
42 * while TX_DISABLE is asserted. The earliest we want to do
43 @@ -1850,7 +1850,7 @@ static void sfp_sm_main(struct sfp *sfp,
44 * there is a fault.
45 */
46 sfp_sm_fault(sfp, SFP_S_INIT_TX_FAULT,
47 - sfp->sm_retries == N_FAULT_INIT);
48 + sfp->sm_fault_retries == N_FAULT_INIT);
49 } else if (event == SFP_E_TIMEOUT || event == SFP_E_TX_CLEAR) {
50 init_done: /* TX_FAULT deasserted or we timed out with TX_FAULT
51 * clear. Probe for the PHY and check the LOS state.
52 @@ -1863,7 +1863,7 @@ static void sfp_sm_main(struct sfp *sfp,
53 sfp_sm_link_check_los(sfp);
54
55 /* Reset the fault retry count */
56 - sfp->sm_retries = N_FAULT;
57 + sfp->sm_fault_retries = N_FAULT;
58 }
59 break;
60