1 From bc79fc8409b3dccbde072e8113cc1fb3fd876fc5 Mon Sep 17 00:00:00 2001
2 From: Rafael J. Wysocki <rjw@sisk.pl>
3 Date: Wed, 29 Oct 2008 14:22:18 -0700
4 Subject: [PATCH] e100: adapt to the reworked PCI PM
6 Acked-by: Brandon Philips <bphilips@suse.de>
8 Adapt the e100 driver to the reworked PCI PM
10 * Use the observation that it is sufficient to call pci_enable_wake()
13 Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
14 Tested-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
15 Acked-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
16 Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
17 Cc: Jeff Garzik <jeff@garzik.org>
18 Cc: Frans Pop <elendil@planet.nl>
19 Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
20 Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
22 drivers/net/e100.c | 16 ++++++++++------
23 1 files changed, 10 insertions(+), 6 deletions(-)
25 diff --git a/drivers/net/e100.c b/drivers/net/e100.c
26 index bb4b6e2..084127f 100644
27 --- a/drivers/net/e100.c
28 +++ b/drivers/net/e100.c
29 @@ -2322,7 +2322,8 @@ static int e100_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
31 struct nic *nic = netdev_priv(netdev);
33 - if(wol->wolopts != WAKE_MAGIC && wol->wolopts != 0)
34 + if ((wol->wolopts && wol->wolopts != WAKE_MAGIC) ||
35 + !device_can_wakeup(&nic->pdev->dev))
39 @@ -2330,6 +2331,8 @@ static int e100_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
41 nic->flags &= ~wol_magic;
43 + device_set_wakeup_enable(&nic->pdev->dev, wol->wolopts);
45 e100_exec_cb(nic, NULL, e100_configure);
48 @@ -2733,8 +2736,10 @@ static int __devinit e100_probe(struct pci_dev *pdev,
50 /* Wol magic packet can be enabled from eeprom */
51 if((nic->mac >= mac_82558_D101_A4) &&
52 - (nic->eeprom[eeprom_id] & eeprom_id_wol))
53 + (nic->eeprom[eeprom_id] & eeprom_id_wol)) {
54 nic->flags |= wol_magic;
55 + device_set_wakeup_enable(&pdev->dev, true);
58 /* ack any pending wake events, disable PME */
59 pci_pme_active(pdev, false);
60 @@ -2793,11 +2798,10 @@ static int e100_suspend(struct pci_dev *pdev, pm_message_t state)
63 if ((nic->flags & wol_magic) | e100_asf(nic)) {
64 - pci_enable_wake(pdev, PCI_D3hot, 1);
65 - pci_enable_wake(pdev, PCI_D3cold, 1);
66 + if (pci_enable_wake(pdev, PCI_D3cold, true))
67 + pci_enable_wake(pdev, PCI_D3hot, true);
69 - pci_enable_wake(pdev, PCI_D3hot, 0);
70 - pci_enable_wake(pdev, PCI_D3cold, 0);
71 + pci_enable_wake(pdev, PCI_D3hot, false);
74 pci_disable_device(pdev);