diff options
author | Adam Belay <ambx1@neo.rr.com> | 2005-06-20 17:28:41 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-06-27 00:46:40 -0400 |
commit | 1fe2cb32763457a829d33b38ec117ffe5c98e045 (patch) | |
tree | a0f083cb1e31898d3b5642d3b626043e3a8ee51e | |
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>
-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 7e1fafed6b2d..08e0f80f89d5 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) | |||
1757 | { | 1757 | { |
1758 | struct net_device *dev = pci_get_drvdata(pdev); | 1758 | struct net_device *dev = pci_get_drvdata(pdev); |
1759 | 1759 | ||
1760 | if (dev && netif_running (dev) && netif_device_present (dev)) { | 1760 | if (!dev) |
1761 | netif_device_detach (dev); | 1761 | return -EINVAL; |
1762 | tulip_down (dev); | 1762 | |
1763 | /* pci_power_off(pdev, -1); */ | 1763 | if (netif_running(dev)) |
1764 | } | 1764 | tulip_down(dev); |
1765 | |||
1766 | netif_device_detach(dev); | ||
1767 | free_irq(dev->irq, dev); | ||
1768 | |||
1769 | pci_save_state(pdev); | ||
1770 | pci_disable_device(pdev); | ||
1771 | pci_set_power_state(pdev, pci_choose_state(pdev, state)); | ||
1772 | |||
1765 | return 0; | 1773 | return 0; |
1766 | } | 1774 | } |
1767 | 1775 | ||
@@ -1769,15 +1777,26 @@ static int tulip_suspend (struct pci_dev *pdev, pm_message_t state) | |||
1769 | static int tulip_resume(struct pci_dev *pdev) | 1777 | static int tulip_resume(struct pci_dev *pdev) |
1770 | { | 1778 | { |
1771 | struct net_device *dev = pci_get_drvdata(pdev); | 1779 | struct net_device *dev = pci_get_drvdata(pdev); |
1780 | int retval; | ||
1772 | 1781 | ||
1773 | if (dev && netif_running (dev) && !netif_device_present (dev)) { | 1782 | if (!dev) |
1774 | #if 1 | 1783 | return -EINVAL; |
1775 | pci_enable_device (pdev); | 1784 | |
1776 | #endif | 1785 | pci_set_power_state(pdev, PCI_D0); |
1777 | /* pci_power_on(pdev); */ | 1786 | pci_restore_state(pdev); |
1778 | tulip_up (dev); | 1787 | |
1779 | netif_device_attach (dev); | 1788 | pci_enable_device(pdev); |
1789 | |||
1790 | if ((retval = request_irq(dev->irq, &tulip_interrupt, SA_SHIRQ, dev->name, dev))) { | ||
1791 | printk (KERN_ERR "tulip: request_irq failed in resume\n"); | ||
1792 | return retval; | ||
1780 | } | 1793 | } |
1794 | |||
1795 | netif_device_attach(dev); | ||
1796 | |||
1797 | if (netif_running(dev)) | ||
1798 | tulip_up(dev); | ||
1799 | |||
1781 | return 0; | 1800 | return 0; |
1782 | } | 1801 | } |
1783 | 1802 | ||