diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2023-12-04 20:46:35 +0100 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2023-12-13 12:33:43 +0100 |
commit | 2e3e7dad4bf5ad869e8dc9fa09151913154318b0 (patch) | |
tree | 40c3c6281fa8bfa7a076febab453f41d93097628 /drivers/thermal/thermal_helpers.c | |
parent | 0c0c4740c9d2668a234f7743ba50d54acab0821c (diff) |
thermal: helpers: Use for_each_trip() in __thermal_zone_get_temp()
Make __thermal_zone_get_temp() use for_each_trip() instead of an open-
coded loop over trip indices.
No intentional functional impact.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
Diffstat (limited to 'drivers/thermal/thermal_helpers.c')
-rw-r--r-- | drivers/thermal/thermal_helpers.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/thermal/thermal_helpers.c b/drivers/thermal/thermal_helpers.c index d0afb623e475..c3982e0f0075 100644 --- a/drivers/thermal/thermal_helpers.c +++ b/drivers/thermal/thermal_helpers.c @@ -82,20 +82,18 @@ EXPORT_SYMBOL(get_thermal_instance); */ int __thermal_zone_get_temp(struct thermal_zone_device *tz, int *temp) { - int ret = -EINVAL; - int count; + const struct thermal_trip *trip; int crit_temp = INT_MAX; - struct thermal_trip trip; + int ret = -EINVAL; lockdep_assert_held(&tz->lock); ret = tz->ops->get_temp(tz, temp); if (IS_ENABLED(CONFIG_THERMAL_EMULATION) && tz->emul_temperature) { - for (count = 0; count < tz->num_trips; count++) { - ret = __thermal_zone_get_trip(tz, count, &trip); - if (!ret && trip.type == THERMAL_TRIP_CRITICAL) { - crit_temp = trip.temperature; + for_each_trip(tz, trip) { + if (trip->type == THERMAL_TRIP_CRITICAL) { + crit_temp = trip->temperature; break; } } |