thermal: core: Resume thermal zones asynchronously
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 18 Dec 2023 19:28:31 +0000 (20:28 +0100)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 28 Dec 2023 13:20:16 +0000 (14:20 +0100)
commit5a5efdaffda5d23717d9117cf36cda9eafcf2fae
treedb01594d0aadf17e5a5cb703f179ebc2b9e92556
parent33fcb595dc14678717274c270d02c7d7e0a3c404
thermal: core: Resume thermal zones asynchronously

The resume of thermal zones in thermal_pm_notify() is carried out
sequentially, which may be a problem if __thermal_zone_device_update()
takes a significant time to run for some thermal zones, because some
other thermal zones may need to wait for them to resume then and if
any other PM notifiers are going to be invoked after the thermal one,
they will need to wait for it either.

To address this, make thermal_pm_notify() switch the poll_queue delayed
work over to a one-shot thermal_zone_device_resume() work function that
will restore the original one during the thermal zone resume and queue
up poll_queue without a delay for each thermal zone.

Link: https://lore.kernel.org/linux-pm/20231120234015.3273143-1-radusolea@google.com/
Reported-by: Radu Solea <radusolea@google.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/thermal/thermal_core.c