]>
Commit | Line | Data |
---|---|---|
2cb7cef9 BS |
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 | |
5 | References: bnc#504646 | |
6 | Acked-by: Brandon Philips <bphilips@suse.de> | |
7 | ||
8 | Adapt the e100 driver to the reworked PCI PM | |
9 | ||
10 | * Use the observation that it is sufficient to call pci_enable_wake() | |
11 | once, unless it fails | |
12 | ||
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> | |
21 | --- | |
22 | drivers/net/e100.c | 16 ++++++++++------ | |
23 | 1 file changed, 10 insertions(+), 6 deletions(-) | |
24 | ||
25 | --- a/drivers/net/e100.c | |
26 | +++ b/drivers/net/e100.c | |
27 | @@ -2325,7 +2325,8 @@ static int e100_set_wol(struct net_devic | |
28 | { | |
29 | struct nic *nic = netdev_priv(netdev); | |
30 | ||
31 | - if(wol->wolopts != WAKE_MAGIC && wol->wolopts != 0) | |
32 | + if ((wol->wolopts && wol->wolopts != WAKE_MAGIC) || | |
33 | + !device_can_wakeup(&nic->pdev->dev)) | |
34 | return -EOPNOTSUPP; | |
35 | ||
36 | if(wol->wolopts) | |
37 | @@ -2333,6 +2334,8 @@ static int e100_set_wol(struct net_devic | |
38 | else | |
39 | nic->flags &= ~wol_magic; | |
40 | ||
41 | + device_set_wakeup_enable(&nic->pdev->dev, wol->wolopts); | |
42 | + | |
43 | e100_exec_cb(nic, NULL, e100_configure); | |
44 | ||
45 | return 0; | |
46 | @@ -2737,8 +2740,10 @@ static int __devinit e100_probe(struct p | |
47 | ||
48 | /* Wol magic packet can be enabled from eeprom */ | |
49 | if((nic->mac >= mac_82558_D101_A4) && | |
50 | - (nic->eeprom[eeprom_id] & eeprom_id_wol)) | |
51 | + (nic->eeprom[eeprom_id] & eeprom_id_wol)) { | |
52 | nic->flags |= wol_magic; | |
53 | + device_set_wakeup_enable(&pdev->dev, true); | |
54 | + } | |
55 | ||
56 | /* ack any pending wake events, disable PME */ | |
57 | pci_pme_active(pdev, false); | |
58 | @@ -2797,11 +2802,10 @@ static int e100_suspend(struct pci_dev * | |
59 | pci_save_state(pdev); | |
60 | ||
61 | if ((nic->flags & wol_magic) | e100_asf(nic)) { | |
62 | - pci_enable_wake(pdev, PCI_D3hot, 1); | |
63 | - pci_enable_wake(pdev, PCI_D3cold, 1); | |
64 | + if (pci_enable_wake(pdev, PCI_D3cold, true)) | |
65 | + pci_enable_wake(pdev, PCI_D3hot, true); | |
66 | } else { | |
67 | - pci_enable_wake(pdev, PCI_D3hot, 0); | |
68 | - pci_enable_wake(pdev, PCI_D3cold, 0); | |
69 | + pci_enable_wake(pdev, PCI_D3hot, false); | |
70 | } | |
71 | ||
72 | pci_disable_device(pdev); |