]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
gianfar: Do not call device_set_wakeup_enable() under a spinlock
authorRafael J. Wysocki <rjw@sisk.pl>
Tue, 9 Nov 2010 11:54:19 +0000 (11:54 +0000)
committerDavid S. Miller <davem@davemloft.net>
Fri, 12 Nov 2010 22:05:43 +0000 (14:05 -0800)
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>
drivers/net/gianfar_ethtool.c

index 5c566ebc54b80f7da56a4cdf71b68368065c864f..3bc8e276ba4d713370f86af90d7b4b1b22209dfb 100644 (file)
@@ -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;