net: stmmac: Hold rtnl lock in suspend/resume callbacks
We need to hold rnl lock in suspend and resume callbacks because phylink
requires it. Otherwise we will get a WARN() in suspend and resume.
Also, move phylink start and stop callbacks to inside device's internal
lock so that we prevent concurrent HW accesses.
Fixes: 74371272f9
("net: stmmac: Convert to phylink and remove phylib logic")
Reported-by: Christophe ROULLIER <christophe.roullier@st.com>
Tested-by: Christophe ROULLIER <christophe.roullier@st.com>
Signed-off-by: Jose Abreu <joabreu@synopsys.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
28e4860377
commit
19e13cb27b
@ -4451,10 +4451,12 @@ int stmmac_suspend(struct device *dev)
|
|||||||
if (!ndev || !netif_running(ndev))
|
if (!ndev || !netif_running(ndev))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
phylink_stop(priv->phylink);
|
|
||||||
|
|
||||||
mutex_lock(&priv->lock);
|
mutex_lock(&priv->lock);
|
||||||
|
|
||||||
|
rtnl_lock();
|
||||||
|
phylink_stop(priv->phylink);
|
||||||
|
rtnl_unlock();
|
||||||
|
|
||||||
netif_device_detach(ndev);
|
netif_device_detach(ndev);
|
||||||
stmmac_stop_all_queues(priv);
|
stmmac_stop_all_queues(priv);
|
||||||
|
|
||||||
@ -4558,9 +4560,11 @@ int stmmac_resume(struct device *dev)
|
|||||||
|
|
||||||
stmmac_start_all_queues(priv);
|
stmmac_start_all_queues(priv);
|
||||||
|
|
||||||
mutex_unlock(&priv->lock);
|
rtnl_lock();
|
||||||
|
|
||||||
phylink_start(priv->phylink);
|
phylink_start(priv->phylink);
|
||||||
|
rtnl_unlock();
|
||||||
|
|
||||||
|
mutex_unlock(&priv->lock);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user