@@ -81,7 +81,6 @@ static struct workqueue_struct *acpi_thermal_pm_queue;
8181
8282struct acpi_thermal_trip {
8383 unsigned long temperature ;
84- bool valid ;
8584};
8685
8786struct acpi_thermal_passive {
@@ -175,11 +174,9 @@ static int acpi_thermal_temp(struct acpi_thermal *tz, int temp_deci_k)
175174 tz -> kelvin_offset );
176175}
177176
178- static void update_acpi_thermal_trip_temp (struct acpi_thermal_trip * acpi_trip ,
179- int temp )
177+ static bool acpi_thermal_trip_valid (struct acpi_thermal_trip * acpi_trip )
180178{
181- acpi_trip -> valid = temp != THERMAL_TEMP_INVALID ;
182- acpi_trip -> temperature = temp ;
179+ return acpi_trip -> temperature != THERMAL_TEMP_INVALID ;
183180}
184181
185182static long get_passive_temp (struct acpi_thermal * tz )
@@ -198,11 +195,11 @@ static void acpi_thermal_update_passive_trip(struct acpi_thermal *tz)
198195{
199196 struct acpi_thermal_trip * acpi_trip = & tz -> trips .passive .trip ;
200197
201- if (!acpi_trip -> valid || psv > 0 )
198+ if (!acpi_thermal_trip_valid ( acpi_trip ) || psv > 0 )
202199 return ;
203200
204- update_acpi_thermal_trip_temp ( acpi_trip , get_passive_temp (tz ) );
205- if (!acpi_trip -> valid )
201+ acpi_trip -> temperature = get_passive_temp (tz );
202+ if (!acpi_thermal_trip_valid ( acpi_trip ) )
206203 ACPI_THERMAL_TRIPS_EXCEPTION (tz , "state" );
207204}
208205
@@ -231,13 +228,13 @@ static void acpi_thermal_update_passive_devices(struct acpi_thermal *tz)
231228{
232229 struct acpi_thermal_trip * acpi_trip = & tz -> trips .passive .trip ;
233230
234- if (!acpi_trip -> valid )
231+ if (!acpi_thermal_trip_valid ( acpi_trip ) )
235232 return ;
236233
237234 if (update_passive_devices (tz , true))
238235 return ;
239236
240- update_acpi_thermal_trip_temp ( acpi_trip , THERMAL_TEMP_INVALID ) ;
237+ acpi_trip -> temperature = THERMAL_TEMP_INVALID ;
241238 ACPI_THERMAL_TRIPS_EXCEPTION (tz , "state" );
242239}
243240
@@ -268,11 +265,11 @@ static void acpi_thermal_update_active_trip(struct acpi_thermal *tz, int index)
268265{
269266 struct acpi_thermal_trip * acpi_trip = & tz -> trips .active [index ].trip ;
270267
271- if (!acpi_trip -> valid )
268+ if (!acpi_thermal_trip_valid ( acpi_trip ) )
272269 return ;
273270
274- update_acpi_thermal_trip_temp ( acpi_trip , get_active_temp (tz , index ) );
275- if (!acpi_trip -> valid )
271+ acpi_trip -> temperature = get_active_temp (tz , index );
272+ if (!acpi_thermal_trip_valid ( acpi_trip ) )
276273 ACPI_THERMAL_TRIPS_EXCEPTION (tz , "state" );
277274}
278275
@@ -303,13 +300,13 @@ static void acpi_thermal_update_active_devices(struct acpi_thermal *tz, int inde
303300{
304301 struct acpi_thermal_trip * acpi_trip = & tz -> trips .active [index ].trip ;
305302
306- if (!acpi_trip -> valid )
303+ if (!acpi_thermal_trip_valid ( acpi_trip ) )
307304 return ;
308305
309306 if (update_active_devices (tz , index , true))
310307 return ;
311308
312- update_acpi_thermal_trip_temp ( acpi_trip , THERMAL_TEMP_INVALID ) ;
309+ acpi_trip -> temperature = THERMAL_TEMP_INVALID ;
313310 ACPI_THERMAL_TRIPS_EXCEPTION (tz , "state" );
314311}
315312
@@ -321,7 +318,7 @@ static int acpi_thermal_adjust_trip(struct thermal_trip *trip, void *data)
321318 if (!acpi_trip )
322319 return 0 ;
323320
324- if (acpi_trip -> valid )
321+ if (acpi_thermal_trip_valid ( acpi_trip ) )
325322 trip -> temperature = acpi_thermal_temp (tz , acpi_trip -> temperature );
326323 else
327324 trip -> temperature = THERMAL_TEMP_INVALID ;
@@ -465,11 +462,11 @@ static bool acpi_thermal_init_passive_trip(struct acpi_thermal *tz)
465462 if (!update_passive_devices (tz , false))
466463 goto fail ;
467464
468- update_acpi_thermal_trip_temp ( & tz -> trips .passive .trip , temp ) ;
465+ tz -> trips .passive .trip . temperature = temp ;
469466 return true;
470467
471468fail :
472- update_acpi_thermal_trip_temp ( & tz -> trips .passive .trip , THERMAL_TEMP_INVALID ) ;
469+ tz -> trips .passive .trip . temperature = THERMAL_TEMP_INVALID ;
473470 return false;
474471}
475472
@@ -487,11 +484,11 @@ static bool acpi_thermal_init_active_trip(struct acpi_thermal *tz, int index)
487484 if (!update_active_devices (tz , index , false))
488485 goto fail ;
489486
490- update_acpi_thermal_trip_temp ( & tz -> trips .active [index ].trip , temp ) ;
487+ tz -> trips .active [index ].trip . temperature = temp ;
491488 return true;
492489
493490fail :
494- update_acpi_thermal_trip_temp ( & tz -> trips .active [index ].trip , THERMAL_TEMP_INVALID ) ;
491+ tz -> trips .active [index ].trip . temperature = THERMAL_TEMP_INVALID ;
495492 return false;
496493}
497494
@@ -545,7 +542,7 @@ static int thermal_get_trend(struct thermal_zone_device *thermal,
545542 return - EINVAL ;
546543
547544 acpi_trip = trip -> priv ;
548- if (!acpi_trip || !acpi_trip -> valid )
545+ if (!acpi_trip || !acpi_thermal_trip_valid ( acpi_trip ) )
549546 return - EINVAL ;
550547
551548 switch (trip -> type ) {
@@ -618,7 +615,7 @@ static int acpi_thermal_cooling_device_cb(struct thermal_zone_device *thermal,
618615 if (tz -> trips .hot_valid )
619616 trip ++ ;
620617
621- if (tz -> trips .passive .trip . valid ) {
618+ if (acpi_thermal_trip_valid ( & tz -> trips .passive .trip ) ) {
622619 trip ++ ;
623620 for (i = 0 ; i < tz -> trips .passive .devices .count ; i ++ ) {
624621 handle = tz -> trips .passive .devices .handles [i ];
@@ -643,7 +640,7 @@ static int acpi_thermal_cooling_device_cb(struct thermal_zone_device *thermal,
643640 }
644641
645642 for (i = 0 ; i < ACPI_THERMAL_MAX_ACTIVE ; i ++ ) {
646- if (!tz -> trips .active [i ].trip . valid )
643+ if (!acpi_thermal_trip_valid ( & tz -> trips .active [i ].trip ) )
647644 break ;
648645
649646 trip ++ ;
@@ -949,7 +946,7 @@ static int acpi_thermal_add(struct acpi_device *device)
949946 }
950947
951948 acpi_trip = & tz -> trips .passive .trip ;
952- if (acpi_trip -> valid ) {
949+ if (acpi_thermal_trip_valid ( acpi_trip ) ) {
953950 passive_delay = tz -> trips .passive .tsp * 100 ;
954951
955952 trip -> type = THERMAL_TRIP_PASSIVE ;
@@ -961,7 +958,7 @@ static int acpi_thermal_add(struct acpi_device *device)
961958 for (i = 0 ; i < ACPI_THERMAL_MAX_ACTIVE ; i ++ ) {
962959 acpi_trip = & tz -> trips .active [i ].trip ;
963960
964- if (!acpi_trip -> valid )
961+ if (!acpi_thermal_trip_valid ( acpi_trip ) )
965962 break ;
966963
967964 trip -> type = THERMAL_TRIP_ACTIVE ;
@@ -1038,7 +1035,7 @@ static int acpi_thermal_resume(struct device *dev)
10381035 return - EINVAL ;
10391036
10401037 for (i = 0 ; i < ACPI_THERMAL_MAX_ACTIVE ; i ++ ) {
1041- if (!tz -> trips .active [i ].trip . valid )
1038+ if (!acpi_thermal_trip_valid ( & tz -> trips .active [i ].trip ) )
10421039 break ;
10431040
10441041 for (j = 0 ; j < tz -> trips .active [i ].devices .count ; j ++ ) {
0 commit comments