===================================================================
@@ -21,23 +21,21 @@
*/
static int get_trip_level(struct thermal_zone_device *tz)
{
- struct thermal_trip trip;
- int count;
+ const struct thermal_trip *trip = tz->trips;
+ int i;
- for (count = 0; count < tz->num_trips; count++) {
- __thermal_zone_get_trip(tz, count, &trip);
- if (tz->temperature < trip.temperature)
+ if (tz->temperature < trip->temperature)
+ return 0;
+
+ for (i = 0; i < tz->num_trips - 1; i++) {
+ trip++;
+ if (tz->temperature < trip->temperature)
break;
}
- /*
- * count > 0 only if temperature is greater than first trip
- * point, in which case, trip_point = count - 1
- */
- if (count > 0)
- trace_thermal_zone_trip(tz, count - 1, trip.type);
+ trace_thermal_zone_trip(tz, i, tz->trips[i].type);
- return count;
+ return i;
}
static long get_target_state(struct thermal_zone_device *tz,