aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDon Fry <pcnet32@verizon.net>2007-08-27 00:22:32 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:50:41 -0400
commit917270c6ed7a99d4300ce57508246813ea8613b0 (patch)
treed851add6c30692afd7d685d90d7caaf6c25b96cb /drivers
parenta11a6544c0bf6c0871f2379ad0c5ad0210691e73 (diff)
pcnet32: add suspend and resume capability
Add suspend and resume capability to the driver. Tested both to ram and to disk on x86_64 platform. Signed-off-by: Don Fry <pcnet32@verizon.net> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/pcnet32.c35
1 files changed, 32 insertions, 3 deletions
diff --git a/drivers/net/pcnet32.c b/drivers/net/pcnet32.c
index a9973490dba9..db87429b956f 100644
--- a/drivers/net/pcnet32.c
+++ b/drivers/net/pcnet32.c
@@ -23,11 +23,11 @@
23 23
24#define DRV_NAME "pcnet32" 24#define DRV_NAME "pcnet32"
25#ifdef CONFIG_PCNET32_NAPI 25#ifdef CONFIG_PCNET32_NAPI
26#define DRV_VERSION "1.33-NAPI" 26#define DRV_VERSION "1.34-NAPI"
27#else 27#else
28#define DRV_VERSION "1.33" 28#define DRV_VERSION "1.34"
29#endif 29#endif
30#define DRV_RELDATE "27.Jun.2006" 30#define DRV_RELDATE "14.Aug.2007"
31#define PFX DRV_NAME ": " 31#define PFX DRV_NAME ": "
32 32
33static const char *const version = 33static const char *const version =
@@ -2955,6 +2955,33 @@ static void pcnet32_watchdog(struct net_device *dev)
2955 mod_timer(&(lp->watchdog_timer), PCNET32_WATCHDOG_TIMEOUT); 2955 mod_timer(&(lp->watchdog_timer), PCNET32_WATCHDOG_TIMEOUT);
2956} 2956}
2957 2957
2958static int pcnet32_pm_suspend(struct pci_dev *pdev, pm_message_t state)
2959{
2960 struct net_device *dev = pci_get_drvdata(pdev);
2961
2962 if (netif_running(dev)) {
2963 netif_device_detach(dev);
2964 pcnet32_close(dev);
2965 }
2966 pci_save_state(pdev);
2967 pci_set_power_state(pdev, pci_choose_state(pdev, state));
2968 return 0;
2969}
2970
2971static int pcnet32_pm_resume(struct pci_dev *pdev)
2972{
2973 struct net_device *dev = pci_get_drvdata(pdev);
2974
2975 pci_set_power_state(pdev, PCI_D0);
2976 pci_restore_state(pdev);
2977
2978 if (netif_running(dev)) {
2979 pcnet32_open(dev);
2980 netif_device_attach(dev);
2981 }
2982 return 0;
2983}
2984
2958static void __devexit pcnet32_remove_one(struct pci_dev *pdev) 2985static void __devexit pcnet32_remove_one(struct pci_dev *pdev)
2959{ 2986{
2960 struct net_device *dev = pci_get_drvdata(pdev); 2987 struct net_device *dev = pci_get_drvdata(pdev);
@@ -2978,6 +3005,8 @@ static struct pci_driver pcnet32_driver = {
2978 .probe = pcnet32_probe_pci, 3005 .probe = pcnet32_probe_pci,
2979 .remove = __devexit_p(pcnet32_remove_one), 3006 .remove = __devexit_p(pcnet32_remove_one),
2980 .id_table = pcnet32_pci_tbl, 3007 .id_table = pcnet32_pci_tbl,
3008 .suspend = pcnet32_pm_suspend,
3009 .resume = pcnet32_pm_resume,
2981}; 3010};
2982 3011
2983/* An additional parameter that may be passed in... */ 3012/* An additional parameter that may be passed in... */