summaryrefslogtreecommitdiff
path: root/drivers/pci/pci-driver.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-06-03 08:25:25 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-06-03 08:25:25 +0300
commit119a7fdfeecefa5a4062256ac2dcd3b69eaa8414 (patch)
tree40d834b32ce97857f3f974c95b64b6b48d415e6e /drivers/pci/pci-driver.c
parent086ebf92aa791b6cc8805decffca7b8898d99a4e (diff)
parentf2c7c76c5d0a443053e94adb9f0918fa2fb85c3a (diff)
downloadlinux-119a7fdfeecefa5a4062256ac2dcd3b69eaa8414.tar.xz
Merge 5.2-rc3 into usb-next
we want the USB fixes in here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/pci/pci-driver.c')
-rw-r--r--drivers/pci/pci-driver.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
index cae630fe6387..5eadbc3d0969 100644
--- a/drivers/pci/pci-driver.c
+++ b/drivers/pci/pci-driver.c
@@ -734,6 +734,8 @@ static int pci_pm_suspend(struct device *dev)
struct pci_dev *pci_dev = to_pci_dev(dev);
const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
+ pci_dev->skip_bus_pm = false;
+
if (pci_has_legacy_pm_support(pci_dev))
return pci_legacy_suspend(dev, PMSG_SUSPEND);
@@ -827,7 +829,20 @@ static int pci_pm_suspend_noirq(struct device *dev)
}
}
- if (!pci_dev->state_saved) {
+ if (pci_dev->skip_bus_pm) {
+ /*
+ * The function is running for the second time in a row without
+ * going through full resume, which is possible only during
+ * suspend-to-idle in a spurious wakeup case. Moreover, the
+ * device was originally left in D0, so its power state should
+ * not be changed here and the device register values saved
+ * originally should be restored on resume again.
+ */
+ pci_dev->state_saved = true;
+ } else if (pci_dev->state_saved) {
+ if (pci_dev->current_state == PCI_D0)
+ pci_dev->skip_bus_pm = true;
+ } else {
pci_save_state(pci_dev);
if (pci_power_manageable(pci_dev))
pci_prepare_to_sleep(pci_dev);