Skip to content

Commit e654a0c

Browse files
committed
thermal: core: Relocate functions that update trip points
In preparation for subsequent changes, move two functions used for updating trip points, thermal_zone_set_trip_temp() and thermal_zone_set_trip_hyst(), to thermal_core.c. No functional impact. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Lukasz Luba <lukasz.luba@arm.com> Link: https://patch.msgid.link/3248558.5fSG56mABF@rjwysocki.net
1 parent 72fb849 commit e654a0c

File tree

2 files changed

+35
-35
lines changed

2 files changed

+35
-35
lines changed

drivers/thermal/thermal_core.c

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,41 @@ static void thermal_trip_crossed(struct thermal_zone_device *tz,
541541
thermal_governor_trip_crossed(governor, tz, trip, crossed_up);
542542
}
543543

544+
void thermal_zone_set_trip_hyst(struct thermal_zone_device *tz,
545+
struct thermal_trip *trip, int hyst)
546+
{
547+
WRITE_ONCE(trip->hysteresis, hyst);
548+
thermal_notify_tz_trip_change(tz, trip);
549+
}
550+
551+
void thermal_zone_set_trip_temp(struct thermal_zone_device *tz,
552+
struct thermal_trip *trip, int temp)
553+
{
554+
if (trip->temperature == temp)
555+
return;
556+
557+
WRITE_ONCE(trip->temperature, temp);
558+
thermal_notify_tz_trip_change(tz, trip);
559+
560+
if (temp == THERMAL_TEMP_INVALID) {
561+
struct thermal_trip_desc *td = trip_to_trip_desc(trip);
562+
563+
/*
564+
* If the trip has been crossed on the way up, some adjustments
565+
* are needed to compensate for the lack of it going forward.
566+
*/
567+
if (tz->temperature >= td->threshold)
568+
thermal_zone_trip_down(tz, td);
569+
570+
/*
571+
* Invalidate the threshold to avoid triggering a spurious
572+
* trip crossing notification when the trip becomes valid.
573+
*/
574+
td->threshold = INT_MAX;
575+
}
576+
}
577+
EXPORT_SYMBOL_GPL(thermal_zone_set_trip_temp);
578+
544579
void __thermal_zone_device_update(struct thermal_zone_device *tz,
545580
enum thermal_notify_event event)
546581
{

drivers/thermal/thermal_trip.c

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -88,38 +88,3 @@ int thermal_zone_trip_id(const struct thermal_zone_device *tz,
8888
*/
8989
return trip_to_trip_desc(trip) - tz->trips;
9090
}
91-
92-
void thermal_zone_set_trip_hyst(struct thermal_zone_device *tz,
93-
struct thermal_trip *trip, int hyst)
94-
{
95-
WRITE_ONCE(trip->hysteresis, hyst);
96-
thermal_notify_tz_trip_change(tz, trip);
97-
}
98-
99-
void thermal_zone_set_trip_temp(struct thermal_zone_device *tz,
100-
struct thermal_trip *trip, int temp)
101-
{
102-
if (trip->temperature == temp)
103-
return;
104-
105-
WRITE_ONCE(trip->temperature, temp);
106-
thermal_notify_tz_trip_change(tz, trip);
107-
108-
if (temp == THERMAL_TEMP_INVALID) {
109-
struct thermal_trip_desc *td = trip_to_trip_desc(trip);
110-
111-
/*
112-
* If the trip has been crossed on the way up, some adjustments
113-
* are needed to compensate for the lack of it going forward.
114-
*/
115-
if (tz->temperature >= td->threshold)
116-
thermal_zone_trip_down(tz, td);
117-
118-
/*
119-
* Invalidate the threshold to avoid triggering a spurious
120-
* trip crossing notification when the trip becomes valid.
121-
*/
122-
td->threshold = INT_MAX;
123-
}
124-
}
125-
EXPORT_SYMBOL_GPL(thermal_zone_set_trip_temp);

0 commit comments

Comments
 (0)