Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit 893bae9

Browse files
committed
thermal: trip: Make thermal_zone_set_trips() use trip thresholds
Modify thermal_zone_set_trips() to use trip thresholds instead of computing the low temperature for each trip to avoid deriving both the high and low temperature levels from the same trip (which may happen if the zone temperature falls into the hysteresis range of one trip). Accordingly, make __thermal_zone_device_update() call thermal_zone_set_trips() later, when threshold values have been updated for all trips. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
1 parent 28d5cc1 commit 893bae9

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

drivers/thermal/thermal_core.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -513,13 +513,13 @@ void __thermal_zone_device_update(struct thermal_zone_device *tz,
513513
if (tz->temperature == THERMAL_TEMP_INVALID)
514514
return;
515515

516-
thermal_zone_set_trips(tz);
517-
518516
tz->notify_event = event;
519517

520518
for_each_trip_desc(tz, td)
521519
handle_thermal_trip(tz, td, &way_up_list, &way_down_list);
522520

521+
thermal_zone_set_trips(tz);
522+
523523
list_sort(&way_up_list, &way_up_list, thermal_trip_notify_cmp);
524524
list_for_each_entry(td, &way_up_list, notify_list_node)
525525
thermal_trip_crossed(tz, &td->trip, governor, true);

drivers/thermal/thermal_trip.c

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

9090
for_each_trip_desc(tz, td) {
91-
const struct thermal_trip *trip = &td->trip;
92-
int trip_low;
91+
if (td->threshold < tz->temperature && td->threshold > low)
92+
low = td->threshold;
9393

94-
trip_low = trip->temperature - trip->hysteresis;
95-
96-
if (trip_low < tz->temperature && trip_low > low)
97-
low = trip_low;
98-
99-
if (trip->temperature > tz->temperature &&
100-
trip->temperature < high)
101-
high = trip->temperature;
94+
if (td->threshold > tz->temperature && td->threshold < high)
95+
high = td->threshold;
10296
}
10397

10498
/* No need to change trip points */

0 commit comments

Comments
 (0)