]> git.baikalelectronics.ru Git - kernel.git/commit
PCI: PM/ACPI: Refresh all stale power state data in pci_pm_complete()
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 25 Jun 2019 12:09:12 +0000 (14:09 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 27 Jun 2019 10:33:26 +0000 (12:33 +0200)
commit103e63761e5b8fb4c4c97321fca75f5a2ade9a47
tree3ac6b898f1cba06f50b1f7f636ca0f848c9236e6
parent1aeaad41e2d050b43723b6d2a9114e070700f9a0
PCI: PM/ACPI: Refresh all stale power state data in pci_pm_complete()

In pci_pm_complete() there are checks to decide whether or not to
resume devices that were left in runtime-suspend during the preceding
system-wide transition into a sleep state.  They involve checking the
current power state of the device and comparing it with the power
state of it set before the preceding system-wide transition, but the
platform component of the device's power state is not handled
correctly in there.

Namely, on platforms with ACPI, the device power state information
needs to be updated with care, so that the reference counters of
power resources used by the device (if any) are set to ensure that
the refreshed power state of it will be maintained going forward.

To that end, introduce a new ->refresh_state() platform PM callback
for PCI devices, for asking the platform to refresh the device power
state data and ensure that the corresponding power state will be
maintained going forward, make it invoke acpi_device_update_power()
(for devices with ACPI PM) on platforms with ACPI and make
pci_pm_complete() use it, through a new pci_refresh_power_state()
wrapper function.

Fixes: ef05d1393d21 (PCI: Avoid unnecessary resume after direct-complete)
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
drivers/pci/pci-acpi.c
drivers/pci/pci-driver.c
drivers/pci/pci.c
drivers/pci/pci.h