diff options
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/e100.c | 51 |
1 files changed, 20 insertions, 31 deletions
diff --git a/drivers/net/e100.c b/drivers/net/e100.c index 3909829d5199..e9e712471b13 100644 --- a/drivers/net/e100.c +++ b/drivers/net/e100.c | |||
@@ -2715,68 +2715,56 @@ static void __devexit e100_remove(struct pci_dev *pdev) | |||
2715 | } | 2715 | } |
2716 | } | 2716 | } |
2717 | 2717 | ||
2718 | #ifdef CONFIG_PM | ||
2719 | static int e100_suspend(struct pci_dev *pdev, pm_message_t state) | 2718 | static int e100_suspend(struct pci_dev *pdev, pm_message_t state) |
2720 | { | 2719 | { |
2721 | struct net_device *netdev = pci_get_drvdata(pdev); | 2720 | struct net_device *netdev = pci_get_drvdata(pdev); |
2722 | struct nic *nic = netdev_priv(netdev); | 2721 | struct nic *nic = netdev_priv(netdev); |
2723 | int retval; | ||
2724 | 2722 | ||
2725 | if(netif_running(netdev)) | 2723 | if (netif_running(netdev)) |
2726 | e100_down(nic); | 2724 | e100_down(nic); |
2727 | e100_hw_reset(nic); | 2725 | e100_hw_reset(nic); |
2728 | netif_device_detach(netdev); | 2726 | netif_device_detach(netdev); |
2729 | 2727 | ||
2728 | #ifdef CONFIG_PM | ||
2730 | pci_save_state(pdev); | 2729 | pci_save_state(pdev); |
2731 | retval = pci_enable_wake(pdev, pci_choose_state(pdev, state), | 2730 | if (nic->flags & (wol_magic | e100_asf(nic))) |
2732 | nic->flags & (wol_magic | e100_asf(nic))); | 2731 | #else |
2733 | if (retval) | 2732 | if (nic->flags & (wol_magic)) |
2734 | DPRINTK(PROBE,ERR, "Error enabling wake\n"); | 2733 | #endif |
2734 | pci_enable_wake(pdev, pci_choose_state(pdev, state), 1); | ||
2735 | else | ||
2736 | /* disable PME */ | ||
2737 | pci_enable_wake(pdev, 0, 0); | ||
2738 | |||
2735 | pci_disable_device(pdev); | 2739 | pci_disable_device(pdev); |
2736 | retval = pci_set_power_state(pdev, pci_choose_state(pdev, state)); | 2740 | pci_set_power_state(pdev, pci_choose_state(pdev, state)); |
2737 | if (retval) | ||
2738 | DPRINTK(PROBE,ERR, "Error %d setting power state\n", retval); | ||
2739 | 2741 | ||
2740 | return 0; | 2742 | return 0; |
2741 | } | 2743 | } |
2742 | 2744 | ||
2745 | #ifdef CONFIG_PM | ||
2743 | static int e100_resume(struct pci_dev *pdev) | 2746 | static int e100_resume(struct pci_dev *pdev) |
2744 | { | 2747 | { |
2745 | struct net_device *netdev = pci_get_drvdata(pdev); | 2748 | struct net_device *netdev = pci_get_drvdata(pdev); |
2746 | struct nic *nic = netdev_priv(netdev); | 2749 | struct nic *nic = netdev_priv(netdev); |
2747 | int retval; | ||
2748 | 2750 | ||
2749 | retval = pci_set_power_state(pdev, PCI_D0); | 2751 | pci_set_power_state(pdev, PCI_D0); |
2750 | if (retval) | ||
2751 | DPRINTK(PROBE,ERR, "Error waking adapter\n"); | ||
2752 | pci_restore_state(pdev); | 2752 | pci_restore_state(pdev); |
2753 | /* ack any pending wake events, disable PME */ | 2753 | /* ack any pending wake events, disable PME */ |
2754 | retval = pci_enable_wake(pdev, 0, 0); | 2754 | pci_enable_wake(pdev, 0, 0); |
2755 | if (retval) | ||
2756 | DPRINTK(PROBE,ERR, "Error clearing wake events\n"); | ||
2757 | 2755 | ||
2758 | netif_device_attach(netdev); | 2756 | netif_device_attach(netdev); |
2759 | if(netif_running(netdev)) | 2757 | if (netif_running(netdev)) |
2760 | e100_up(nic); | 2758 | e100_up(nic); |
2761 | 2759 | ||
2762 | return 0; | 2760 | return 0; |
2763 | } | 2761 | } |
2764 | #endif | 2762 | #endif /* CONFIG_PM */ |
2765 | 2763 | ||
2766 | 2764 | ||
2767 | static void e100_shutdown(struct pci_dev *pdev) | 2765 | static void e100_shutdown(struct pci_dev *pdev) |
2768 | { | 2766 | { |
2769 | struct net_device *netdev = pci_get_drvdata(pdev); | 2767 | e100_suspend(pdev, PMSG_SUSPEND); |
2770 | struct nic *nic = netdev_priv(netdev); | ||
2771 | int retval; | ||
2772 | |||
2773 | #ifdef CONFIG_PM | ||
2774 | retval = pci_enable_wake(pdev, 0, nic->flags & (wol_magic | e100_asf(nic))); | ||
2775 | #else | ||
2776 | retval = pci_enable_wake(pdev, 0, nic->flags & (wol_magic)); | ||
2777 | #endif | ||
2778 | if (retval) | ||
2779 | DPRINTK(PROBE,ERR, "Error enabling wake\n"); | ||
2780 | } | 2768 | } |
2781 | 2769 | ||
2782 | /* ------------------ PCI Error Recovery infrastructure -------------- */ | 2770 | /* ------------------ PCI Error Recovery infrastructure -------------- */ |
@@ -2860,8 +2848,9 @@ static struct pci_driver e100_driver = { | |||
2860 | .id_table = e100_id_table, | 2848 | .id_table = e100_id_table, |
2861 | .probe = e100_probe, | 2849 | .probe = e100_probe, |
2862 | .remove = __devexit_p(e100_remove), | 2850 | .remove = __devexit_p(e100_remove), |
2863 | #ifdef CONFIG_PM | 2851 | /* Power Management hooks */ |
2864 | .suspend = e100_suspend, | 2852 | .suspend = e100_suspend, |
2853 | #ifdef CONFIG_PM | ||
2865 | .resume = e100_resume, | 2854 | .resume = e100_resume, |
2866 | #endif | 2855 | #endif |
2867 | .shutdown = e100_shutdown, | 2856 | .shutdown = e100_shutdown, |