提交 1fe2cb32 编写于 作者: A Adam Belay 提交者: Jeff Garzik

[PATCH] fix tulip suspend/resume #2

This patch allows the tulip driver to suspend and resume properly.  It was
originally written by Karsten Keil and then modified by Adam Belay.
Signed-off-by: NKarsten Keil <kkeil@suse.de>
Signed-off-by: NAdam Belay <abelay@novell.com>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
上级 05ab195c
...@@ -1757,11 +1757,19 @@ static int tulip_suspend (struct pci_dev *pdev, pm_message_t state) ...@@ -1757,11 +1757,19 @@ static int tulip_suspend (struct pci_dev *pdev, pm_message_t state)
{ {
struct net_device *dev = pci_get_drvdata(pdev); struct net_device *dev = pci_get_drvdata(pdev);
if (dev && netif_running (dev) && netif_device_present (dev)) { if (!dev)
netif_device_detach (dev); return -EINVAL;
tulip_down (dev);
/* pci_power_off(pdev, -1); */ if (netif_running(dev))
} tulip_down(dev);
netif_device_detach(dev);
free_irq(dev->irq, dev);
pci_save_state(pdev);
pci_disable_device(pdev);
pci_set_power_state(pdev, pci_choose_state(pdev, state));
return 0; return 0;
} }
...@@ -1769,15 +1777,26 @@ static int tulip_suspend (struct pci_dev *pdev, pm_message_t state) ...@@ -1769,15 +1777,26 @@ static int tulip_suspend (struct pci_dev *pdev, pm_message_t state)
static int tulip_resume(struct pci_dev *pdev) static int tulip_resume(struct pci_dev *pdev)
{ {
struct net_device *dev = pci_get_drvdata(pdev); struct net_device *dev = pci_get_drvdata(pdev);
int retval;
if (dev && netif_running (dev) && !netif_device_present (dev)) { if (!dev)
#if 1 return -EINVAL;
pci_enable_device (pdev);
#endif pci_set_power_state(pdev, PCI_D0);
/* pci_power_on(pdev); */ pci_restore_state(pdev);
tulip_up (dev);
netif_device_attach (dev); pci_enable_device(pdev);
if ((retval = request_irq(dev->irq, &tulip_interrupt, SA_SHIRQ, dev->name, dev))) {
printk (KERN_ERR "tulip: request_irq failed in resume\n");
return retval;
} }
netif_device_attach(dev);
if (netif_running(dev))
tulip_up(dev);
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册