Skip to content

Commit

Permalink
stmmac: fix pm functions avoiding sleep on spinlock
Browse files Browse the repository at this point in the history
This patch fixes the pm functions to avoid the system
sleeps while a spinlock is taken.

Signed-off-by: Francesco Virlinzi <francesco.virlinzi@st.com>
Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Francesco Virlinzi authored and David S. Miller committed Nov 17, 2011
1 parent 989508b commit 102463b
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2011,12 +2011,13 @@ static int stmmac_suspend(struct device *dev)
if (!ndev || !netif_running(ndev))
return 0;

if (priv->phydev)
phy_stop(priv->phydev);

spin_lock(&priv->lock);

netif_device_detach(ndev);
netif_stop_queue(ndev);
if (priv->phydev)
phy_stop(priv->phydev);

#ifdef CONFIG_STMMAC_TIMER
priv->tm->timer_stop();
Expand Down Expand Up @@ -2074,12 +2075,13 @@ static int stmmac_resume(struct device *dev)
#endif
napi_enable(&priv->napi);

if (priv->phydev)
phy_start(priv->phydev);

netif_start_queue(ndev);

spin_unlock(&priv->lock);

if (priv->phydev)
phy_start(priv->phydev);

return 0;
}

Expand Down

0 comments on commit 102463b

Please sign in to comment.