1
0
mirror of https://github.com/cjdelisle/openwrt.git synced 2025-06-15 14:03:11 +00:00
Files
openwrt/target/linux/realtek/patches-6.6/710-net-phy-sfp-re-probe-modules-on-DEV_UP-event.patch
Bjørn Mork 736229ba99 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@mork.no>
Link: https://github.com/openwrt/openwrt/pull/17950
Signed-off-by: Sander Vanheule <sander@svanheule.net>
2025-02-25 20:53:30 +01:00

38 lines
1.3 KiB
Diff

From a381ac0aa281fdb0b41a39d8a2bc08fd88f6db92 Mon Sep 17 00:00:00 2001
From: Antoine Tenart <antoine.tenart@bootlin.com>
Date: Tue, 25 Feb 2020 16:32:37 +0100
Subject: [PATCH 1/3] net: phy: sfp: re-probe modules on DEV_UP event
Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>
---
drivers/net/phy/sfp.c | 7 +++++++
1 file changed, 7 insertions(+)
--- a/drivers/net/phy/sfp.c
+++ b/drivers/net/phy/sfp.c
@@ -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;
}
+ /* Re-probe the SFP modules when an interface is brought up, as the MAC
+ * do not report its link status (This means Phylink wouldn't be
+ * triggered if the PHY had a link before a MAC is brought up).
+ */
+ if (event == SFP_E_DEV_UP && sfp->sm_mod_state == SFP_MOD_PRESENT)
+ sfp_sm_mod_next(sfp, SFP_MOD_PROBE, T_SERIAL);
+
switch (sfp->sm_mod_state) {
default:
if (event == SFP_E_INSERT) {