diff options
| author | Matt Carlson <mcarlson@broadcom.com> | 2008-08-05 02:17:34 -0400 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2008-08-05 02:18:20 -0400 |
| commit | 2f751b67a8be698cec52f786910ef4f0beffe9a7 (patch) | |
| tree | ce1ea9366803f667e68dd57eaf70261aa65bd6a3 /drivers/net/tg3.c | |
| parent | cc6533e98a7f3cb7fce9d740da49195c7aa523a4 (diff) | |
tg3: Fix 'scheduling while atomic' errors
This patch fixes the 'scheduling while atomic' errors introduced by
commit 12dac0756d357325b107fe6ec24921ec38661839 ("tg3: adapt tg3 to
use reworked PCI PM code").
The first hunk of the patch removes an unnecessary
tg3_set_power_state() call. The chip will already be in the D0 state
either due to a chip reset or through a previous call to
tg3_set_power_state().
The second hunk of the patch moves the tg3_set_power_state() call
outside the critical section guarded by tg3_full_lock() and
tg3_full_unlock() functions. The power state of the device is and
should be outside the lock's domain and all other
tg3_set_power_state() calls support this.
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/tg3.c')
| -rw-r--r-- | drivers/net/tg3.c | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index 26aa37aa531..d2439b85a79 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c | |||
| @@ -7687,21 +7687,11 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy) | |||
| 7687 | */ | 7687 | */ |
| 7688 | static int tg3_init_hw(struct tg3 *tp, int reset_phy) | 7688 | static int tg3_init_hw(struct tg3 *tp, int reset_phy) |
| 7689 | { | 7689 | { |
| 7690 | int err; | ||
| 7691 | |||
| 7692 | /* Force the chip into D0. */ | ||
| 7693 | err = tg3_set_power_state(tp, PCI_D0); | ||
| 7694 | if (err) | ||
| 7695 | goto out; | ||
| 7696 | |||
| 7697 | tg3_switch_clocks(tp); | 7690 | tg3_switch_clocks(tp); |
| 7698 | 7691 | ||
| 7699 | tw32(TG3PCI_MEM_WIN_BASE_ADDR, 0); | 7692 | tw32(TG3PCI_MEM_WIN_BASE_ADDR, 0); |
| 7700 | 7693 | ||
| 7701 | err = tg3_reset_hw(tp, reset_phy); | 7694 | return tg3_reset_hw(tp, reset_phy); |
| 7702 | |||
| 7703 | out: | ||
| 7704 | return err; | ||
| 7705 | } | 7695 | } |
| 7706 | 7696 | ||
| 7707 | #define TG3_STAT_ADD32(PSTAT, REG) \ | 7697 | #define TG3_STAT_ADD32(PSTAT, REG) \ |
| @@ -8016,13 +8006,11 @@ static int tg3_open(struct net_device *dev) | |||
| 8016 | 8006 | ||
| 8017 | netif_carrier_off(tp->dev); | 8007 | netif_carrier_off(tp->dev); |
| 8018 | 8008 | ||
| 8019 | tg3_full_lock(tp, 0); | ||
| 8020 | |||
| 8021 | err = tg3_set_power_state(tp, PCI_D0); | 8009 | err = tg3_set_power_state(tp, PCI_D0); |
| 8022 | if (err) { | 8010 | if (err) |
| 8023 | tg3_full_unlock(tp); | ||
| 8024 | return err; | 8011 | return err; |
| 8025 | } | 8012 | |
| 8013 | tg3_full_lock(tp, 0); | ||
| 8026 | 8014 | ||
| 8027 | tg3_disable_ints(tp); | 8015 | tg3_disable_ints(tp); |
| 8028 | tp->tg3_flags &= ~TG3_FLAG_INIT_COMPLETE; | 8016 | tp->tg3_flags &= ~TG3_FLAG_INIT_COMPLETE; |
