Skip to content
Commit d2278f35 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki
Browse files

thermal: core: Synchronize suspend-prepare and post-suspend actions



After commit 5a5efdaf ("thermal: core: Resume thermal zones
asynchronously") it is theoretically possible that, if a system suspend
starts immediately after a system resume, thermal_zone_device_resume()
spawned by the thermal PM notifier for one of the thermal zones at the
end of the system resume will run after the PM thermal notifier for the
suspend-prepare action.  If that happens, tz->suspended set by the latter
will be reset by the former which may lead to unexpected consequences.

To avoid that race, synchronize thermal_zone_device_resume() with the
suspend-prepare thermal PM notifier with the help of additional bool
field and completion in struct thermal_zone_device.

Note that this also ensures running __thermal_zone_device_update() at
least once for each thermal zone between system resume and the following
system suspend in case it is needed to start thermal mitigation.

Fixes: 5a5efdaf ("thermal: core: Resume thermal zones asynchronously")
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 83a7eefe
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment