diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2021-10-15 19:45:59 +0300 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2021-10-21 13:18:13 +0300 |
commit | 6f9f0eef0096caddc3fd92760f818970033f06ea (patch) | |
tree | 7d0d6bcf35d16b42156746d0d9c6b611a0ff9597 /drivers/pci/pci.c | |
parent | fa1a25c51d02f153b49444aa872bee9da3c13ecf (diff) | |
download | linux-6f9f0eef0096caddc3fd92760f818970033f06ea.tar.xz |
PCI: PM: Fix ordering of operations in pci_back_from_sleep()
The ordering of operations in pci_back_from_sleep() is incorrect,
because the device may be in D3cold when it runs and pci_enable_wake()
needs to access the device's configuration space which cannot be
done in D3cold.
Fix this by calling pci_set_power_state() to put the device into D0
before calling pci_enable_wake() for it.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'drivers/pci/pci.c')
-rw-r--r-- | drivers/pci/pci.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index b0409bd33c45..11c88ffb51d9 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -2638,8 +2638,13 @@ EXPORT_SYMBOL(pci_prepare_to_sleep); */ int pci_back_from_sleep(struct pci_dev *dev) { + int ret = pci_set_power_state(dev, PCI_D0); + + if (ret) + return ret; + pci_enable_wake(dev, PCI_D0, false); - return pci_set_power_state(dev, PCI_D0); + return 0; } EXPORT_SYMBOL(pci_back_from_sleep); |