Re: [PATCH net-next RFC] net: Throw ASSERT_RTNL into phy_detach
From: Andrew Lunn
Date: Sat Jun 21 2025 - 03:49:22 EST
On Fri, Jun 20, 2025 at 04:33:27PM +0200, Kory Maincent wrote:
> phy_detach needs the rtnl lock to be held. It should have been added before
> to avoid this massive change among lots of net drivers but there was no
> clear evidence of such needs at that time. This imply a lock change in
> this API. Add phy_detach_rtnl, phy_diconnect_rtnl, phylink_connect_phy_rtnl
> and phylink_fwnode_phy_connect_rtnl helpers to take the lock before calling
> their respective function.
Did you count how many instances don't need to take the lock, because
it is already held? I'm just wondering if the opposite patch would be
smaller, making phy_detach() take RTNL, and add a new function which
does not.
Andrew