aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2018-05-18 04:17:42 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2018-05-24 04:15:51 -0400
commit656088aa9b513907833ba091d0dcde87571fe05b (patch)
tree5ebf708ab05c96a75453cae13648789d5ddb1bed
parent771c577c23bac90597c685971d7297ea00f99d11 (diff)
PCI / PM: Do not clear state_saved for devices that remain suspended
The state_saved flag should not be cleared in pci_pm_suspend() if the given device is going to remain suspended, or the device's config space will not be restored properly during the subsequent resume. Namely, if the device is going to stay in suspend, both the late and noirq callbacks return early for it, so if its state_saved flag is cleared in pci_pm_suspend(), it will remain unset throughout the remaining part of suspend and resume and pci_restore_state() called for the device going forward will return without doing anything. For this reason, change pci_pm_suspend() to only clear state_saved if the given device is not going to remain suspended. [This is analogous to what commit ae860a19f37c (PCI / PM: Do not clear state_saved in pci_pm_freeze() when smart suspend is set) did for hibernation.] Fixes: c4b65157aeef (PCI / PM: Take SMART_SUSPEND driver flag into account) Cc: 4.15+ <stable@vger.kernel.org> # 4.15+ Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com> Acked-by: Bjorn Helgaas <bhelgaas@google.com>
-rw-r--r--drivers/pci/pci-driver.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
index b9a131137e64..c816b0683a82 100644
--- a/drivers/pci/pci-driver.c
+++ b/drivers/pci/pci-driver.c
@@ -753,10 +753,11 @@ static int pci_pm_suspend(struct device *dev)
753 * better to resume the device from runtime suspend here. 753 * better to resume the device from runtime suspend here.
754 */ 754 */
755 if (!dev_pm_test_driver_flags(dev, DPM_FLAG_SMART_SUSPEND) || 755 if (!dev_pm_test_driver_flags(dev, DPM_FLAG_SMART_SUSPEND) ||
756 !pci_dev_keep_suspended(pci_dev)) 756 !pci_dev_keep_suspended(pci_dev)) {
757 pm_runtime_resume(dev); 757 pm_runtime_resume(dev);
758 pci_dev->state_saved = false;
759 }
758 760
759 pci_dev->state_saved = false;
760 if (pm->suspend) { 761 if (pm->suspend) {
761 pci_power_t prev = pci_dev->current_state; 762 pci_power_t prev = pci_dev->current_state;
762 int error; 763 int error;