]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/patches/suse-2.6.27.25/patches.drivers/bnx2-Add-bnx2_shutdown_chip
Changed checkfs to auto reboot after correctable fsck fixes.
[people/pmueller/ipfire-2.x.git] / src / patches / suse-2.6.27.25 / patches.drivers / bnx2-Add-bnx2_shutdown_chip
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().
6 Reference: bnc#440052
7
8 This logic is used in bnx2_close() and bnx2_suspend() and
9 so should be separated out into a separate function.
10
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>
15
16 ---
17 drivers/net/bnx2.c | 33 +++++++++++++++++----------------
18 1 file changed, 17 insertions(+), 16 deletions(-)
19
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
23 }
24
25 static int
26 +bnx2_shutdown_chip(struct bnx2 *bp)
27 +{
28 + u32 reset_code;
29 +
30 + if (bp->flags & BNX2_FLAG_NO_WOL)
31 + reset_code = BNX2_DRV_MSG_CODE_UNLOAD_LNK_DN;
32 + else if (bp->wol)
33 + reset_code = BNX2_DRV_MSG_CODE_SUSPEND_WOL;
34 + else
35 + reset_code = BNX2_DRV_MSG_CODE_SUSPEND_NO_WOL;
36 +
37 + return bnx2_reset_chip(bp, reset_code);
38 +}
39 +
40 +static int
41 bnx2_test_registers(struct bnx2 *bp)
42 {
43 int ret;
44 @@ -6099,20 +6114,13 @@ static int
45 bnx2_close(struct net_device *dev)
46 {
47 struct bnx2 *bp = netdev_priv(dev);
48 - u32 reset_code;
49
50 cancel_work_sync(&bp->reset_task);
51
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;
57 - else if (bp->wol)
58 - reset_code = BNX2_DRV_MSG_CODE_SUSPEND_WOL;
59 - else
60 - reset_code = BNX2_DRV_MSG_CODE_SUSPEND_NO_WOL;
61 - bnx2_reset_chip(bp, reset_code);
62 + bnx2_shutdown_chip(bp);
63 bnx2_free_irq(bp);
64 bnx2_free_skbs(bp);
65 bnx2_free_mem(bp);
66 @@ -7783,7 +7791,6 @@ bnx2_suspend(struct pci_dev *pdev, pm_me
67 {
68 struct net_device *dev = pci_get_drvdata(pdev);
69 struct bnx2 *bp = netdev_priv(dev);
70 - u32 reset_code;
71
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
75 bnx2_netif_stop(bp);
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;
80 - else if (bp->wol)
81 - reset_code = BNX2_DRV_MSG_CODE_SUSPEND_WOL;
82 - else
83 - reset_code = BNX2_DRV_MSG_CODE_SUSPEND_NO_WOL;
84 - bnx2_reset_chip(bp, reset_code);
85 + bnx2_shutdown_chip(bp);
86 bnx2_free_skbs(bp);
87 bnx2_set_power_state(bp, pci_choose_state(pdev, state));
88 return 0;