The stmmac driver will try to acquire its private mutex during suspend
via phylink_resolve() -> stmmac_mac_link_down() -> stmmac_eee_init().
However, the phylink configuration is updated with the private mutex
held already, which causes a deadlock during suspend.
Fix this by moving the phylink configuration updates out of the region
of code protected by the private mutex.
Fixes:
19e13cb27b99 ("net: stmmac: Hold rtnl lock in suspend/resume callbacks")
Suggested-by: Bitan Biswas <bbiswas@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
if (!ndev || !netif_running(ndev))
return 0;
if (!ndev || !netif_running(ndev))
return 0;
- mutex_lock(&priv->lock);
-
phylink_mac_change(priv->phylink, false);
phylink_mac_change(priv->phylink, false);
+ mutex_lock(&priv->lock);
+
netif_device_detach(ndev);
stmmac_stop_all_queues(priv);
netif_device_detach(ndev);
stmmac_stop_all_queues(priv);
stmmac_pmt(priv, priv->hw, priv->wolopts);
priv->irq_wake = 1;
} else {
stmmac_pmt(priv, priv->hw, priv->wolopts);
priv->irq_wake = 1;
} else {
+ mutex_unlock(&priv->lock);
rtnl_lock();
phylink_stop(priv->phylink);
rtnl_unlock();
rtnl_lock();
phylink_stop(priv->phylink);
rtnl_unlock();
+ mutex_lock(&priv->lock);
stmmac_mac_set(priv, priv->ioaddr, false);
pinctrl_pm_select_sleep_state(priv->device);
stmmac_mac_set(priv, priv->ioaddr, false);
pinctrl_pm_select_sleep_state(priv->device);
stmmac_start_all_queues(priv);
stmmac_start_all_queues(priv);
+ mutex_unlock(&priv->lock);
+
if (!device_may_wakeup(priv->device)) {
rtnl_lock();
phylink_start(priv->phylink);
if (!device_may_wakeup(priv->device)) {
rtnl_lock();
phylink_start(priv->phylink);
phylink_mac_change(priv->phylink, true);
phylink_mac_change(priv->phylink, true);
- mutex_unlock(&priv->lock);
-
return 0;
}
EXPORT_SYMBOL_GPL(stmmac_resume);
return 0;
}
EXPORT_SYMBOL_GPL(stmmac_resume);