Skip to content

Commit

Permalink
gianfar: Do not call device_set_wakeup_enable() under a spinlock
Browse files Browse the repository at this point in the history
The gianfar driver calls device_set_wakeup_enable() under a spinlock,
which causes a problem to happen after the recent core power
management changes, because this function can sleep now.  Fix this
by moving the device_set_wakeup_enable() call out of the
spinlock-protected area.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
rjwysocki authored and davem330 committed Nov 12, 2010
1 parent 4038565 commit 6c4f199
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/net/gianfar_ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -635,9 +635,10 @@ static int gfar_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
if (wol->wolopts & ~WAKE_MAGIC)
return -EINVAL;

device_set_wakeup_enable(&dev->dev, wol->wolopts & WAKE_MAGIC);

spin_lock_irqsave(&priv->bflock, flags);
priv->wol_en = wol->wolopts & WAKE_MAGIC ? 1 : 0;
device_set_wakeup_enable(&dev->dev, priv->wol_en);
priv->wol_en = !!device_may_wakeup(&dev->dev);
spin_unlock_irqrestore(&priv->bflock, flags);

return 0;
Expand Down

0 comments on commit 6c4f199

Please sign in to comment.