diff options
author | Adam Belay <ambx1@neo.rr.com> | 2005-06-20 14:28:41 -0700 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-06-27 00:46:40 -0400 |
commit | 1fe2cb32763457a829d33b38ec117ffe5c98e045 (patch) | |
tree | a0f083cb1e31898d3b5642d3b626043e3a8ee51e /drivers/net/tulip | |
parent | 05ab195c9803946931390faa6cfb714bd1c1e3dc (diff) |
[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: Karsten Keil <kkeil@suse.de>
Signed-off-by: Adam Belay <abelay@novell.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Diffstat (limited to 'drivers/net/tulip')
-rw-r--r-- | drivers/net/tulip/tulip_core.c | 43 |
1 files changed, 31 insertions, 12 deletions
diff --git a/drivers/net/tulip/tulip_core.c b/drivers/net/tulip/tulip_core.c index 7e1fafed6b2..08e0f80f89d 100644 --- a/drivers/net/tulip/tulip_core.c +++ b/drivers/net/tulip/tulip_core.c @@ -1757,11 +1757,19 @@ static int tulip_suspend (struct pci_dev *pdev, pm_message_t state) { struct net_device *dev = pci_get_drvdata(pdev); - if (dev && netif_running (dev) && netif_device_present (dev)) { - netif_device_detach (dev); - tulip_down (dev); - /* pci_power_off(pdev, -1); */ - } + if (!dev) + return -EINVAL; + + 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; } @@ -1769,15 +1777,26 @@ static int tulip_suspend (struct pci_dev *pdev, pm_message_t state) static int tulip_resume(struct pci_dev *pdev) { struct net_device *dev = pci_get_drvdata(pdev); + int retval; - if (dev && netif_running (dev) && !netif_device_present (dev)) { -#if 1 - pci_enable_device (pdev); -#endif - /* pci_power_on(pdev); */ - tulip_up (dev); - netif_device_attach (dev); + if (!dev) + return -EINVAL; + + pci_set_power_state(pdev, PCI_D0); + pci_restore_state(pdev); + + 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; } |