@@ -305,13 +305,32 @@ static void thermal_zone_device_set_polling(struct thermal_zone_device *tz,
cancel_delayed_work(&tz->poll_queue);
}
+static bool should_stop_polling(struct thermal_zone_device *tz)
+{
+ enum thermal_device_mode mode;
+ int result;
+
+ if (!tz->ops->get_mode)
+ return false;
+
+ result = tz->ops->get_mode(tz, &mode);
+ if (result)
+ return false;
+
+ return mode == THERMAL_DEVICE_DISABLED;
+}
+
static void monitor_thermal_zone(struct thermal_zone_device *tz)
{
+ bool stop;
+
+ stop = should_stop_polling(tz);
+
mutex_lock(&tz->lock);
- if (tz->passive)
+ if (!stop && tz->passive)
thermal_zone_device_set_polling(tz, tz->passive_delay);
- else if (tz->polling_delay)
+ else if (!stop && tz->polling_delay)
thermal_zone_device_set_polling(tz, tz->polling_delay);
else
thermal_zone_device_set_polling(tz, 0);
@@ -500,6 +519,9 @@ void thermal_zone_device_update(struct thermal_zone_device *tz,
{
int count;
+ if (should_stop_polling(tz))
+ return;
+
if (atomic_read(&in_suspend))
return;
Polling DISABLED devices is not desired, as all such "disabled" devices are meant to be handled by userspace. Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com> --- drivers/thermal/thermal_core.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-)