Merge tag 'pm-5.2-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull power management fixes from Rafael Wysocki:
 "These fix three issues in the system-wide suspend and hibernation area
  related to PCI device PM handling by suspend-to-idle, device wakeup
  optimizations and arbitrary differences between suspend and
  hiberantion.

  Specifics:

   - Modify the PCI bus type's PM code to avoid putting devices left by
     their drivers in D0 on purpose during suspend to idle into
     low-power states as doing that may confuse the system resume
     callbacks of the drivers in question (Rafael Wysocki).

   - Avoid checking ACPI wakeup configuration during system-wide suspend
     for suspended devices that do not use ACPI-based wakeup to allow
     them to stay in suspend more often (Rafael Wysocki).

   - The last phase of hibernation is analogous to system-wide suspend
     also because on platforms with ACPI it passes control to the
     platform firmware to complete the transision, so make it indicate
     that by calling pm_set_suspend_via_firmware() to allow the drivers
     that care about this to do the right thing (Rafael Wysocki)"

* tag 'pm-5.2-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
  PCI: PM: Avoid possible suspend-to-idle issue
  ACPI: PM: Call pm_set_suspend_via_firmware() during hibernation
  ACPI/PCI: PM: Add missing wakeup.flags.valid checks
This commit is contained in:
Linus Torvalds
2019-05-31 10:38:35 -07:00
7 changed files with 48 additions and 22 deletions

View File

@@ -944,8 +944,8 @@ static bool acpi_dev_needs_resume(struct device *dev, struct acpi_device *adev)
u32 sys_target = acpi_target_system_state();
int ret, state;
if (!pm_runtime_suspended(dev) || !adev ||
device_may_wakeup(dev) != !!adev->wakeup.prepare_count)
if (!pm_runtime_suspended(dev) || !adev || (adev->wakeup.flags.valid &&
device_may_wakeup(dev) != !!adev->wakeup.prepare_count))
return true;
if (sys_target == ACPI_STATE_S0)

View File

@@ -1132,15 +1132,19 @@ void __init acpi_no_s4_hw_signature(void)
nosigcheck = true;
}
static int acpi_hibernation_begin(void)
static int acpi_hibernation_begin(pm_message_t stage)
{
int error;
if (!nvs_nosave) {
int error = suspend_nvs_alloc();
if (error)
return error;
}
error = nvs_nosave ? 0 : suspend_nvs_alloc();
if (!error)
acpi_pm_start(ACPI_STATE_S4);
if (stage.event == PM_EVENT_HIBERNATE)
pm_set_suspend_via_firmware();
return error;
acpi_pm_start(ACPI_STATE_S4);
return 0;
}
static int acpi_hibernation_enter(void)
@@ -1200,7 +1204,7 @@ static const struct platform_hibernation_ops acpi_hibernation_ops = {
* function is used if the pre-ACPI 2.0 suspend ordering has been
* requested.
*/
static int acpi_hibernation_begin_old(void)
static int acpi_hibernation_begin_old(pm_message_t stage)
{
int error;
/*
@@ -1211,16 +1215,21 @@ static int acpi_hibernation_begin_old(void)
acpi_sleep_tts_switch(ACPI_STATE_S4);
error = acpi_sleep_prepare(ACPI_STATE_S4);
if (error)
return error;
if (!error) {
if (!nvs_nosave)
error = suspend_nvs_alloc();
if (!error) {
acpi_target_sleep_state = ACPI_STATE_S4;
acpi_scan_lock_acquire();
}
if (!nvs_nosave) {
error = suspend_nvs_alloc();
if (error)
return error;
}
return error;
if (stage.event == PM_EVENT_HIBERNATE)
pm_set_suspend_via_firmware();
acpi_target_sleep_state = ACPI_STATE_S4;
acpi_scan_lock_acquire();
return 0;
}
/*