diff options
author | Tobias Diedrich <ranma+kernel@tdiedrich.de> | 2008-05-18 09:04:29 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2008-05-30 22:19:11 -0400 |
commit | 25d90810ff49d2a63475776f24c74c6bb49b045f (patch) | |
tree | 00da450164d4ac4d99968d8f786d4158342ae826 /drivers | |
parent | 1a1ca86158eee303af5270338695f90bc7ae02b3 (diff) |
[netdrvr] forcedeth: reorder suspend/resume code
Match the suspend/resume code ordering in e100/e1000e more closely.
For example the configuration space should be saved on suspend even for
devices that are not up.
Signed-off-by: Tobias Diedrich <ranma+kernel@tdiedrich.de>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/forcedeth.c | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c index a5650ed4d481..e4d697894364 100644 --- a/drivers/net/forcedeth.c +++ b/drivers/net/forcedeth.c | |||
@@ -5792,22 +5792,20 @@ static int nv_suspend(struct pci_dev *pdev, pm_message_t state) | |||
5792 | u8 __iomem *base = get_hwbase(dev); | 5792 | u8 __iomem *base = get_hwbase(dev); |
5793 | int i; | 5793 | int i; |
5794 | 5794 | ||
5795 | if (!netif_running(dev)) | 5795 | if (netif_running(dev)) { |
5796 | goto out; | 5796 | // Gross. |
5797 | 5797 | nv_close(dev); | |
5798 | } | ||
5798 | netif_device_detach(dev); | 5799 | netif_device_detach(dev); |
5799 | 5800 | ||
5800 | // Gross. | ||
5801 | nv_close(dev); | ||
5802 | |||
5803 | /* save non-pci configuration space */ | 5801 | /* save non-pci configuration space */ |
5804 | for (i = 0;i <= np->register_size/sizeof(u32); i++) | 5802 | for (i = 0;i <= np->register_size/sizeof(u32); i++) |
5805 | np->saved_config_space[i] = readl(base + i*sizeof(u32)); | 5803 | np->saved_config_space[i] = readl(base + i*sizeof(u32)); |
5806 | 5804 | ||
5807 | pci_save_state(pdev); | 5805 | pci_save_state(pdev); |
5808 | pci_enable_wake(pdev, pci_choose_state(pdev, state), np->wolenabled); | 5806 | pci_enable_wake(pdev, pci_choose_state(pdev, state), np->wolenabled); |
5807 | pci_disable_device(pdev); | ||
5809 | pci_set_power_state(pdev, pci_choose_state(pdev, state)); | 5808 | pci_set_power_state(pdev, pci_choose_state(pdev, state)); |
5810 | out: | ||
5811 | return 0; | 5809 | return 0; |
5812 | } | 5810 | } |
5813 | 5811 | ||
@@ -5818,22 +5816,20 @@ static int nv_resume(struct pci_dev *pdev) | |||
5818 | u8 __iomem *base = get_hwbase(dev); | 5816 | u8 __iomem *base = get_hwbase(dev); |
5819 | int i, rc = 0; | 5817 | int i, rc = 0; |
5820 | 5818 | ||
5821 | if (!netif_running(dev)) | ||
5822 | goto out; | ||
5823 | |||
5824 | netif_device_attach(dev); | ||
5825 | |||
5826 | pci_set_power_state(pdev, PCI_D0); | 5819 | pci_set_power_state(pdev, PCI_D0); |
5827 | pci_restore_state(pdev); | 5820 | pci_restore_state(pdev); |
5821 | /* ack any pending wake events, disable PME */ | ||
5828 | pci_enable_wake(pdev, PCI_D0, 0); | 5822 | pci_enable_wake(pdev, PCI_D0, 0); |
5829 | 5823 | ||
5830 | /* restore non-pci configuration space */ | 5824 | /* restore non-pci configuration space */ |
5831 | for (i = 0;i <= np->register_size/sizeof(u32); i++) | 5825 | for (i = 0;i <= np->register_size/sizeof(u32); i++) |
5832 | writel(np->saved_config_space[i], base+i*sizeof(u32)); | 5826 | writel(np->saved_config_space[i], base+i*sizeof(u32)); |
5833 | 5827 | ||
5834 | rc = nv_open(dev); | 5828 | netif_device_attach(dev); |
5835 | nv_set_multicast(dev); | 5829 | if (netif_running(dev)) { |
5836 | out: | 5830 | rc = nv_open(dev); |
5831 | nv_set_multicast(dev); | ||
5832 | } | ||
5837 | return rc; | 5833 | return rc; |
5838 | } | 5834 | } |
5839 | 5835 | ||