6e34e6cc0f94fc55328be6537f0e4cd0af4f2086
[openwrt/staging/stintel.git] /
1 From 2aa424ee7fbe43e2cd24e28c2f6388c4e1796bd2 Mon Sep 17 00:00:00 2001
2 From: Russell King <rmk+kernel@armlinux.org.uk>
3 Date: Fri, 18 Oct 2019 09:58:33 +0100
4 Subject: [PATCH 628/660] net: sfp: allow fault processing to transition to
5 other states
6
7 Add the next state to sfp_sm_fault() so that it can branch to other
8 states. This will be necessary to improve the initialisation path.
9
10 Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
11 ---
12 drivers/net/phy/sfp.c | 12 ++++++------
13 1 file changed, 6 insertions(+), 6 deletions(-)
14
15 --- a/drivers/net/phy/sfp.c
16 +++ b/drivers/net/phy/sfp.c
17 @@ -1269,7 +1269,7 @@ static bool sfp_los_event_inactive(struc
18 event == SFP_E_LOS_LOW);
19 }
20
21 -static void sfp_sm_fault(struct sfp *sfp, bool warn)
22 +static void sfp_sm_fault(struct sfp *sfp, unsigned int next_state, bool warn)
23 {
24 if (sfp->sm_retries && !--sfp->sm_retries) {
25 dev_err(sfp->dev,
26 @@ -1279,7 +1279,7 @@ static void sfp_sm_fault(struct sfp *sfp
27 if (warn)
28 dev_err(sfp->dev, "module transmit fault indicated\n");
29
30 - sfp_sm_next(sfp, SFP_S_TX_FAULT, T_FAULT_RECOVER);
31 + sfp_sm_next(sfp, next_state, T_FAULT_RECOVER);
32 }
33 }
34
35 @@ -1619,14 +1619,14 @@ static void sfp_sm_main(struct sfp *sfp,
36
37 case SFP_S_INIT:
38 if (event == SFP_E_TIMEOUT && sfp->state & SFP_F_TX_FAULT)
39 - sfp_sm_fault(sfp, true);
40 + sfp_sm_fault(sfp, SFP_S_TX_FAULT, true);
41 else if (event == SFP_E_TIMEOUT || event == SFP_E_TX_CLEAR)
42 init_done: sfp_sm_link_check_los(sfp);
43 break;
44
45 case SFP_S_WAIT_LOS:
46 if (event == SFP_E_TX_FAULT)
47 - sfp_sm_fault(sfp, true);
48 + sfp_sm_fault(sfp, SFP_S_TX_FAULT, true);
49 else if (sfp_los_event_inactive(sfp, event))
50 sfp_sm_link_up(sfp);
51 break;
52 @@ -1634,7 +1634,7 @@ static void sfp_sm_main(struct sfp *sfp,
53 case SFP_S_LINK_UP:
54 if (event == SFP_E_TX_FAULT) {
55 sfp_sm_link_down(sfp);
56 - sfp_sm_fault(sfp, true);
57 + sfp_sm_fault(sfp, SFP_S_TX_FAULT, true);
58 } else if (sfp_los_event_active(sfp, event)) {
59 sfp_sm_link_down(sfp);
60 sfp_sm_next(sfp, SFP_S_WAIT_LOS, 0);
61 @@ -1650,7 +1650,7 @@ static void sfp_sm_main(struct sfp *sfp,
62
63 case SFP_S_REINIT:
64 if (event == SFP_E_TIMEOUT && sfp->state & SFP_F_TX_FAULT) {
65 - sfp_sm_fault(sfp, false);
66 + sfp_sm_fault(sfp, SFP_S_TX_FAULT, false);
67 } else if (event == SFP_E_TIMEOUT || event == SFP_E_TX_CLEAR) {
68 dev_info(sfp->dev, "module transmit fault recovered\n");
69 sfp_sm_link_check_los(sfp);