[PATCH 23/26] atl1: update shutdown and remove functions

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: jacliburn
Date: Monday, December 31, 2007 - 7:00 pm

From: Jay Cliburn <jacliburn@bellsouth.net>

Update shutdown and remove functions to conform with the current vendor
driver version 1.2.40.2.

Signed-off-by: Jay Cliburn <jacliburn@bellsouth.net>
---
 drivers/net/atlx/atl1.c |   31 +++++++++++++++++++++++--------
 1 files changed, 23 insertions(+), 8 deletions(-)

diff --git a/drivers/net/atlx/atl1.c b/drivers/net/atlx/atl1.c
index f09928d..b89201e 100644
--- a/drivers/net/atlx/atl1.c
+++ b/drivers/net/atlx/atl1.c
@@ -2591,6 +2591,16 @@ static int atl1_close(struct net_device *netdev)
 	return 0;
 }
 
+static void atl1_force_ps(struct atl1_hw *hw)
+{
+	atl1_write_phy_reg(hw, MII_DBG_ADDR, 0);
+	atl1_write_phy_reg(hw, MII_DBG_DATA, 0x124E);
+	atl1_write_phy_reg(hw, MII_DBG_ADDR, 2);
+	atl1_write_phy_reg(hw, MII_DBG_DATA, 0x3000);
+	atl1_write_phy_reg(hw, MII_DBG_ADDR, 3);
+	atl1_write_phy_reg(hw, MII_DBG_DATA, 0);
+}
+
 #ifdef CONFIG_PM
 static int atl1_suspend(struct pci_dev *pdev, pm_message_t state)
 {
@@ -2878,12 +2888,7 @@ err_request_regions:
 static void __devexit atl1_remove(struct pci_dev *pdev)
 {
 	struct net_device *netdev = pci_get_drvdata(pdev);
-	struct atl1_adapter *adapter;
-	/* Device not available. Return. */
-	if (!netdev)
-		return;
-
-	adapter = netdev_priv(netdev);
+	struct atl1_adapter *adapter = netdev_priv(netdev);
 
 	/*
 	 * Some atl1 boards lack persistent storage for their MAC, and get it
@@ -2896,21 +2901,31 @@ static void __devexit atl1_remove(struct pci_dev *pdev)
 		atl1_set_mac_addr(&adapter->hw);
 	}
 
-	iowrite16(0, adapter->hw.hw_addr + REG_PHY_ENABLE);
+	set_bit(__ATL1_DOWN, &adapter->flags);
+	del_timer_sync(&adapter->watchdog_timer);
+	del_timer_sync(&adapter->phy_config_timer);
+	flush_scheduled_work();
 	unregister_netdev(netdev);
+	atl1_force_ps(&adapter->hw);
 	pci_iounmap(pdev, adapter->hw.hw_addr);
 	pci_release_regions(pdev);
 	free_netdev(netdev);
 	pci_disable_device(pdev);
 }
 
+static void atl1_shutdown(struct pci_dev *pdev)
+{
+	atl1_suspend(pdev, PMSG_SUSPEND);
+}
+
 static struct pci_driver atl1_driver = {
 	.name = ATLX_DRIVER_NAME,
 	.id_table = atl1_pci_tbl,
 	.probe = atl1_probe,
 	.remove = __devexit_p(atl1_remove),
 	.suspend = atl1_suspend,
-	.resume = atl1_resume
+	.resume = atl1_resume,
+	.shutdown = atl1_shutdown
 };
 
 /*
-- 
1.5.3.3

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 00/26] atl1: divide and modernize, jacliburn, (Mon Dec 31, 6:59 pm)
[PATCH 03/26] atl1: fix broken TSO, jacliburn, (Mon Dec 31, 6:59 pm)
[PATCH 04/26] atl1: add ethtool register dump, jacliburn, (Mon Dec 31, 6:59 pm)
[PATCH 05/26] atl1: print debug info if rrd error, jacliburn, (Mon Dec 31, 6:59 pm)
[PATCH 07/26] atl1: clarify max rx frame size, jacliburn, (Mon Dec 31, 6:59 pm)
[PATCH 09/26] atl1: refactor tx processing, jacliburn, (Mon Dec 31, 6:59 pm)
[PATCH 12/26] atl1: refactor atl1_probe, jacliburn, (Mon Dec 31, 6:59 pm)
[PATCH 13/26] atl1: refactor interrupt handling, jacliburn, (Mon Dec 31, 6:59 pm)
[PATCH 15/26] atl1: tidy up ring management, jacliburn, (Mon Dec 31, 6:59 pm)
[PATCH 16/26] atl1: modernize check link function, jacliburn, (Mon Dec 31, 6:59 pm)
[PATCH 17/26] atl1: update phy config function, jacliburn, (Mon Dec 31, 6:59 pm)
[PATCH 18/26] atl1: make function static, jacliburn, (Mon Dec 31, 6:59 pm)
[PATCH 19/26] atl1: modernize down/up functions, jacliburn, (Mon Dec 31, 6:59 pm)
[PATCH 20/26] atl1: update change mtu, jacliburn, (Mon Dec 31, 6:59 pm)
[PATCH 21/26] atl1: update atl1_close, jacliburn, (Mon Dec 31, 6:59 pm)
[PATCH 22/26] atl1: update netpoll, jacliburn, (Mon Dec 31, 7:00 pm)
[PATCH 23/26] atl1: update shutdown and remove functions, jacliburn, (Mon Dec 31, 7:00 pm)
[PATCH 24/26] atl1: update wake-on-lan, jacliburn, (Mon Dec 31, 7:00 pm)
[PATCH 25/26] atl1: add NAPI support, jacliburn, (Mon Dec 31, 7:00 pm)
Re: [PATCH 25/26] atl1: add NAPI support, Joonwoo Park, (Mon Dec 31, 11:09 pm)
Re: [PATCH 25/26] [REVISED] atl1: add NAPI support, Jay Cliburn, (Tue Jan 1, 11:15 am)
RE: [PATCH 25/26] [REVISED] atl1: add NAPI support, Joonwoo Park, (Tue Jan 1, 7:56 pm)
Re: [PATCH 25/26] [REVISED] atl1: add NAPI support, David Miller, (Tue Jan 1, 8:07 pm)
Re: [PATCH 04/26] atl1: add ethtool register dump, Jeff Garzik, (Tue Jan 22, 2:54 am)
Re: [PATCH 05/26] atl1: print debug info if rrd error, Jeff Garzik, (Tue Jan 22, 2:55 am)
Re: [PATCH 09/26] atl1: refactor tx processing, Jeff Garzik, (Tue Jan 22, 2:58 am)
Re: [PATCH 13/26] atl1: refactor interrupt handling, Jeff Garzik, (Tue Jan 22, 2:59 am)
Re: [PATCH 19/26] atl1: modernize down/up functions, Jeff Garzik, (Tue Jan 22, 3:01 am)
Re: [PATCH 09/26] atl1: refactor tx processing, Jay Cliburn, (Tue Jan 22, 5:31 pm)
Re: [PATCH 09/26] atl1: refactor tx processing, Jay Cliburn, (Thu Jan 24, 6:00 pm)
Re: [PATCH 09/26] atl1: refactor tx processing, Chris Snook, (Thu Jan 24, 6:08 pm)
Re: [PATCH 09/26] atl1: refactor tx processing, Jeff Garzik, (Thu Jan 24, 8:01 pm)