]> git.ipfire.org Git - thirdparty/linux.git/commit
PM: sleep: Move devices to new lists earlier in each suspend phase
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 29 Jan 2024 16:28:37 +0000 (17:28 +0100)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 5 Feb 2024 13:28:54 +0000 (14:28 +0100)
commit96db0f947a14df754586ac38bc0d50ab8dae013c
treecb2a7705667879869bc3309c6334869c9df34350
parenta4b64b893428734fc872a162ca7d92aa1ca1c429
PM: sleep: Move devices to new lists earlier in each suspend phase

During a system-wide suspend of devices, dpm_noirq_suspend_devices(),
dpm_suspend_late() and dpm_suspend() move devices from one list to
another.  They do it with each device after its PM callback in the
given suspend phase has run or has been scheduled for asynchronous
execution, in case it is deleted from the current list in the
meantime.

However, devices can be moved to a new list before invoking their PM
callbacks (which usually is the case for the devices whose callbacks
are executed asynchronously anyway), because doing so does not affect
the ordering of that list.  In either case, each device is moved to
the new list after the previous device has been moved to it or gone
away, and if a device is removed, it does not matter which list it is
in at that point, because deleting an entry from a list does not change
the ordering of the other entries in it.

Accordingly, modify the functions mentioned above to move devices to
new lists without waiting for their PM callbacks to run regardless of
whether or not they run asynchronously.

No intentional functional impact.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/base/power/main.c