aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/generic
diff options
context:
space:
mode:
authorJonas Gorski <jonas.gorski@gmail.com>2019-12-04 23:09:41 +0100
committerJonas Gorski <jonas.gorski@gmail.com>2020-01-21 22:32:48 +0100
commit10b12b5d687215d4f9dfd3bb4012d861ebdad84f (patch)
tree9f3e22af7a19fee534789e91c9a16e91f860a634 /target/linux/generic
parent46678fbdca914c1de61a87357337eb680c4c4512 (diff)
downloadupstream-10b12b5d687215d4f9dfd3bb4012d861ebdad84f.tar.gz
upstream-10b12b5d687215d4f9dfd3bb4012d861ebdad84f.tar.bz2
upstream-10b12b5d687215d4f9dfd3bb4012d861ebdad84f.zip
kernel: sfp: add two fixes submitted to upstream
Add two small fixes for SFP that were submitted upstream. Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
Diffstat (limited to 'target/linux/generic')
-rw-r--r--target/linux/generic/pending-4.19/754-net-sfp-fix-unbind.patch28
-rw-r--r--target/linux/generic/pending-4.19/755-net-sfp-fix-hwmon.patch44
2 files changed, 72 insertions, 0 deletions
diff --git a/target/linux/generic/pending-4.19/754-net-sfp-fix-unbind.patch b/target/linux/generic/pending-4.19/754-net-sfp-fix-unbind.patch
new file mode 100644
index 0000000000..3172249a10
--- /dev/null
+++ b/target/linux/generic/pending-4.19/754-net-sfp-fix-unbind.patch
@@ -0,0 +1,28 @@
+From 729fd05aac22cdf1e502fbf1bf80e5ebba0d9fbc Mon Sep 17 00:00:00 2001
+From: Russell King <rmk+kernel@armlinux.org.uk>
+Date: Tue, 3 Dec 2019 17:48:28 +0000
+Subject: [PATCH] net: sfp: fix unbind
+
+When unbinding, we don't correctly tear down the module state, leaving
+(for example) the hwmon registration behind. Ensure everything is
+properly removed by sending a remove event at unbind.
+
+Fixes: 6b0da5c9c1a3 ("net: sfp: track upstream's attachment state in state machine")
+Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
+---
+ drivers/net/phy/sfp.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+--- a/drivers/net/phy/sfp.c
++++ b/drivers/net/phy/sfp.c
+@@ -2242,6 +2242,10 @@ static int sfp_remove(struct platform_de
+
+ sfp_unregister_socket(sfp->sfp_bus);
+
++ rtnl_lock();
++ sfp_sm_event(sfp, SFP_E_REMOVE);
++ rtnl_unlock();
++
+ return 0;
+ }
+
diff --git a/target/linux/generic/pending-4.19/755-net-sfp-fix-hwmon.patch b/target/linux/generic/pending-4.19/755-net-sfp-fix-hwmon.patch
new file mode 100644
index 0000000000..9e13fbd0f2
--- /dev/null
+++ b/target/linux/generic/pending-4.19/755-net-sfp-fix-hwmon.patch
@@ -0,0 +1,44 @@
+From 5eb0df5023c6ae8a71a7848fd5e1f788d86e51ae Mon Sep 17 00:00:00 2001
+From: Russell King <rmk+kernel@armlinux.org.uk>
+Date: Tue, 3 Dec 2019 18:46:04 +0000
+Subject: [PATCH] net: sfp: fix hwmon
+
+The referenced commit below allowed more than one hwmon device to be
+created per SFP, which is definitely not what we want. Avoid this by
+only creating the hwmon device just as we transition to WAITDEV state.
+
+Fixes: 139d3a212a1f ("net: sfp: allow modules with slow diagnostics to probe")
+Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
+---
+ drivers/net/phy/sfp.c | 13 ++++---------
+ 1 file changed, 4 insertions(+), 9 deletions(-)
+
+--- a/drivers/net/phy/sfp.c
++++ b/drivers/net/phy/sfp.c
+@@ -1714,6 +1714,10 @@ static void sfp_sm_module(struct sfp *sf
+ break;
+ }
+
++ err = sfp_hwmon_insert(sfp);
++ if (err)
++ dev_warn(sfp->dev, "hwmon probe failed: %d\n", err);
++
+ sfp_sm_mod_next(sfp, SFP_MOD_WAITDEV, 0);
+ /* fall through */
+ case SFP_MOD_WAITDEV:
+@@ -1763,15 +1767,6 @@ static void sfp_sm_module(struct sfp *sf
+ case SFP_MOD_ERROR:
+ break;
+ }
+-
+-#if IS_ENABLED(CONFIG_HWMON)
+- if (sfp->sm_mod_state >= SFP_MOD_WAITDEV &&
+- IS_ERR_OR_NULL(sfp->hwmon_dev)) {
+- err = sfp_hwmon_insert(sfp);
+- if (err)
+- dev_warn(sfp->dev, "hwmon probe failed: %d\n", err);
+- }
+-#endif
+ }
+
+ static void sfp_sm_main(struct sfp *sfp, unsigned int event)