History

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.

Andrzej Pietrasiewicz committed 6 years ago

Commit b56bdff1 parent bbcf90c1 file · +14 −2Browse files

Unified · Split

drivers/thermal/thermal_core.c+14−2
@@ -301,13 +301,22 @@ static void thermal_zone_device_set_polling(struct thermal_zone_device *tz, · 300 unmodified lines
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, · 203 unmodified lines
517526 {
518527 int count;
519528
529+ if (should_stop_polling(tz))
530+ return;
531+
520532 if (atomic_read(&in_suspend))
521533 return;
522534

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t