Skip to content

Commit 4c00cba

Browse files
rjingarbjorn-helgaas
authored andcommitted
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/[email protected] Signed-off-by: Rajvi Jingar <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]> Reviewed-by: Rafael J. Wysocki <[email protected]>
1 parent c01163d commit 4c00cba

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

drivers/pci/pci-driver.c

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -873,20 +873,15 @@ static int pci_pm_suspend_noirq(struct device *dev)
873873
}
874874
}
875875

876-
if (pci_dev->skip_bus_pm) {
876+
if (!pci_dev->state_saved) {
877+
pci_save_state(pci_dev);
878+
877879
/*
878-
* Either the device is a bridge with a child in D0 below it, or
879-
* the function is running for the second time in a row without
880-
* going through full resume, which is possible only during
881-
* suspend-to-idle in a spurious wakeup case. The device should
882-
* be in D0 at this point, but if it is a bridge, it may be
883-
* necessary to save its state.
880+
* If the device is a bridge with a child in D0 below it,
881+
* it needs to stay in D0, so check skip_bus_pm to avoid
882+
* putting it into a low-power state in that case.
884883
*/
885-
if (!pci_dev->state_saved)
886-
pci_save_state(pci_dev);
887-
} else if (!pci_dev->state_saved) {
888-
pci_save_state(pci_dev);
889-
if (pci_power_manageable(pci_dev))
884+
if (!pci_dev->skip_bus_pm && pci_power_manageable(pci_dev))
890885
pci_prepare_to_sleep(pci_dev);
891886
}
892887

0 commit comments

Comments
 (0)