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
301 cancel_delayed_work(&tz->poll_queue);301 cancel_delayed_work(&tz->poll_queue);
302}302}
303 303
304static inline bool should_stop_polling(struct thermal_zone_device *tz)
305{
306 return !thermal_zone_device_is_enabled(tz);
307}
308
304static void monitor_thermal_zone(struct thermal_zone_device *tz)309static void monitor_thermal_zone(struct thermal_zone_device *tz)
305{310{
311 bool stop;
312
313 stop = should_stop_polling(tz);
314
306 mutex_lock(&tz->lock);315 mutex_lock(&tz->lock);
307 316
308 if (tz->passive)317 if (!stop && tz->passive)
309 thermal_zone_device_set_polling(tz, tz->passive_delay);318 thermal_zone_device_set_polling(tz, tz->passive_delay);
310 else if (tz->polling_delay)319 else if (!stop && tz->polling_delay)
311 thermal_zone_device_set_polling(tz, tz->polling_delay);320 thermal_zone_device_set_polling(tz, tz->polling_delay);
312 else321 else
313 thermal_zone_device_set_polling(tz, 0);322 thermal_zone_device_set_polling(tz, 0);
@@ -517,6 +526,9 @@ void thermal_zone_device_update(struct thermal_zone_device *tz, · 203 unmodified lines
517{526{
518 int count;527 int count;
519 528
529 if (should_stop_polling(tz))
530 return;
531
520 if (atomic_read(&in_suspend))532 if (atomic_read(&in_suspend))
521 return;533 return;
522 534

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