Commit e8665002 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki

PM: Allow pm_runtime_suspend() to succeed during system suspend

The dpm_prepare() function increments the runtime PM reference
counters of all devices to prevent pm_runtime_suspend() from
executing subsystem-level callbacks.  However, this was supposed to
guard against a specific race condition that cannot happen, because
the power management workqueue is freezable, so pm_runtime_suspend()
can only be called synchronously during system suspend and we can
rely on subsystems and device drivers to avoid doing that

Make dpm_prepare() drop the runtime PM reference to each device
after making sure that runtime resume is not pending for it.
Signed-off-by: default avatarRafael J. Wysocki <>
Acked-by: default avatarKevin Hilman <>
parent 88a6f33e
......@@ -669,7 +669,6 @@ static void dpm_complete(pm_message_t state)
device_complete(dev, state);
......@@ -1005,12 +1004,9 @@ static int dpm_prepare(pm_message_t state)
if (pm_runtime_barrier(dev) && device_may_wakeup(dev))
pm_wakeup_event(dev, 0);
if (pm_wakeup_pending()) {
error = -EBUSY;
} else {
error = device_prepare(dev, state);
error = pm_wakeup_pending() ?
-EBUSY : device_prepare(dev, state);
if (error) {
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment