]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
thermal: core: Relocate functions that update trip points
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 16 Oct 2024 11:32:13 +0000 (13:32 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 24 Oct 2024 15:15:07 +0000 (17:15 +0200)
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
drivers/thermal/thermal_core.c
drivers/thermal/thermal_trip.c

index 277076658ccdcda5495e03b250ac85f391c45a80..19c5eced452fb199a638ed441d97d6a483002c35 100644 (file)
@@ -541,6 +541,41 @@ static void thermal_trip_crossed(struct thermal_zone_device *tz,
        thermal_governor_trip_crossed(governor, tz, trip, crossed_up);
 }
 
+void thermal_zone_set_trip_hyst(struct thermal_zone_device *tz,
+                               struct thermal_trip *trip, int hyst)
+{
+       WRITE_ONCE(trip->hysteresis, hyst);
+       thermal_notify_tz_trip_change(tz, trip);
+}
+
+void thermal_zone_set_trip_temp(struct thermal_zone_device *tz,
+                               struct thermal_trip *trip, int temp)
+{
+       if (trip->temperature == temp)
+               return;
+
+       WRITE_ONCE(trip->temperature, temp);
+       thermal_notify_tz_trip_change(tz, trip);
+
+       if (temp == THERMAL_TEMP_INVALID) {
+               struct thermal_trip_desc *td = trip_to_trip_desc(trip);
+
+               /*
+                * If the trip has been crossed on the way up, some adjustments
+                * are needed to compensate for the lack of it going forward.
+                */
+               if (tz->temperature >= td->threshold)
+                       thermal_zone_trip_down(tz, td);
+
+               /*
+                * Invalidate the threshold to avoid triggering a spurious
+                * trip crossing notification when the trip becomes valid.
+                */
+               td->threshold = INT_MAX;
+       }
+}
+EXPORT_SYMBOL_GPL(thermal_zone_set_trip_temp);
+
 void __thermal_zone_device_update(struct thermal_zone_device *tz,
                                  enum thermal_notify_event event)
 {
index 5cafea8dc8040ea218a577ac0a3a3a5786bb8d8a..4b8238468b5343c6d1d30c3b95caf8af30580914 100644 (file)
@@ -88,38 +88,3 @@ int thermal_zone_trip_id(const struct thermal_zone_device *tz,
         */
        return trip_to_trip_desc(trip) - tz->trips;
 }
-
-void thermal_zone_set_trip_hyst(struct thermal_zone_device *tz,
-                               struct thermal_trip *trip, int hyst)
-{
-       WRITE_ONCE(trip->hysteresis, hyst);
-       thermal_notify_tz_trip_change(tz, trip);
-}
-
-void thermal_zone_set_trip_temp(struct thermal_zone_device *tz,
-                               struct thermal_trip *trip, int temp)
-{
-       if (trip->temperature == temp)
-               return;
-
-       WRITE_ONCE(trip->temperature, temp);
-       thermal_notify_tz_trip_change(tz, trip);
-
-       if (temp == THERMAL_TEMP_INVALID) {
-               struct thermal_trip_desc *td = trip_to_trip_desc(trip);
-
-               /*
-                * If the trip has been crossed on the way up, some adjustments
-                * are needed to compensate for the lack of it going forward.
-                */
-               if (tz->temperature >= td->threshold)
-                       thermal_zone_trip_down(tz, td);
-
-               /*
-                * Invalidate the threshold to avoid triggering a spurious
-                * trip crossing notification when the trip becomes valid.
-                */
-               td->threshold = INT_MAX;
-       }
-}
-EXPORT_SYMBOL_GPL(thermal_zone_set_trip_temp);