Skip to content

Commit 3c3ee53

Browse files
committed
thermal: core: Check passive delay in monitor_thermal_zone()
The only case in which thermal_zone_device_set_polling() is called with its second argument equal to zero is when passive cooling is under way and passive_delay_jiffies is 0, which only happens when the given thermal zone is not polled at all. If monitor_thermal_zone() is modified to check passive_delay_jiffies directly, the check of the thermal_zone_device_set_polling() second argument against 0 can be dropped and a passive_delay check can be dropped from thermal_zone_device_register_with_trips(), so change the code accordingly. No intentional functional impact. Signed-off-by: Rafael J. Wysocki <[email protected]> Link: https://patch.msgid.link/[email protected]
1 parent fcfacd5 commit 3c3ee53

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

drivers/thermal/thermal_core.c

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -323,11 +323,6 @@ static void thermal_zone_broken_disable(struct thermal_zone_device *tz)
323323
static void thermal_zone_device_set_polling(struct thermal_zone_device *tz,
324324
unsigned long delay)
325325
{
326-
if (!delay) {
327-
cancel_delayed_work(&tz->poll_queue);
328-
return;
329-
}
330-
331326
if (delay > HZ)
332327
delay = round_jiffies_relative(delay);
333328

@@ -364,7 +359,7 @@ static void thermal_zone_recheck(struct thermal_zone_device *tz, int error)
364359

365360
static void monitor_thermal_zone(struct thermal_zone_device *tz)
366361
{
367-
if (tz->passive > 0)
362+
if (tz->passive > 0 && tz->passive_delay_jiffies)
368363
thermal_zone_device_set_polling(tz, tz->passive_delay_jiffies);
369364
else if (tz->polling_delay_jiffies)
370365
thermal_zone_device_set_polling(tz, tz->polling_delay_jiffies);
@@ -1411,13 +1406,8 @@ thermal_zone_device_register_with_trips(const char *type,
14111406
if (num_trips > 0 && !trips)
14121407
return ERR_PTR(-EINVAL);
14131408

1414-
if (polling_delay) {
1415-
if (passive_delay > polling_delay)
1416-
return ERR_PTR(-EINVAL);
1417-
1418-
if (!passive_delay)
1419-
passive_delay = polling_delay;
1420-
}
1409+
if (polling_delay && passive_delay > polling_delay)
1410+
return ERR_PTR(-EINVAL);
14211411

14221412
if (!thermal_class)
14231413
return ERR_PTR(-ENODEV);

0 commit comments

Comments
 (0)