]> git.baikalelectronics.ru Git - kernel.git/commit
PM / sleep: Avoid excess pm_runtime_enable() calls in device_resume()
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 7 Dec 2017 01:41:18 +0000 (02:41 +0100)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 11 Dec 2017 13:32:56 +0000 (14:32 +0100)
commitfd7202f04a94e4195fa6d481e5edffec4649e6e6
treee44e9769fce8d3499bf53beae6029232dd1a5d5b
parentea68337e28b82c07e8a30cf1ca577c275fb830c6
PM / sleep: Avoid excess pm_runtime_enable() calls in device_resume()

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: 9d6828a5cd1d (PCI / PM: Take SMART_SUSPEND driver flag into account)
Fixes: 6640d1e99453 (ACPI / PM: Take SMART_SUSPEND driver flag into account)
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
drivers/acpi/device_pm.c
drivers/base/power/main.c
drivers/pci/pci-driver.c
include/linux/pm.h