@@ -292,6 +292,17 @@ static void thermal_unregister_governors(void)
static void thermal_zone_device_set_polling(struct thermal_zone_device *tz,
int delay)
{
+ enum thermal_device_mode mode;
+
+ if (tz->ops->get_mode) {
+ /* When the thermal zone is disabled stop the polling */
+ tz->ops->get_mode(tz, &mode);
+ if (mode == THERMAL_DEVICE_DISABLED) {
+ cancel_delayed_work(&tz->poll_queue);
+ return;
+ }
+ }
+
if (delay > 1000)
mod_delayed_work(system_freezable_wq, &tz->poll_queue,
round_jiffies(msecs_to_jiffies(delay)));
Under each thermal zone there is a optional file called "mode". Writing enabled or disabled to this file allows a given thermal zone to be enabled or disabled, but in current code, the monitoring queue doesn't stops. Add the code to disable polling when disabling thermal zone and enable polling when enabling the thermal zone. This patch is based on the original Sameer Nanda <snanda@chromium.org> patch that implemented this idea for the ACPI thermal driver. Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> --- Changes since v1: - Implement in thermal subsystem instead of ACPI thermal driver (Zhang Rui) v1: https://patchwork.kernel.org/patch/9804229/ drivers/thermal/thermal_core.c | 11 +++++++++++ 1 file changed, 11 insertions(+)