Commit 0f953bf6b4efa0daddb7c418130a9bd3ee97f7ed

Authored by Rafael J. Wysocki
Committed by Jesse Barnes
1 parent b6e335aeeb

PCI/PM: Report wakeup events before resuming devices

Make wakeup events be reported by the PCI subsystem before attempting to
resume devices or queuing up runtime resume requests for them, because
wakeup events should be reported as soon as they have been detected.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>

Showing 3 changed files with 4 additions and 4 deletions Side-by-side Diff

drivers/pci/pci-acpi.c
... ... @@ -46,9 +46,9 @@
46 46 struct pci_dev *pci_dev = context;
47 47  
48 48 if (event == ACPI_NOTIFY_DEVICE_WAKE && pci_dev) {
  49 + pci_wakeup_event(pci_dev);
49 50 pci_check_pme_status(pci_dev);
50 51 pm_runtime_resume(&pci_dev->dev);
51   - pci_wakeup_event(pci_dev);
52 52 if (pci_dev->subordinate)
53 53 pci_pme_wakeup_bus(pci_dev->subordinate);
54 54 }
... ... @@ -1308,8 +1308,8 @@
1308 1308 static int pci_pme_wakeup(struct pci_dev *dev, void *ign)
1309 1309 {
1310 1310 if (pci_check_pme_status(dev)) {
1311   - pm_request_resume(&dev->dev);
1312 1311 pci_wakeup_event(dev);
  1312 + pm_request_resume(&dev->dev);
1313 1313 }
1314 1314 return 0;
1315 1315 }
drivers/pci/pcie/pme.c
... ... @@ -84,8 +84,8 @@
84 84 list_for_each_entry(dev, &bus->devices, bus_list) {
85 85 /* Skip PCIe devices in case we started from a root port. */
86 86 if (!pci_is_pcie(dev) && pci_check_pme_status(dev)) {
87   - pm_request_resume(&dev->dev);
88 87 pci_wakeup_event(dev);
  88 + pm_request_resume(&dev->dev);
89 89 ret = true;
90 90 }
91 91  
92 92  
... ... @@ -187,8 +187,8 @@
187 187 /* The device is there, but we have to check its PME status. */
188 188 found = pci_check_pme_status(dev);
189 189 if (found) {
190   - pm_request_resume(&dev->dev);
191 190 pci_wakeup_event(dev);
  191 + pm_request_resume(&dev->dev);
192 192 }
193 193 pci_dev_put(dev);
194 194 } else if (devfn) {