aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sk98lin/skge.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/sk98lin/skge.c')
-rw-r--r--drivers/net/sk98lin/skge.c77
1 files changed, 77 insertions, 0 deletions
diff --git a/drivers/net/sk98lin/skge.c b/drivers/net/sk98lin/skge.c
index 82570ec44d8e..49bd8c7c3f7d 100644
--- a/drivers/net/sk98lin/skge.c
+++ b/drivers/net/sk98lin/skge.c
@@ -5133,6 +5133,81 @@ static void __devexit skge_remove_one(struct pci_dev *pdev)
5133 kfree(pAC); 5133 kfree(pAC);
5134} 5134}
5135 5135
5136#ifdef CONFIG_PM
5137static int skge_suspend(struct pci_dev *pdev, pm_message_t state)
5138{
5139 struct net_device *dev = pci_get_drvdata(pdev);
5140 DEV_NET *pNet = netdev_priv(dev);
5141 SK_AC *pAC = pNet->pAC;
5142 struct net_device *otherdev = pAC->dev[1];
5143
5144 if (netif_running(dev)) {
5145 netif_carrier_off(dev);
5146 DoPrintInterfaceChange = SK_FALSE;
5147 SkDrvDeInitAdapter(pAC, 0); /* performs SkGeClose */
5148 netif_device_detach(dev);
5149 }
5150 if (otherdev != dev) {
5151 if (netif_running(otherdev)) {
5152 netif_carrier_off(otherdev);
5153 DoPrintInterfaceChange = SK_FALSE;
5154 SkDrvDeInitAdapter(pAC, 1); /* performs SkGeClose */
5155 netif_device_detach(otherdev);
5156 }
5157 }
5158
5159 pci_save_state(pdev);
5160 pci_enable_wake(pdev, pci_choose_state(pdev, state), 0);
5161 if (pAC->AllocFlag & SK_ALLOC_IRQ) {
5162 free_irq(dev->irq, dev);
5163 }
5164 pci_disable_device(pdev);
5165 pci_set_power_state(pdev, pci_choose_state(pdev, state));
5166
5167 return 0;
5168}
5169
5170static int skge_resume(struct pci_dev *pdev)
5171{
5172 struct net_device *dev = pci_get_drvdata(pdev);
5173 DEV_NET *pNet = netdev_priv(dev);
5174 SK_AC *pAC = pNet->pAC;
5175 struct net_device *otherdev = pAC->dev[1];
5176 int ret;
5177
5178 pci_set_power_state(pdev, PCI_D0);
5179 pci_restore_state(pdev);
5180 pci_enable_device(pdev);
5181 pci_set_master(pdev);
5182 if (pAC->GIni.GIMacsFound == 2)
5183 ret = request_irq(dev->irq, SkGeIsr, SA_SHIRQ, pAC->Name, dev);
5184 else
5185 ret = request_irq(dev->irq, SkGeIsrOnePort, SA_SHIRQ, pAC->Name, dev);
5186 if (ret) {
5187 printk(KERN_WARNING "sk98lin: unable to acquire IRQ %d\n", dev->irq);
5188 pAC->AllocFlag &= ~SK_ALLOC_IRQ;
5189 dev->irq = 0;
5190 pci_disable_device(pdev);
5191 return -EBUSY;
5192 }
5193
5194 netif_device_attach(dev);
5195 if (netif_running(dev)) {
5196 DoPrintInterfaceChange = SK_FALSE;
5197 SkDrvInitAdapter(pAC, 0); /* first device */
5198 }
5199 if (otherdev != dev) {
5200 netif_device_attach(otherdev);
5201 if (netif_running(otherdev)) {
5202 DoPrintInterfaceChange = SK_FALSE;
5203 SkDrvInitAdapter(pAC, 1); /* second device */
5204 }
5205 }
5206
5207 return 0;
5208}
5209#endif
5210
5136static struct pci_device_id skge_pci_tbl[] = { 5211static struct pci_device_id skge_pci_tbl[] = {
5137 { PCI_VENDOR_ID_3COM, 0x1700, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, 5212 { PCI_VENDOR_ID_3COM, 0x1700, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
5138 { PCI_VENDOR_ID_3COM, 0x80eb, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, 5213 { PCI_VENDOR_ID_3COM, 0x80eb, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
@@ -5158,6 +5233,8 @@ static struct pci_driver skge_driver = {
5158 .id_table = skge_pci_tbl, 5233 .id_table = skge_pci_tbl,
5159 .probe = skge_probe_one, 5234 .probe = skge_probe_one,
5160 .remove = __devexit_p(skge_remove_one), 5235 .remove = __devexit_p(skge_remove_one),
5236 .suspend = skge_suspend,
5237 .resume = skge_resume,
5161}; 5238};
5162 5239
5163static int __init skge_init(void) 5240static int __init skge_init(void)