@@ -307,7 +307,8 @@ static void monitor_thermal_zone(struct thermal_zone_device *tz)
307307 thermal_zone_device_set_polling (tz , tz -> polling_delay_jiffies );
308308}
309309
310- static void handle_non_critical_trips (struct thermal_zone_device * tz , int trip )
310+ static void handle_non_critical_trips (struct thermal_zone_device * tz ,
311+ const struct thermal_trip * trip )
311312{
312313 tz -> governor ? tz -> governor -> throttle (tz , trip ) :
313314 def_governor -> throttle (tz , trip );
@@ -329,44 +330,43 @@ void thermal_zone_device_critical(struct thermal_zone_device *tz)
329330EXPORT_SYMBOL (thermal_zone_device_critical );
330331
331332static void handle_critical_trips (struct thermal_zone_device * tz ,
332- int trip , int trip_temp , enum thermal_trip_type trip_type )
333+ const struct thermal_trip * trip )
333334{
334335 /* If we have not crossed the trip_temp, we do not care. */
335- if (trip_temp <= 0 || tz -> temperature < trip_temp )
336+ if (trip -> temperature <= 0 || tz -> temperature < trip -> temperature )
336337 return ;
337338
338- trace_thermal_zone_trip (tz , trip , trip_type );
339+ trace_thermal_zone_trip (tz , thermal_zone_trip_id ( tz , trip ), trip -> type );
339340
340- if (trip_type == THERMAL_TRIP_HOT && tz -> ops -> hot )
341- tz -> ops -> hot (tz );
342- else if (trip_type == THERMAL_TRIP_CRITICAL )
341+ if (trip -> type == THERMAL_TRIP_CRITICAL )
343342 tz -> ops -> critical (tz );
343+ else if (tz -> ops -> hot )
344+ tz -> ops -> hot (tz );
344345}
345346
346- static void handle_thermal_trip (struct thermal_zone_device * tz , int trip_id )
347+ static void handle_thermal_trip (struct thermal_zone_device * tz ,
348+ const struct thermal_trip * trip )
347349{
348- struct thermal_trip trip ;
349-
350- __thermal_zone_get_trip (tz , trip_id , & trip );
351-
352- if (trip .temperature == THERMAL_TEMP_INVALID )
350+ if (trip -> temperature == THERMAL_TEMP_INVALID )
353351 return ;
354352
355353 if (tz -> last_temperature != THERMAL_TEMP_INVALID ) {
356- if (tz -> last_temperature < trip .temperature &&
357- tz -> temperature >= trip .temperature )
358- thermal_notify_tz_trip_up (tz -> id , trip_id ,
354+ if (tz -> last_temperature < trip -> temperature &&
355+ tz -> temperature >= trip -> temperature )
356+ thermal_notify_tz_trip_up (tz -> id ,
357+ thermal_zone_trip_id (tz , trip ),
359358 tz -> temperature );
360- if (tz -> last_temperature >= trip .temperature &&
361- tz -> temperature < (trip .temperature - trip .hysteresis ))
362- thermal_notify_tz_trip_down (tz -> id , trip_id ,
359+ if (tz -> last_temperature >= trip -> temperature &&
360+ tz -> temperature < trip -> temperature - trip -> hysteresis )
361+ thermal_notify_tz_trip_down (tz -> id ,
362+ thermal_zone_trip_id (tz , trip ),
363363 tz -> temperature );
364364 }
365365
366- if (trip . type == THERMAL_TRIP_CRITICAL || trip . type == THERMAL_TRIP_HOT )
367- handle_critical_trips (tz , trip_id , trip . temperature , trip . type );
366+ if (trip -> type == THERMAL_TRIP_CRITICAL || trip -> type == THERMAL_TRIP_HOT )
367+ handle_critical_trips (tz , trip );
368368 else
369- handle_non_critical_trips (tz , trip_id );
369+ handle_non_critical_trips (tz , trip );
370370}
371371
372372static void update_temperature (struct thermal_zone_device * tz )
@@ -403,7 +403,7 @@ static void thermal_zone_device_init(struct thermal_zone_device *tz)
403403void __thermal_zone_device_update (struct thermal_zone_device * tz ,
404404 enum thermal_notify_event event )
405405{
406- int count ;
406+ const struct thermal_trip * trip ;
407407
408408 if (atomic_read (& in_suspend ))
409409 return ;
@@ -422,8 +422,8 @@ void __thermal_zone_device_update(struct thermal_zone_device *tz,
422422
423423 tz -> notify_event = event ;
424424
425- for ( count = 0 ; count < tz -> num_trips ; count ++ )
426- handle_thermal_trip (tz , count );
425+ for_each_trip ( tz , trip )
426+ handle_thermal_trip (tz , trip );
427427
428428 monitor_thermal_zone (tz );
429429}
0 commit comments