One other thing could be to rely on phylink to handle that ? It's the
one part of the net stack that already handles PHY devices suddenly
disappearing, with the SFP case. It has all the logic in place to
maintain the netdev's phydev pointer without the MAC driver having to
deal with that.
We might want to consider the different use cases.
1) Hot pluggable hardware, and it disappears. As you say, phylink can
handle this.
2) Root unbinds the device, while it is in use, for hardware which is
only cold pluggable? Cannot we just consider this a foot gun?
Exploding is O.K?
Is there a good use case for root unbinding the PHY driver? We should
only add complexity if there is a good use case.
Andrew