From: Russell King Date: Tue, 3 Dec 2019 23:51:22 +0000 (+0000) Subject: net: sfp: fix unbind X-Git-Tag: v5.5-rc1~1^2~33 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=0cb96b5749bf500f3612cda52fc98eb795fcd62d;p=users%2Fwilly%2Flinux.git 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 Signed-off-by: David S. Miller --- diff --git a/drivers/net/phy/sfp.c b/drivers/net/phy/sfp.c index bdbbb76f8fd3..c118d9f0195b 100644 --- a/drivers/net/phy/sfp.c +++ b/drivers/net/phy/sfp.c @@ -2294,6 +2294,10 @@ static int sfp_remove(struct platform_device *pdev) sfp_unregister_socket(sfp->sfp_bus); + rtnl_lock(); + sfp_sm_event(sfp, SFP_E_REMOVE); + rtnl_unlock(); + return 0; }