@@ -81,7 +81,6 @@ static struct workqueue_struct *acpi_thermal_pm_queue;
81
81
82
82
struct acpi_thermal_trip {
83
83
unsigned long temperature ;
84
- bool valid ;
85
84
};
86
85
87
86
struct acpi_thermal_passive {
@@ -175,11 +174,9 @@ static int acpi_thermal_temp(struct acpi_thermal *tz, int temp_deci_k)
175
174
tz -> kelvin_offset );
176
175
}
177
176
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 )
180
178
{
181
- acpi_trip -> valid = temp != THERMAL_TEMP_INVALID ;
182
- acpi_trip -> temperature = temp ;
179
+ return acpi_trip -> temperature != THERMAL_TEMP_INVALID ;
183
180
}
184
181
185
182
static long get_passive_temp (struct acpi_thermal * tz )
@@ -198,11 +195,11 @@ static void acpi_thermal_update_passive_trip(struct acpi_thermal *tz)
198
195
{
199
196
struct acpi_thermal_trip * acpi_trip = & tz -> trips .passive .trip ;
200
197
201
- if (!acpi_trip -> valid || psv > 0 )
198
+ if (!acpi_thermal_trip_valid ( acpi_trip ) || psv > 0 )
202
199
return ;
203
200
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 ) )
206
203
ACPI_THERMAL_TRIPS_EXCEPTION (tz , "state" );
207
204
}
208
205
@@ -231,13 +228,13 @@ static void acpi_thermal_update_passive_devices(struct acpi_thermal *tz)
231
228
{
232
229
struct acpi_thermal_trip * acpi_trip = & tz -> trips .passive .trip ;
233
230
234
- if (!acpi_trip -> valid )
231
+ if (!acpi_thermal_trip_valid ( acpi_trip ) )
235
232
return ;
236
233
237
234
if (update_passive_devices (tz , true))
238
235
return ;
239
236
240
- update_acpi_thermal_trip_temp ( acpi_trip , THERMAL_TEMP_INVALID ) ;
237
+ acpi_trip -> temperature = THERMAL_TEMP_INVALID ;
241
238
ACPI_THERMAL_TRIPS_EXCEPTION (tz , "state" );
242
239
}
243
240
@@ -268,11 +265,11 @@ static void acpi_thermal_update_active_trip(struct acpi_thermal *tz, int index)
268
265
{
269
266
struct acpi_thermal_trip * acpi_trip = & tz -> trips .active [index ].trip ;
270
267
271
- if (!acpi_trip -> valid )
268
+ if (!acpi_thermal_trip_valid ( acpi_trip ) )
272
269
return ;
273
270
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 ) )
276
273
ACPI_THERMAL_TRIPS_EXCEPTION (tz , "state" );
277
274
}
278
275
@@ -303,13 +300,13 @@ static void acpi_thermal_update_active_devices(struct acpi_thermal *tz, int inde
303
300
{
304
301
struct acpi_thermal_trip * acpi_trip = & tz -> trips .active [index ].trip ;
305
302
306
- if (!acpi_trip -> valid )
303
+ if (!acpi_thermal_trip_valid ( acpi_trip ) )
307
304
return ;
308
305
309
306
if (update_active_devices (tz , index , true))
310
307
return ;
311
308
312
- update_acpi_thermal_trip_temp ( acpi_trip , THERMAL_TEMP_INVALID ) ;
309
+ acpi_trip -> temperature = THERMAL_TEMP_INVALID ;
313
310
ACPI_THERMAL_TRIPS_EXCEPTION (tz , "state" );
314
311
}
315
312
@@ -321,7 +318,7 @@ static int acpi_thermal_adjust_trip(struct thermal_trip *trip, void *data)
321
318
if (!acpi_trip )
322
319
return 0 ;
323
320
324
- if (acpi_trip -> valid )
321
+ if (acpi_thermal_trip_valid ( acpi_trip ) )
325
322
trip -> temperature = acpi_thermal_temp (tz , acpi_trip -> temperature );
326
323
else
327
324
trip -> temperature = THERMAL_TEMP_INVALID ;
@@ -465,11 +462,11 @@ static bool acpi_thermal_init_passive_trip(struct acpi_thermal *tz)
465
462
if (!update_passive_devices (tz , false))
466
463
goto fail ;
467
464
468
- update_acpi_thermal_trip_temp ( & tz -> trips .passive .trip , temp ) ;
465
+ tz -> trips .passive .trip . temperature = temp ;
469
466
return true;
470
467
471
468
fail :
472
- update_acpi_thermal_trip_temp ( & tz -> trips .passive .trip , THERMAL_TEMP_INVALID ) ;
469
+ tz -> trips .passive .trip . temperature = THERMAL_TEMP_INVALID ;
473
470
return false;
474
471
}
475
472
@@ -487,11 +484,11 @@ static bool acpi_thermal_init_active_trip(struct acpi_thermal *tz, int index)
487
484
if (!update_active_devices (tz , index , false))
488
485
goto fail ;
489
486
490
- update_acpi_thermal_trip_temp ( & tz -> trips .active [index ].trip , temp ) ;
487
+ tz -> trips .active [index ].trip . temperature = temp ;
491
488
return true;
492
489
493
490
fail :
494
- update_acpi_thermal_trip_temp ( & tz -> trips .active [index ].trip , THERMAL_TEMP_INVALID ) ;
491
+ tz -> trips .active [index ].trip . temperature = THERMAL_TEMP_INVALID ;
495
492
return false;
496
493
}
497
494
@@ -545,7 +542,7 @@ static int thermal_get_trend(struct thermal_zone_device *thermal,
545
542
return - EINVAL ;
546
543
547
544
acpi_trip = trip -> priv ;
548
- if (!acpi_trip || !acpi_trip -> valid )
545
+ if (!acpi_trip || !acpi_thermal_trip_valid ( acpi_trip ) )
549
546
return - EINVAL ;
550
547
551
548
switch (trip -> type ) {
@@ -618,7 +615,7 @@ static int acpi_thermal_cooling_device_cb(struct thermal_zone_device *thermal,
618
615
if (tz -> trips .hot_valid )
619
616
trip ++ ;
620
617
621
- if (tz -> trips .passive .trip . valid ) {
618
+ if (acpi_thermal_trip_valid ( & tz -> trips .passive .trip ) ) {
622
619
trip ++ ;
623
620
for (i = 0 ; i < tz -> trips .passive .devices .count ; i ++ ) {
624
621
handle = tz -> trips .passive .devices .handles [i ];
@@ -643,7 +640,7 @@ static int acpi_thermal_cooling_device_cb(struct thermal_zone_device *thermal,
643
640
}
644
641
645
642
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 ) )
647
644
break ;
648
645
649
646
trip ++ ;
@@ -949,7 +946,7 @@ static int acpi_thermal_add(struct acpi_device *device)
949
946
}
950
947
951
948
acpi_trip = & tz -> trips .passive .trip ;
952
- if (acpi_trip -> valid ) {
949
+ if (acpi_thermal_trip_valid ( acpi_trip ) ) {
953
950
passive_delay = tz -> trips .passive .tsp * 100 ;
954
951
955
952
trip -> type = THERMAL_TRIP_PASSIVE ;
@@ -961,7 +958,7 @@ static int acpi_thermal_add(struct acpi_device *device)
961
958
for (i = 0 ; i < ACPI_THERMAL_MAX_ACTIVE ; i ++ ) {
962
959
acpi_trip = & tz -> trips .active [i ].trip ;
963
960
964
- if (!acpi_trip -> valid )
961
+ if (!acpi_thermal_trip_valid ( acpi_trip ) )
965
962
break ;
966
963
967
964
trip -> type = THERMAL_TRIP_ACTIVE ;
@@ -1038,7 +1035,7 @@ static int acpi_thermal_resume(struct device *dev)
1038
1035
return - EINVAL ;
1039
1036
1040
1037
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 ) )
1042
1039
break ;
1043
1040
1044
1041
for (j = 0 ; j < tz -> trips .active [i ].devices .count ; j ++ ) {
0 commit comments