• Rafael J. Wysocki's avatar
    PM / sleep: Avoid excess pm_runtime_enable() calls in device_resume() · 3487972d
    Rafael J. Wysocki authored
    Middle-layer code doing suspend-time optimizations for devices with
    the DPM_FLAG_SMART_SUSPEND flag set (currently, the PCI bus type and
    the ACPI PM domain) needs to make the core skip ->thaw_early and
    ->thaw callbacks for those devices in some cases and it sets the
    power.direct_complete flag for them for this purpose.
    
    However, it turns out that setting power.direct_complete outside of
    the PM core is a bad idea as it triggers an excess invocation of
    pm_runtime_enable() in device_resume().
    
    For this reason, provide a helper to clear power.is_late_suspended
    and power.is_suspended to be invoked by the middle-layer code in
    question instead of setting power.direct_complete and make that code
    call the new helper.
    
    Fixes: c4b65157 (PCI / PM: Take SMART_SUSPEND driver flag into account)
    Fixes: 05087360 (ACPI / PM: Take SMART_SUSPEND driver flag into account)
    Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
    Reviewed-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
    Acked-by: default avatarBjorn Helgaas <bhelgaas@google.com>
    3487972d
device_pm.c 34.7 KB