Am 03.02.2018 um 21:17 schrieb Andrew Lunn: > On Sat, Feb 03, 2018 at 05:41:54PM +0100, Heiner Kallweit wrote: >> This commit forces callers of phy_resume() and phy_suspend() to hold >> mutex phydev->lock. This was done for calls to phy_resume() and >> phy_suspend() in phylib, however there are more callers in network >> drivers. I'd assume that these other calls issue a warning now >> because of the lock not being held. >> So is there something I miss or would this have to be fixed? > > Hi Heiner > > This is a good point. > > Yes, it looks like some fixes are needed. But what exactly? > > The phy state machine will suspend and resume the phy is you call > phy_stop() and phy_start() in the MAC suspend and resume functions. > AFAICS phy_stop() doesn't suspend the PHY. It just sets the state to PHY_HALTED and (at least if we're not in polling mode) doesn't call phy_suspend(). Maybe a call to phy_trigger_machine() is needed like in phy_start() ? Then the state machine would call phy_suspend(), provided the link is still up.
However, if the link is down already (due to whatever calls around phy_stop() in the driver) then phy_suspend() wouldn't be called. Heiner > A few examples: > > tc35815_suspend(), ravb_suspend() via ravb_close(), sh_eth_suspend() > via sh_eth_close(), fec_suspend(), mpc52xx_fec_of_suspend() via > mpc52xx_fec_close(), ucc_geth_suspend(), etc... > > So i suspect those drivers which call phy_suspend()/phy_resume() > should really be modified to call phy_stop()/phy_start(). > > hns_nic_config_phy_loopback() is just funky, and probably needs the > help of the hns guys to fix. > > dsa_slave_suspend() already does a phy_stop(), so the phy_suspend() > can be removed. > > The comments in lpc_eth_open() suggest the phy_resume() is needed, so > locks should be added. socfpga_dwmac_resume() seems to be the same. > > Andrew >