Commit 2e3e7dad authored by Rafael J. Wysocki's avatar Rafael J. Wysocki

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: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
Reviewed-by: default avatarLukasz Luba <lukasz.luba@arm.com>
parent 0c0c4740
......@@ -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;
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment