Re: ordering of call to unbind() in usbnet_disconnect
From: Andrew Lunn <andrew@lunn.ch>
Date: 2022-03-14 19:14:49
On Mon, Mar 14, 2022 at 07:42:34PM +0100, Lukas Wunner wrote:
[cc += Heiner Kallweit, Andrew Lunn] On Thu, Mar 10, 2022 at 12:38:20PM +0100, Oleksij Rempel wrote:quoted
On Thu, Mar 10, 2022 at 12:25:08PM +0100, Oliver Neukum wrote:quoted
I got bug reports that 2c9d6c2b871d ("usbnet: run unbind() before unregister_netdev()") is causing regressions.I would like to see this reverted as well. For obvious reasons, the order in usbnet_disconnect() should be the inverse of usbnet_probe(). Since 2c9d6c2b871d, that's no longer the case.quoted
quoted
Rather than simply reverting it, it seems to me that the call needs to be split. One in the old place and one in the place you moved it to.I disagree. The commit message claims that the change is necessary because phy_disconnect() fails if called with phydev->attached_dev == NULL.
The only place i see which sets phydev->attached_dev is phy_attach_direct(). So if phydev->attached_dev is NULL, the PHY has not been attached, and hence there is no need to call phy_disconnect(). Andrew