netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 1/6] bnx2: Add bnx2_shutdown_chip().
@ 2008-10-09 17:16 Michael Chan
  2008-10-09 17:16 ` [PATCH net-next 2/6] bnx2: Check netif_running() in all ethtool operations Michael Chan
                   ` (5 more replies)
  0 siblings, 6 replies; 14+ messages in thread
From: Michael Chan @ 2008-10-09 17:16 UTC (permalink / raw)
  To: davem; +Cc: netdev, Michael Chan, Benjamin Li, Matt Carlson

This logic is used in bnx2_close() and bnx2_suspend() and
so should be separated out into a separate function.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: Benjamin Li <benli@broadcom.com>
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
---
 drivers/net/bnx2.c |   33 +++++++++++++++++----------------
 1 files changed, 17 insertions(+), 16 deletions(-)

diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index 883e0a7..b35f440 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -5073,6 +5073,21 @@ bnx2_init_nic(struct bnx2 *bp, int reset_phy)
 }
 
 static int
+bnx2_shutdown_chip(struct bnx2 *bp)
+{
+	u32 reset_code;
+
+	if (bp->flags & BNX2_FLAG_NO_WOL)
+		reset_code = BNX2_DRV_MSG_CODE_UNLOAD_LNK_DN;
+	else if (bp->wol)
+		reset_code = BNX2_DRV_MSG_CODE_SUSPEND_WOL;
+	else
+		reset_code = BNX2_DRV_MSG_CODE_SUSPEND_NO_WOL;
+
+	return bnx2_reset_chip(bp, reset_code);
+}
+
+static int
 bnx2_test_registers(struct bnx2 *bp)
 {
 	int ret;
@@ -6095,20 +6110,13 @@ static int
 bnx2_close(struct net_device *dev)
 {
 	struct bnx2 *bp = netdev_priv(dev);
-	u32 reset_code;
 
 	cancel_work_sync(&bp->reset_task);
 
 	bnx2_disable_int_sync(bp);
 	bnx2_napi_disable(bp);
 	del_timer_sync(&bp->timer);
-	if (bp->flags & BNX2_FLAG_NO_WOL)
-		reset_code = BNX2_DRV_MSG_CODE_UNLOAD_LNK_DN;
-	else if (bp->wol)
-		reset_code = BNX2_DRV_MSG_CODE_SUSPEND_WOL;
-	else
-		reset_code = BNX2_DRV_MSG_CODE_SUSPEND_NO_WOL;
-	bnx2_reset_chip(bp, reset_code);
+	bnx2_shutdown_chip(bp);
 	bnx2_free_irq(bp);
 	bnx2_free_skbs(bp);
 	bnx2_free_mem(bp);
@@ -7777,7 +7785,6 @@ bnx2_suspend(struct pci_dev *pdev, pm_message_t state)
 {
 	struct net_device *dev = pci_get_drvdata(pdev);
 	struct bnx2 *bp = netdev_priv(dev);
-	u32 reset_code;
 
 	/* PCI register 4 needs to be saved whether netif_running() or not.
 	 * MSI address and data need to be saved if using MSI and
@@ -7791,13 +7798,7 @@ bnx2_suspend(struct pci_dev *pdev, pm_message_t state)
 	bnx2_netif_stop(bp);
 	netif_device_detach(dev);
 	del_timer_sync(&bp->timer);
-	if (bp->flags & BNX2_FLAG_NO_WOL)
-		reset_code = BNX2_DRV_MSG_CODE_UNLOAD_LNK_DN;
-	else if (bp->wol)
-		reset_code = BNX2_DRV_MSG_CODE_SUSPEND_WOL;
-	else
-		reset_code = BNX2_DRV_MSG_CODE_SUSPEND_NO_WOL;
-	bnx2_reset_chip(bp, reset_code);
+	bnx2_shutdown_chip(bp);
 	bnx2_free_skbs(bp);
 	bnx2_set_power_state(bp, pci_choose_state(pdev, state));
 	return 0;
-- 
1.5.6.GIT



^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2008-10-09 21:26 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-09 17:16 [PATCH net-next 1/6] bnx2: Add bnx2_shutdown_chip() Michael Chan
2008-10-09 17:16 ` [PATCH net-next 2/6] bnx2: Check netif_running() in all ethtool operations Michael Chan
2008-10-09 19:22   ` David Miller
2008-10-09 20:59     ` Michael Chan
2008-10-09 21:26       ` David Miller
2008-10-09 17:16 ` [PATCH net-next 4/6] bnx2: Eliminate TSO header modifications Michael Chan
2008-10-09 19:25   ` David Miller
2008-10-09 20:56     ` Michael Chan
2008-10-09 17:16 ` [PATCH net-next 5/6] bnx2: Handle DMA mapping errors Michael Chan
2008-10-09 19:26   ` David Miller
2008-10-09 17:16 ` [PATCH net-next 6/6] bnx2: Update version to 1.8.1 Michael Chan
2008-10-09 19:27   ` David Miller
2008-10-09 19:21 ` [PATCH net-next 1/6] bnx2: Add bnx2_shutdown_chip() David Miller
     [not found] ` <1223572568-1298-3-git-send-email-mchan@broadcom.com>
2008-10-09 19:23   ` [PATCH net-next 3/6] bnx2: Update 5706/5708 firmware David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).