1 Commit-Id: 74bf4ba3d367aacbc04fef167289767f162cd730
2 From: Michael Chan <mchan@broadcom.com>
3 Date: Thu, 9 Oct 2008 12:21:08 -0700
4 Acked-by: Karsten Keil <kkeil@novell.com>
5 Subject: [PATCH] bnx2: Add bnx2_shutdown_chip().
8 This logic is used in bnx2_close() and bnx2_suspend() and
9 so should be separated out into a separate function.
11 Signed-off-by: Michael Chan <mchan@broadcom.com>
12 Signed-off-by: Benjamin Li <benli@broadcom.com>
13 Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
14 Signed-off-by: David S. Miller <davem@davemloft.net>
17 drivers/net/bnx2.c | 33 +++++++++++++++++----------------
18 1 file changed, 17 insertions(+), 16 deletions(-)
20 --- a/drivers/net/bnx2.c
21 +++ b/drivers/net/bnx2.c
22 @@ -5077,6 +5077,21 @@ bnx2_init_nic(struct bnx2 *bp, int reset
26 +bnx2_shutdown_chip(struct bnx2 *bp)
30 + if (bp->flags & BNX2_FLAG_NO_WOL)
31 + reset_code = BNX2_DRV_MSG_CODE_UNLOAD_LNK_DN;
33 + reset_code = BNX2_DRV_MSG_CODE_SUSPEND_WOL;
35 + reset_code = BNX2_DRV_MSG_CODE_SUSPEND_NO_WOL;
37 + return bnx2_reset_chip(bp, reset_code);
41 bnx2_test_registers(struct bnx2 *bp)
44 @@ -6099,20 +6114,13 @@ static int
45 bnx2_close(struct net_device *dev)
47 struct bnx2 *bp = netdev_priv(dev);
50 cancel_work_sync(&bp->reset_task);
52 bnx2_disable_int_sync(bp);
53 bnx2_napi_disable(bp);
54 del_timer_sync(&bp->timer);
55 - if (bp->flags & BNX2_FLAG_NO_WOL)
56 - reset_code = BNX2_DRV_MSG_CODE_UNLOAD_LNK_DN;
58 - reset_code = BNX2_DRV_MSG_CODE_SUSPEND_WOL;
60 - reset_code = BNX2_DRV_MSG_CODE_SUSPEND_NO_WOL;
61 - bnx2_reset_chip(bp, reset_code);
62 + bnx2_shutdown_chip(bp);
66 @@ -7783,7 +7791,6 @@ bnx2_suspend(struct pci_dev *pdev, pm_me
68 struct net_device *dev = pci_get_drvdata(pdev);
69 struct bnx2 *bp = netdev_priv(dev);
72 /* PCI register 4 needs to be saved whether netif_running() or not.
73 * MSI address and data need to be saved if using MSI and
74 @@ -7797,13 +7804,7 @@ bnx2_suspend(struct pci_dev *pdev, pm_me
76 netif_device_detach(dev);
77 del_timer_sync(&bp->timer);
78 - if (bp->flags & BNX2_FLAG_NO_WOL)
79 - reset_code = BNX2_DRV_MSG_CODE_UNLOAD_LNK_DN;
81 - reset_code = BNX2_DRV_MSG_CODE_SUSPEND_WOL;
83 - reset_code = BNX2_DRV_MSG_CODE_SUSPEND_NO_WOL;
84 - bnx2_reset_chip(bp, reset_code);
85 + bnx2_shutdown_chip(bp);
87 bnx2_set_power_state(bp, pci_choose_state(pdev, state));