Hello. On 06/16/2016 06:54 PM, Jeremy Linton wrote:
Previously the mdio and phy's were started in the drv probe following register_netdev(). This could lead to a situation where if the netdev was opened before the mdio/phys were configured, it would fail with a EAGAIN. Also, the use of phy_connect_direct() in the drv_probe routine results in a situation where the module use count would never decrease sufficiently to unload the driver.
It's a bad idea to fix 2 issues with one patch (unless they are caused by the same reason). "Do one thing per patch" is a rule of thumb here...
With this patch the mdio bus is allocated/configured before register_netdev(), and the phy's are brought online/started in the ndo_open and stopped in the ndo_stop. Because of this, the behavior of ethtool changes a little if the interface is stopped. Before the phy's would remain up, and their last state would be displayed with ethtool. Now ethtool reports link has been severed/Link detected: no when the net dev is stopped. Signed-off-by: Jeremy Linton <jeremy.lin...@arm.com>[...]
[...] MBR, Sergei