PCI/PM: Replace pci_set_power_state() in pci_pm_thaw_noirq()
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 5 May 2022 18:18:09 +0000 (20:18 +0200)
committerBjorn Helgaas <bhelgaas@google.com>
Thu, 5 May 2022 19:19:49 +0000 (14:19 -0500)
commit0f40ac35e4ecb16ab5bb672386a90e3cde13b186
tree0233cd24d4313acfdf21afa96427f770495c3104
parent3cc2a2b2704f76702cdd417573a934502254276d
PCI/PM: Replace pci_set_power_state() in pci_pm_thaw_noirq()

Calling pci_set_power_state() to put the given device into D0 in
pci_pm_thaw_noirq() may cause it to restore the device's BARs, which is
redundant before calling pci_restore_state(), so replace it with a direct
pci_power_up() call followed by pci_update_current_state() if it returns a
nonzero value, in analogy with pci_pm_default_resume_early().

Avoid code duplication by introducing a wrapper function to contain the
repeating pattern and calling it in both places.

Link: https://lore.kernel.org/r/3639079.MHq7AAxBmi@kreacher
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
drivers/pci/pci-driver.c