aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/e100.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/e100.c')
-rw-r--r--drivers/net/e100.c30
1 files changed, 23 insertions, 7 deletions
diff --git a/drivers/net/e100.c b/drivers/net/e100.c
index 5c0b457c7868..0f9ee1348552 100644
--- a/drivers/net/e100.c
+++ b/drivers/net/e100.c
@@ -2728,7 +2728,7 @@ static void __devexit e100_remove(struct pci_dev *pdev)
2728#define E100_82552_SMARTSPEED 0x14 /* SmartSpeed Ctrl register */ 2728#define E100_82552_SMARTSPEED 0x14 /* SmartSpeed Ctrl register */
2729#define E100_82552_REV_ANEG 0x0200 /* Reverse auto-negotiation */ 2729#define E100_82552_REV_ANEG 0x0200 /* Reverse auto-negotiation */
2730#define E100_82552_ANEG_NOW 0x0400 /* Auto-negotiate now */ 2730#define E100_82552_ANEG_NOW 0x0400 /* Auto-negotiate now */
2731static int e100_suspend(struct pci_dev *pdev, pm_message_t state) 2731static void __e100_shutdown(struct pci_dev *pdev, bool *enable_wake)
2732{ 2732{
2733 struct net_device *netdev = pci_get_drvdata(pdev); 2733 struct net_device *netdev = pci_get_drvdata(pdev);
2734 struct nic *nic = netdev_priv(netdev); 2734 struct nic *nic = netdev_priv(netdev);
@@ -2749,19 +2749,32 @@ static int e100_suspend(struct pci_dev *pdev, pm_message_t state)
2749 E100_82552_SMARTSPEED, smartspeed | 2749 E100_82552_SMARTSPEED, smartspeed |
2750 E100_82552_REV_ANEG | E100_82552_ANEG_NOW); 2750 E100_82552_REV_ANEG | E100_82552_ANEG_NOW);
2751 } 2751 }
2752 if (pci_enable_wake(pdev, PCI_D3cold, true)) 2752 *enable_wake = true;
2753 pci_enable_wake(pdev, PCI_D3hot, true);
2754 } else { 2753 } else {
2755 pci_enable_wake(pdev, PCI_D3hot, false); 2754 *enable_wake = false;
2756 } 2755 }
2757 2756
2758 pci_disable_device(pdev); 2757 pci_disable_device(pdev);
2759 pci_set_power_state(pdev, PCI_D3hot); 2758}
2760 2759
2761 return 0; 2760static int __e100_power_off(struct pci_dev *pdev, bool wake)
2761{
2762 if (wake) {
2763 return pci_prepare_to_sleep(pdev);
2764 } else {
2765 pci_wake_from_d3(pdev, false);
2766 return pci_set_power_state(pdev, PCI_D3hot);
2767 }
2762} 2768}
2763 2769
2764#ifdef CONFIG_PM 2770#ifdef CONFIG_PM
2771static int e100_suspend(struct pci_dev *pdev, pm_message_t state)
2772{
2773 bool wake;
2774 __e100_shutdown(pdev, &wake);
2775 return __e100_power_off(pdev, wake);
2776}
2777
2765static int e100_resume(struct pci_dev *pdev) 2778static int e100_resume(struct pci_dev *pdev)
2766{ 2779{
2767 struct net_device *netdev = pci_get_drvdata(pdev); 2780 struct net_device *netdev = pci_get_drvdata(pdev);
@@ -2792,7 +2805,10 @@ static int e100_resume(struct pci_dev *pdev)
2792 2805
2793static void e100_shutdown(struct pci_dev *pdev) 2806static void e100_shutdown(struct pci_dev *pdev)
2794{ 2807{
2795 e100_suspend(pdev, PMSG_SUSPEND); 2808 bool wake;
2809 __e100_shutdown(pdev, &wake);
2810 if (system_state == SYSTEM_POWER_OFF)
2811 __e100_power_off(pdev, wake);
2796} 2812}
2797 2813
2798/* ------------------ PCI Error Recovery infrastructure -------------- */ 2814/* ------------------ PCI Error Recovery infrastructure -------------- */