Skip to content

Commit f844793

Browse files
committed
thermal: trip: Avoid skipping trips in thermal_zone_set_trips()
Say there are 3 trip points A, B, C sorted in ascending temperature order with no hysteresis. If the zone temerature is exactly equal to B, thermal_zone_set_trips() will set the boundaries to A and C and the hardware will not catch any crossing of B (either way) until either A or C is crossed and the boundaries are changed. To avoid that, use non-strict inequalities when comparing the trip threshold to the zone temperature in thermal_zone_set_trips(). In the example above, it will cause both boundaries to be set to B, which is desirable because an interrupt will trigger when the zone temperature becomes different from B regardless of which way it goes. That will allow a new interval to be set depending on the direction of the zone temperature change. Fixes: 893bae9 ("thermal: trip: Make thermal_zone_set_trips() use trip thresholds") Signed-off-by: Rafael J. Wysocki <[email protected]> Link: https://patch.msgid.link/[email protected]
1 parent 8400291 commit f844793

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/thermal/thermal_trip.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,10 @@ void thermal_zone_set_trips(struct thermal_zone_device *tz)
8888
return;
8989

9090
for_each_trip_desc(tz, td) {
91-
if (td->threshold < tz->temperature && td->threshold > low)
91+
if (td->threshold <= tz->temperature && td->threshold > low)
9292
low = td->threshold;
9393

94-
if (td->threshold > tz->temperature && td->threshold < high)
94+
if (td->threshold >= tz->temperature && td->threshold < high)
9595
high = td->threshold;
9696
}
9797

0 commit comments

Comments
 (0)