Skip to content

Commit b56bdff

Browse files
andrzejtpdlezcano
authored andcommitted
thermal: core: Stop polling DISABLED thermal devices
Polling DISABLED devices is not desired, as all such "disabled" devices are meant to be handled by userspace. This patch introduces and uses should_stop_polling() to decide whether the device should be polled or not. Signed-off-by: Andrzej Pietrasiewicz <[email protected]> Reviewed-by: Bartlomiej Zolnierkiewicz <[email protected]> Reviewed-by: Amit Kucheria <[email protected]> Signed-off-by: Daniel Lezcano <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent bbcf90c commit b56bdff

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

drivers/thermal/thermal_core.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,13 +301,22 @@ static void thermal_zone_device_set_polling(struct thermal_zone_device *tz,
301301
cancel_delayed_work(&tz->poll_queue);
302302
}
303303

304+
static inline bool should_stop_polling(struct thermal_zone_device *tz)
305+
{
306+
return !thermal_zone_device_is_enabled(tz);
307+
}
308+
304309
static void monitor_thermal_zone(struct thermal_zone_device *tz)
305310
{
311+
bool stop;
312+
313+
stop = should_stop_polling(tz);
314+
306315
mutex_lock(&tz->lock);
307316

308-
if (tz->passive)
317+
if (!stop && tz->passive)
309318
thermal_zone_device_set_polling(tz, tz->passive_delay);
310-
else if (tz->polling_delay)
319+
else if (!stop && tz->polling_delay)
311320
thermal_zone_device_set_polling(tz, tz->polling_delay);
312321
else
313322
thermal_zone_device_set_polling(tz, 0);
@@ -517,6 +526,9 @@ void thermal_zone_device_update(struct thermal_zone_device *tz,
517526
{
518527
int count;
519528

529+
if (should_stop_polling(tz))
530+
return;
531+
520532
if (atomic_read(&in_suspend))
521533
return;
522534

0 commit comments

Comments
 (0)