Skip to content

Commit f2dc0d1

Browse files
rjwysockidavem330
authored andcommitted
tg3: Do not call device_set_wakeup_enable() under spin_lock_bh
The tg3 driver calls device_set_wakeup_enable() under spin_lock_bh, 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 spin_lock_bh-protected area. Reported-by: Maxim Levitsky <maximlevitsky@gmail.com> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 78fd9c4 commit f2dc0d1

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

‎drivers/net/tg3.c‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9948,16 +9948,16 @@ static int tg3_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
99489948
!((tp->tg3_flags & TG3_FLAG_WOL_CAP) && device_can_wakeup(dp)))
99499949
return -EINVAL;
99509950

9951+
device_set_wakeup_enable(dp, wol->wolopts & WAKE_MAGIC);
9952+
99519953
spin_lock_bh(&tp->lock);
9952-
if (wol->wolopts & WAKE_MAGIC) {
9954+
if (device_may_wakeup(dp))
99539955
tp->tg3_flags |= TG3_FLAG_WOL_ENABLE;
9954-
device_set_wakeup_enable(dp, true);
9955-
} else {
9956+
else
99569957
tp->tg3_flags &= ~TG3_FLAG_WOL_ENABLE;
9957-
device_set_wakeup_enable(dp, false);
9958-
}
99599958
spin_unlock_bh(&tp->lock);
99609959

9960+
99619961
return 0;
99629962
}
99639963

0 commit comments

Comments
 (0)