Skip to content

Commit 3ff2de9

Browse files
yhuang-intelbjorn-helgaas
authored andcommitted
PCI/PM: Resume device before shutdown
Some actions during shutdown need device to be in D0 state, such as MSI shutdown etc, so resume device before shutdown. Without this patch, a device may not be enumerated after a kexec because the corresponding bridge is not in D0, so that configuration space of the device is not accessible. Signed-off-by: Huang Ying <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]> Acked-by: Rafael J. Wysocki <[email protected]> CC: [email protected] # v3.6+
1 parent 90b5c1d commit 3ff2de9

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

drivers/pci/pci-driver.c

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,8 @@ static void pci_device_shutdown(struct device *dev)
398398
struct pci_dev *pci_dev = to_pci_dev(dev);
399399
struct pci_driver *drv = pci_dev->driver;
400400

401+
pm_runtime_resume(dev);
402+
401403
if (drv && drv->shutdown)
402404
drv->shutdown(pci_dev);
403405
pci_msi_shutdown(pci_dev);
@@ -408,16 +410,6 @@ static void pci_device_shutdown(struct device *dev)
408410
* continue to do DMA
409411
*/
410412
pci_disable_device(pci_dev);
411-
412-
/*
413-
* Devices may be enabled to wake up by runtime PM, but they need not
414-
* be supposed to wake up the system from its "power off" state (e.g.
415-
* ACPI S5). Therefore disable wakeup for all devices that aren't
416-
* supposed to wake up the system at this point. The state argument
417-
* will be ignored by pci_enable_wake().
418-
*/
419-
if (!device_may_wakeup(dev))
420-
pci_enable_wake(pci_dev, PCI_UNKNOWN, false);
421413
}
422414

423415
#ifdef CONFIG_PM

0 commit comments

Comments
 (0)