summaryrefslogtreecommitdiff
path: root/drivers/thermal
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2024-04-23 21:01:15 +0200
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2024-04-24 20:45:06 +0200
commitf831892e2351dc13b37b4c1fc60472be781a15be (patch)
tree784c2af0978ed27be2ae52f64153d4ee1bb4e5d6 /drivers/thermal
parenta6258fde8de34b2bfd7e1d4e55df261426e49071 (diff)
thermal: core: Introduce thermal_governor_trip_crossed()
Add a wrapper around the .trip_crossed() governor callback invocation to reduce code duplications slightly and improve the code layout in __thermal_zone_device_update(). No intentional functional impact. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
Diffstat (limited to 'drivers/thermal')
-rw-r--r--drivers/thermal/thermal_core.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index 4debd3c9f327..64036372e240 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -450,6 +450,15 @@ static void thermal_zone_device_init(struct thermal_zone_device *tz)
pos->initialized = false;
}
+static void thermal_governor_trip_crossed(struct thermal_governor *governor,
+ struct thermal_zone_device *tz,
+ const struct thermal_trip *trip,
+ bool crossed_up)
+{
+ if (governor->trip_crossed)
+ governor->trip_crossed(tz, trip, crossed_up);
+}
+
static int thermal_trip_notify_cmp(void *ascending, const struct list_head *a,
const struct list_head *b)
{
@@ -489,16 +498,14 @@ void __thermal_zone_device_update(struct thermal_zone_device *tz,
list_for_each_entry(td, &way_up_list, notify_list_node) {
thermal_notify_tz_trip_up(tz, &td->trip);
thermal_debug_tz_trip_up(tz, &td->trip);
- if (governor->trip_crossed)
- governor->trip_crossed(tz, &td->trip, true);
+ thermal_governor_trip_crossed(governor, tz, &td->trip, true);
}
list_sort(NULL, &way_down_list, thermal_trip_notify_cmp);
list_for_each_entry(td, &way_down_list, notify_list_node) {
thermal_notify_tz_trip_down(tz, &td->trip);
thermal_debug_tz_trip_down(tz, &td->trip);
- if (governor->trip_crossed)
- governor->trip_crossed(tz, &td->trip, false);
+ thermal_governor_trip_crossed(governor, tz, &td->trip, false);
}
if (governor->manage)