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
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.
10 Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
12 drivers/net/phy/sfp.c | 12 ++++++------
13 1 file changed, 6 insertions(+), 6 deletions(-)
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);
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)
24 if (sfp->sm_retries && !--sfp->sm_retries) {
26 @@ -1279,7 +1279,7 @@ static void sfp_sm_fault(struct sfp *sfp
28 dev_err(sfp->dev, "module transmit fault indicated\n");
30 - sfp_sm_next(sfp, SFP_S_TX_FAULT, T_FAULT_RECOVER);
31 + sfp_sm_next(sfp, next_state, T_FAULT_RECOVER);
35 @@ -1619,14 +1619,14 @@ static void sfp_sm_main(struct sfp *sfp,
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);
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))
52 @@ -1634,7 +1634,7 @@ static void sfp_sm_main(struct sfp *sfp,
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,
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);