Commit 4c00cba1 authored by Rajvi Jingar's avatar Rajvi Jingar Committed by Bjorn Helgaas

PCI/PM: Simplify pci_pm_suspend_noirq()

We always want to save the device state unless the driver has already done
it.  Rearrange the checking in pci_pm_suspend_noirq() to make this more
clear.  No functional change intended.

[bhelgaas: commit log, rewrap comment]
Link: https://lore.kernel.org/r/20220830104913.1620539-1-rajvi.jingar@linux.intel.comSigned-off-by: default avatarRajvi Jingar <rajvi.jingar@linux.intel.com>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
Reviewed-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent c01163db
...@@ -873,20 +873,15 @@ static int pci_pm_suspend_noirq(struct device *dev) ...@@ -873,20 +873,15 @@ static int pci_pm_suspend_noirq(struct device *dev)
} }
} }
if (pci_dev->skip_bus_pm) { if (!pci_dev->state_saved) {
pci_save_state(pci_dev);
/* /*
* Either the device is a bridge with a child in D0 below it, or * If the device is a bridge with a child in D0 below it,
* the function is running for the second time in a row without * it needs to stay in D0, so check skip_bus_pm to avoid
* going through full resume, which is possible only during * putting it into a low-power state in that case.
* suspend-to-idle in a spurious wakeup case. The device should
* be in D0 at this point, but if it is a bridge, it may be
* necessary to save its state.
*/ */
if (!pci_dev->state_saved) if (!pci_dev->skip_bus_pm && pci_power_manageable(pci_dev))
pci_save_state(pci_dev);
} else if (!pci_dev->state_saved) {
pci_save_state(pci_dev);
if (pci_power_manageable(pci_dev))
pci_prepare_to_sleep(pci_dev); pci_prepare_to_sleep(pci_dev);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment