aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/generic/backport-5.4/720-v5.5-net-sfp-move-sfp-sub-state-machines-into-separate-fu.patch
diff options
context:
space:
mode:
authorHauke Mehrtens <hauke@hauke-m.de>2020-02-23 13:20:11 +0100
committerKoen Vandeputte <koen.vandeputte@ncentric.com>2020-02-28 17:50:45 +0100
commitc16517d26de30c90dabce1e456615fd7fbdce07c (patch)
treee7371ee12a3c413a064885b634ee4c975ad7f96a /target/linux/generic/backport-5.4/720-v5.5-net-sfp-move-sfp-sub-state-machines-into-separate-fu.patch
parent955634b473284847e3c8281a6ac85655329d8b06 (diff)
downloadupstream-c16517d26de30c90dabce1e456615fd7fbdce07c.tar.gz
upstream-c16517d26de30c90dabce1e456615fd7fbdce07c.tar.bz2
upstream-c16517d26de30c90dabce1e456615fd7fbdce07c.zip
kernel: copy kernel 4.19 code to 5.4
No changes were done to the patches while coping them. Currently they do not apply on top of kernel 5.4. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Diffstat (limited to 'target/linux/generic/backport-5.4/720-v5.5-net-sfp-move-sfp-sub-state-machines-into-separate-fu.patch')
-rw-r--r--target/linux/generic/backport-5.4/720-v5.5-net-sfp-move-sfp-sub-state-machines-into-separate-fu.patch124
1 files changed, 124 insertions, 0 deletions
diff --git a/target/linux/generic/backport-5.4/720-v5.5-net-sfp-move-sfp-sub-state-machines-into-separate-fu.patch b/target/linux/generic/backport-5.4/720-v5.5-net-sfp-move-sfp-sub-state-machines-into-separate-fu.patch
new file mode 100644
index 0000000000..2f90b00438
--- /dev/null
+++ b/target/linux/generic/backport-5.4/720-v5.5-net-sfp-move-sfp-sub-state-machines-into-separate-fu.patch
@@ -0,0 +1,124 @@
+From b9d6ed5cdb67533feda7f221eb06f2f9f1ff5047 Mon Sep 17 00:00:00 2001
+From: Russell King <rmk+kernel@armlinux.org.uk>
+Date: Fri, 11 Oct 2019 19:33:58 +0100
+Subject: [PATCH 618/660] net: sfp: move sfp sub-state machines into separate
+ functions
+
+Move the SFP sub-state machines out of the main state machine function,
+in preparation for it doing a bit more with the device state. By doing
+so, we ensure that our debug after the main state machine is always
+printed.
+
+Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
+---
+ drivers/net/phy/sfp.c | 74 +++++++++++++++++++++++++------------------
+ 1 file changed, 43 insertions(+), 31 deletions(-)
+
+--- a/drivers/net/phy/sfp.c
++++ b/drivers/net/phy/sfp.c
+@@ -1479,19 +1479,34 @@ static void sfp_sm_mod_remove(struct sfp
+ dev_info(sfp->dev, "module removed\n");
+ }
+
+-static void sfp_sm_event(struct sfp *sfp, unsigned int event)
++/* This state machine tracks the netdev up/down state */
++static void sfp_sm_device(struct sfp *sfp, unsigned int event)
+ {
+- mutex_lock(&sfp->sm_mutex);
++ switch (sfp->sm_dev_state) {
++ default:
++ if (event == SFP_E_DEV_UP)
++ sfp->sm_dev_state = SFP_DEV_UP;
++ break;
+
+- dev_dbg(sfp->dev, "SM: enter %s:%s:%s event %s\n",
+- mod_state_to_str(sfp->sm_mod_state),
+- dev_state_to_str(sfp->sm_dev_state),
+- sm_state_to_str(sfp->sm_state),
+- event_to_str(event));
++ 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);
++ sfp->sm_dev_state = SFP_DEV_DOWN;
++ }
++ break;
++ }
++}
+
+- /* This state machine tracks the insert/remove state of
+- * the module, and handles probing the on-board EEPROM.
+- */
++/* This state machine tracks the insert/remove state of
++ * the module, and handles probing the on-board EEPROM.
++ */
++static void sfp_sm_module(struct sfp *sfp, unsigned int event)
++{
+ switch (sfp->sm_mod_state) {
+ default:
+ if (event == SFP_E_INSERT && sfp->attached) {
+@@ -1531,27 +1546,10 @@ static void sfp_sm_event(struct sfp *sfp
+ }
+ break;
+ }
++}
+
+- /* This state machine tracks the netdev up/down state */
+- switch (sfp->sm_dev_state) {
+- default:
+- if (event == SFP_E_DEV_UP)
+- sfp->sm_dev_state = SFP_DEV_UP;
+- 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);
+- sfp->sm_dev_state = SFP_DEV_DOWN;
+- }
+- break;
+- }
+-
++static void sfp_sm_main(struct sfp *sfp, unsigned int event)
++{
+ /* Some events are global */
+ if (sfp->sm_state != SFP_S_DOWN &&
+ (sfp->sm_mod_state != SFP_MOD_PRESENT ||
+@@ -1562,7 +1560,6 @@ static void sfp_sm_event(struct sfp *sfp
+ if (sfp->mod_phy)
+ sfp_sm_phy_detach(sfp);
+ sfp_sm_next(sfp, SFP_S_DOWN, 0);
+- mutex_unlock(&sfp->sm_mutex);
+ return;
+ }
+
+@@ -1617,6 +1614,21 @@ static void sfp_sm_event(struct sfp *sfp
+ case SFP_S_TX_DISABLE:
+ break;
+ }
++}
++
++static void sfp_sm_event(struct sfp *sfp, unsigned int event)
++{
++ mutex_lock(&sfp->sm_mutex);
++
++ dev_dbg(sfp->dev, "SM: enter %s:%s:%s event %s\n",
++ mod_state_to_str(sfp->sm_mod_state),
++ dev_state_to_str(sfp->sm_dev_state),
++ sm_state_to_str(sfp->sm_state),
++ event_to_str(event));
++
++ sfp_sm_module(sfp, event);
++ sfp_sm_device(sfp, event);
++ sfp_sm_main(sfp, event);
+
+ dev_dbg(sfp->dev, "SM: exit %s:%s:%s\n",
+ mod_state_to_str(sfp->sm_mod_state),