[openwrt/openwrt] realtek: sfp: prevent duplicate hwmon devices when re-probing on interface up

LEDE Commits lede-commits at lists.infradead.org
Tue Feb 25 11:57:50 PST 2025


svanheule pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/736229ba991ba69c6fdc7334353a43d9b1da1bdd

commit 736229ba991ba69c6fdc7334353a43d9b1da1bdd
Author: Bjørn Mork <bjorn at mork.no>
AuthorDate: Tue Feb 4 09:05:40 2025 +0100

    realtek: sfp: prevent duplicate hwmon devices when re-probing on interface up
    
    Re-probing on interface up will register a new duplicate hwmon device. Skip
    the hwmon probe if we already have a sensor device.
    
    Signed-off-by: Bjørn Mork <bjorn at mork.no>
    Link: https://github.com/openwrt/openwrt/pull/17950
    Signed-off-by: Sander Vanheule <sander at svanheule.net>
---
 .../710-net-phy-sfp-re-probe-modules-on-DEV_UP-event.patch  | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/target/linux/realtek/patches-6.6/710-net-phy-sfp-re-probe-modules-on-DEV_UP-event.patch b/target/linux/realtek/patches-6.6/710-net-phy-sfp-re-probe-modules-on-DEV_UP-event.patch
index 4e1a21aa71..26216691e4 100644
--- a/target/linux/realtek/patches-6.6/710-net-phy-sfp-re-probe-modules-on-DEV_UP-event.patch
+++ b/target/linux/realtek/patches-6.6/710-net-phy-sfp-re-probe-modules-on-DEV_UP-event.patch
@@ -10,7 +10,18 @@ Signed-off-by: Antoine Tenart <antoine.tenart at bootlin.com>
 
 --- a/drivers/net/phy/sfp.c
 +++ b/drivers/net/phy/sfp.c
-@@ -2416,6 +2416,13 @@ static void sfp_sm_module(struct sfp *sf
+@@ -1557,6 +1557,10 @@ static void sfp_hwmon_probe(struct work_
+ 	struct sfp *sfp = container_of(work, struct sfp, hwmon_probe.work);
+ 	int err;
+ 
++	/* Avoid duplicate hwmon devices when re-probing */
++	if (sfp->hwmon_dev)
++		return;
++
+ 	/* hwmon interface needs to access 16bit registers in atomic way to
+ 	 * guarantee coherency of the diagnostic monitoring data. If it is not
+ 	 * possible to guarantee coherency because EEPROM is broken in such way
+@@ -2416,6 +2420,13 @@ static void sfp_sm_module(struct sfp *sf
  		return;
  	}
  




More information about the lede-commits mailing list