aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bnx2x_main.c
diff options
context:
space:
mode:
authorVladislav Zolotarov <vladz@broadcom.com>2010-04-18 21:14:49 -0400
committerDavid S. Miller <davem@davemloft.net>2010-04-19 16:17:11 -0400
commitd3dbfee0d5ee4690824cbc5685bc9fe47a12bb8b (patch)
treed4d76caef114b9c4291c3929b41e3552425d84f3 /drivers/net/bnx2x_main.c
parent8eb5a20ccc67d85d52ead88fb263eb28814ca2b4 (diff)
bnx2x: Rework power state handling code
Move "don't shut down the power" logic into bnx2x_set_power_state() to make the code cleaner. Signed-off-by: Vladislav Zolotarov <vladz@broadcom.com> Signed-off-by: Eilon Greenstein <eilong@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bnx2x_main.c')
-rw-r--r--drivers/net/bnx2x_main.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/net/bnx2x_main.c b/drivers/net/bnx2x_main.c
index d7c00748e27..c4bc006f510 100644
--- a/drivers/net/bnx2x_main.c
+++ b/drivers/net/bnx2x_main.c
@@ -11935,6 +11935,14 @@ static int bnx2x_set_power_state(struct bnx2x *bp, pci_power_t state)
11935 break; 11935 break;
11936 11936
11937 case PCI_D3hot: 11937 case PCI_D3hot:
11938 /* If there are other clients above don't
11939 shut down the power */
11940 if (atomic_read(&bp->pdev->enable_cnt) != 1)
11941 return 0;
11942 /* Don't shut down the power for emulation and FPGA */
11943 if (CHIP_REV_IS_SLOW(bp))
11944 return 0;
11945
11938 pmcsr &= ~PCI_PM_CTRL_STATE_MASK; 11946 pmcsr &= ~PCI_PM_CTRL_STATE_MASK;
11939 pmcsr |= 3; 11947 pmcsr |= 3;
11940 11948
@@ -12551,9 +12559,7 @@ static int bnx2x_close(struct net_device *dev)
12551 12559
12552 /* Unload the driver, release IRQs */ 12560 /* Unload the driver, release IRQs */
12553 bnx2x_nic_unload(bp, UNLOAD_CLOSE); 12561 bnx2x_nic_unload(bp, UNLOAD_CLOSE);
12554 if (atomic_read(&bp->pdev->enable_cnt) == 1) 12562 bnx2x_set_power_state(bp, PCI_D3hot);
12555 if (!CHIP_REV_IS_SLOW(bp))
12556 bnx2x_set_power_state(bp, PCI_D3hot);
12557 12563
12558 return 0; 12564 return 0;
12559} 12565}