Commit d2278f3
committed
thermal: core: Synchronize suspend-prepare and post-suspend actions
After commit 5a5efda ("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: 5a5efda ("thermal: core: Resume thermal zones asynchronously")
Signed-off-by: Rafael J. Wysocki <[email protected]>1 parent 83a7eef commit d2278f3
2 files changed
+25
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1397 | 1397 | | |
1398 | 1398 | | |
1399 | 1399 | | |
| 1400 | + | |
1400 | 1401 | | |
1401 | 1402 | | |
1402 | 1403 | | |
| |||
1642 | 1643 | | |
1643 | 1644 | | |
1644 | 1645 | | |
| 1646 | + | |
| 1647 | + | |
| 1648 | + | |
1645 | 1649 | | |
1646 | 1650 | | |
1647 | 1651 | | |
| |||
1659 | 1663 | | |
1660 | 1664 | | |
1661 | 1665 | | |
| 1666 | + | |
| 1667 | + | |
| 1668 | + | |
| 1669 | + | |
| 1670 | + | |
| 1671 | + | |
| 1672 | + | |
| 1673 | + | |
| 1674 | + | |
| 1675 | + | |
| 1676 | + | |
| 1677 | + | |
| 1678 | + | |
| 1679 | + | |
1662 | 1680 | | |
1663 | 1681 | | |
1664 | 1682 | | |
| |||
1676 | 1694 | | |
1677 | 1695 | | |
1678 | 1696 | | |
| 1697 | + | |
| 1698 | + | |
| 1699 | + | |
1679 | 1700 | | |
1680 | 1701 | | |
1681 | 1702 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| 58 | + | |
58 | 59 | | |
59 | 60 | | |
60 | 61 | | |
| |||
89 | 90 | | |
90 | 91 | | |
91 | 92 | | |
| 93 | + | |
92 | 94 | | |
93 | 95 | | |
94 | 96 | | |
95 | 97 | | |
96 | 98 | | |
97 | 99 | | |
98 | 100 | | |
| 101 | + | |
99 | 102 | | |
100 | 103 | | |
101 | 104 | | |
| |||
123 | 126 | | |
124 | 127 | | |
125 | 128 | | |
| 129 | + | |
126 | 130 | | |
127 | 131 | | |
128 | 132 | | |
| |||
0 commit comments