developer | ec4ebe4 | 2022-04-12 11:17:45 +0800 | [diff] [blame] | 1 | From 729fd05aac22cdf1e502fbf1bf80e5ebba0d9fbc Mon Sep 17 00:00:00 2001 |
| 2 | From: Russell King <rmk+kernel@armlinux.org.uk> |
| 3 | Date: Tue, 3 Dec 2019 17:48:28 +0000 |
| 4 | Subject: [PATCH] net: sfp: fix unbind |
| 5 | |
| 6 | When unbinding, we don't correctly tear down the module state, leaving |
| 7 | (for example) the hwmon registration behind. Ensure everything is |
| 8 | properly removed by sending a remove event at unbind. |
| 9 | |
| 10 | Fixes: 6b0da5c9c1a3 ("net: sfp: track upstream's attachment state in state machine") |
| 11 | Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> |
| 12 | --- |
| 13 | drivers/net/phy/sfp.c | 4 ++++ |
| 14 | 1 file changed, 4 insertions(+) |
| 15 | |
| 16 | --- a/drivers/net/phy/sfp.c |
| 17 | +++ b/drivers/net/phy/sfp.c |
developer | 53810fa | 2022-04-19 10:14:08 +0800 | [diff] [blame^] | 18 | @@ -2439,6 +2439,10 @@ static int sfp_remove(struct platform_de |
developer | ec4ebe4 | 2022-04-12 11:17:45 +0800 | [diff] [blame] | 19 | |
| 20 | sfp_unregister_socket(sfp->sfp_bus); |
| 21 | |
| 22 | + rtnl_lock(); |
| 23 | + sfp_sm_event(sfp, SFP_E_REMOVE); |
| 24 | + rtnl_unlock(); |
| 25 | + |
| 26 | return 0; |
| 27 | } |
| 28 | |