diff options
author | Len Brown <len.brown@intel.com> | 2005-07-29 23:31:17 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2005-07-29 23:31:17 -0400 |
commit | d6ac1a7910d22626bc77e73db091e00b810715f4 (patch) | |
tree | c8f235b7287056a03bc2bc032902469a331b5e56 /drivers/net/sk98lin | |
parent | 577a4f8102d54b504cb22eb021b89e957e8df18f (diff) | |
parent | 87bec66b9691522414862dd8d41e430b063735ef (diff) |
/home/lenb/src/to-linus branch 'acpi-2.6.12'
Diffstat (limited to 'drivers/net/sk98lin')
-rw-r--r-- | drivers/net/sk98lin/skge.c | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/drivers/net/sk98lin/skge.c b/drivers/net/sk98lin/skge.c index 82570ec44d8e..074521a36341 100644 --- a/drivers/net/sk98lin/skge.c +++ b/drivers/net/sk98lin/skge.c @@ -5133,6 +5133,67 @@ static void __devexit skge_remove_one(struct pci_dev *pdev) kfree(pAC); } +#ifdef CONFIG_PM +static int skge_suspend(struct pci_dev *pdev, pm_message_t state) +{ + struct net_device *dev = pci_get_drvdata(pdev); + DEV_NET *pNet = netdev_priv(dev); + SK_AC *pAC = pNet->pAC; + struct net_device *otherdev = pAC->dev[1]; + + if (pNet->Up) { + pAC->WasIfUp[0] = SK_TRUE; + DoPrintInterfaceChange = SK_FALSE; + SkDrvDeInitAdapter(pAC, 0); /* performs SkGeClose */ + } + if (otherdev != dev) { + pNet = netdev_priv(otherdev); + if (pNet->Up) { + pAC->WasIfUp[1] = SK_TRUE; + DoPrintInterfaceChange = SK_FALSE; + SkDrvDeInitAdapter(pAC, 1); /* performs SkGeClose */ + } + } + + pci_save_state(pdev); + pci_enable_wake(pdev, pci_choose_state(pdev, state), 0); + if (pAC->AllocFlag & SK_ALLOC_IRQ) { + free_irq(dev->irq, dev); + } + pci_disable_device(pdev); + pci_set_power_state(pdev, pci_choose_state(pdev, state)); + + return 0; +} + +static int skge_resume(struct pci_dev *pdev) +{ + struct net_device *dev = pci_get_drvdata(pdev); + DEV_NET *pNet = netdev_priv(dev); + SK_AC *pAC = pNet->pAC; + + pci_set_power_state(pdev, PCI_D0); + pci_restore_state(pdev); + pci_enable_device(pdev); + pci_set_master(pdev); + if (pAC->GIni.GIMacsFound == 2) + request_irq(dev->irq, SkGeIsr, SA_SHIRQ, pAC->Name, dev); + else + request_irq(dev->irq, SkGeIsrOnePort, SA_SHIRQ, pAC->Name, dev); + + if (pAC->WasIfUp[0] == SK_TRUE) { + DoPrintInterfaceChange = SK_FALSE; + SkDrvInitAdapter(pAC, 0); /* first device */ + } + if (pAC->dev[1] != dev && pAC->WasIfUp[1] == SK_TRUE) { + DoPrintInterfaceChange = SK_FALSE; + SkDrvInitAdapter(pAC, 1); /* first device */ + } + + return 0; +} +#endif + static struct pci_device_id skge_pci_tbl[] = { { PCI_VENDOR_ID_3COM, 0x1700, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, { PCI_VENDOR_ID_3COM, 0x80eb, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, @@ -5158,6 +5219,8 @@ static struct pci_driver skge_driver = { .id_table = skge_pci_tbl, .probe = skge_probe_one, .remove = __devexit_p(skge_remove_one), + .suspend = skge_suspend, + .resume = skge_resume, }; static int __init skge_init(void) |