diff options
author | Auke Kok <auke-jan.h.kok@intel.com> | 2008-03-03 17:37:31 -0500 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2008-03-05 06:34:28 -0500 |
commit | f902283bbe68639142a00dd23d80ee31e1b00759 (patch) | |
tree | 3eef8d0da638cecdc2d2e3496d84e3f3f05b3804 /drivers/net/e100.c | |
parent | af856bbfc498c3c8c79cb07be84e958962c711c3 (diff) |
e100: Do suspend/shutdown like e1000
This fixes a "trying to free already free IRQ" message and simplifies
the shutdown/suspend code by re-using already existing code when going
to suspend. The code is now symmetric with e100_resume.
Signed-off-by: Auke Kok <auke-jan.h.kok@intel.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/e100.c')
-rw-r--r-- | drivers/net/e100.c | 29 |
1 files changed, 3 insertions, 26 deletions
diff --git a/drivers/net/e100.c b/drivers/net/e100.c index 36ba6dc96acc..cdf3090a1885 100644 --- a/drivers/net/e100.c +++ b/drivers/net/e100.c | |||
@@ -2782,16 +2782,13 @@ static void __devexit e100_remove(struct pci_dev *pdev) | |||
2782 | } | 2782 | } |
2783 | } | 2783 | } |
2784 | 2784 | ||
2785 | #ifdef CONFIG_PM | ||
2786 | static int e100_suspend(struct pci_dev *pdev, pm_message_t state) | 2785 | static int e100_suspend(struct pci_dev *pdev, pm_message_t state) |
2787 | { | 2786 | { |
2788 | struct net_device *netdev = pci_get_drvdata(pdev); | 2787 | struct net_device *netdev = pci_get_drvdata(pdev); |
2789 | struct nic *nic = netdev_priv(netdev); | 2788 | struct nic *nic = netdev_priv(netdev); |
2790 | 2789 | ||
2791 | if (netif_running(netdev)) | 2790 | if (netif_running(netdev)) |
2792 | napi_disable(&nic->napi); | 2791 | e100_down(nic); |
2793 | del_timer_sync(&nic->watchdog); | ||
2794 | netif_carrier_off(nic->netdev); | ||
2795 | netif_device_detach(netdev); | 2792 | netif_device_detach(netdev); |
2796 | 2793 | ||
2797 | pci_save_state(pdev); | 2794 | pci_save_state(pdev); |
@@ -2804,14 +2801,13 @@ static int e100_suspend(struct pci_dev *pdev, pm_message_t state) | |||
2804 | pci_enable_wake(pdev, PCI_D3cold, 0); | 2801 | pci_enable_wake(pdev, PCI_D3cold, 0); |
2805 | } | 2802 | } |
2806 | 2803 | ||
2807 | free_irq(pdev->irq, netdev); | ||
2808 | |||
2809 | pci_disable_device(pdev); | 2804 | pci_disable_device(pdev); |
2810 | pci_set_power_state(pdev, PCI_D3hot); | 2805 | pci_set_power_state(pdev, PCI_D3hot); |
2811 | 2806 | ||
2812 | return 0; | 2807 | return 0; |
2813 | } | 2808 | } |
2814 | 2809 | ||
2810 | #ifdef CONFIG_PM | ||
2815 | static int e100_resume(struct pci_dev *pdev) | 2811 | static int e100_resume(struct pci_dev *pdev) |
2816 | { | 2812 | { |
2817 | struct net_device *netdev = pci_get_drvdata(pdev); | 2813 | struct net_device *netdev = pci_get_drvdata(pdev); |
@@ -2832,26 +2828,7 @@ static int e100_resume(struct pci_dev *pdev) | |||
2832 | 2828 | ||
2833 | static void e100_shutdown(struct pci_dev *pdev) | 2829 | static void e100_shutdown(struct pci_dev *pdev) |
2834 | { | 2830 | { |
2835 | struct net_device *netdev = pci_get_drvdata(pdev); | 2831 | e100_suspend(pdev, PMSG_SUSPEND); |
2836 | struct nic *nic = netdev_priv(netdev); | ||
2837 | |||
2838 | if (netif_running(netdev)) | ||
2839 | napi_disable(&nic->napi); | ||
2840 | del_timer_sync(&nic->watchdog); | ||
2841 | netif_carrier_off(nic->netdev); | ||
2842 | |||
2843 | if ((nic->flags & wol_magic) | e100_asf(nic)) { | ||
2844 | pci_enable_wake(pdev, PCI_D3hot, 1); | ||
2845 | pci_enable_wake(pdev, PCI_D3cold, 1); | ||
2846 | } else { | ||
2847 | pci_enable_wake(pdev, PCI_D3hot, 0); | ||
2848 | pci_enable_wake(pdev, PCI_D3cold, 0); | ||
2849 | } | ||
2850 | |||
2851 | free_irq(pdev->irq, netdev); | ||
2852 | |||
2853 | pci_disable_device(pdev); | ||
2854 | pci_set_power_state(pdev, PCI_D3hot); | ||
2855 | } | 2832 | } |
2856 | 2833 | ||
2857 | /* ------------------ PCI Error Recovery infrastructure -------------- */ | 2834 | /* ------------------ PCI Error Recovery infrastructure -------------- */ |