@@ -399,72 +399,68 @@ static long acpi_thermal_get_hot_trip(struct acpi_thermal *tz)
399
399
return tmp ;
400
400
}
401
401
402
- static bool acpi_thermal_init_passive_trip (struct acpi_thermal * tz )
402
+ static bool passive_trip_params_init (struct acpi_thermal * tz )
403
403
{
404
404
unsigned long long tmp ;
405
405
acpi_status status ;
406
- int temp ;
407
-
408
- if (psv == -1 )
409
- goto fail ;
410
-
411
- if (psv > 0 ) {
412
- temp = celsius_to_deci_kelvin (psv );
413
- } else {
414
- temp = get_passive_temp (tz );
415
- if (temp == THERMAL_TEMP_INVALID )
416
- goto fail ;
417
- }
418
406
419
407
status = acpi_evaluate_integer (tz -> device -> handle , "_TC1" , NULL , & tmp );
420
408
if (ACPI_FAILURE (status ))
421
- goto fail ;
409
+ return false ;
422
410
423
411
tz -> trips .passive .tc1 = tmp ;
424
412
425
413
status = acpi_evaluate_integer (tz -> device -> handle , "_TC2" , NULL , & tmp );
426
414
if (ACPI_FAILURE (status ))
427
- goto fail ;
415
+ return false ;
428
416
429
417
tz -> trips .passive .tc2 = tmp ;
430
418
431
419
status = acpi_evaluate_integer (tz -> device -> handle , "_TSP" , NULL , & tmp );
432
420
if (ACPI_FAILURE (status ))
433
- goto fail ;
421
+ return false ;
434
422
435
423
tz -> trips .passive .tsp = tmp ;
436
424
437
- if (!update_trip_devices (tz , & tz -> trips .passive .trip ,
438
- ACPI_THERMAL_TRIP_PASSIVE , false))
439
- goto fail ;
440
-
441
- tz -> trips .passive .trip .temperature = temp ;
442
425
return true;
443
-
444
- fail :
445
- tz -> trips .passive .trip .temperature = THERMAL_TEMP_INVALID ;
446
- return false;
447
426
}
448
427
449
- static bool acpi_thermal_init_active_trip (struct acpi_thermal * tz , int index )
428
+ static bool acpi_thermal_init_trip (struct acpi_thermal * tz , int index )
450
429
{
430
+ struct acpi_thermal_trip * acpi_trip ;
451
431
long temp ;
452
432
453
- if (act == -1 )
454
- goto fail ;
433
+ if (index == ACPI_THERMAL_TRIP_PASSIVE ) {
434
+ acpi_trip = & tz -> trips .passive .trip ;
435
+
436
+ if (psv == -1 )
437
+ goto fail ;
438
+
439
+ if (!passive_trip_params_init (tz ))
440
+ goto fail ;
441
+
442
+ temp = psv > 0 ? celsius_to_deci_kelvin (psv ) :
443
+ get_passive_temp (tz );
444
+ } else {
445
+ acpi_trip = & tz -> trips .active [index ].trip ;
446
+
447
+ if (act == -1 )
448
+ goto fail ;
449
+
450
+ temp = get_active_temp (tz , index );
451
+ }
455
452
456
- temp = get_active_temp (tz , index );
457
453
if (temp == THERMAL_TEMP_INVALID )
458
454
goto fail ;
459
455
460
- if (!update_trip_devices (tz , & tz -> trips . active [ index ]. trip , index , false))
456
+ if (!update_trip_devices (tz , acpi_trip , index , false))
461
457
goto fail ;
462
458
463
- tz -> trips . active [ index ]. trip . temperature = temp ;
459
+ acpi_trip -> temperature = temp ;
464
460
return true;
465
461
466
462
fail :
467
- tz -> trips . active [ index ]. trip . temperature = THERMAL_TEMP_INVALID ;
463
+ acpi_trip -> temperature = THERMAL_TEMP_INVALID ;
468
464
return false;
469
465
}
470
466
@@ -473,11 +469,11 @@ static int acpi_thermal_get_trip_points(struct acpi_thermal *tz)
473
469
unsigned int count = 0 ;
474
470
int i ;
475
471
476
- if (acpi_thermal_init_passive_trip (tz ))
472
+ if (acpi_thermal_init_trip (tz , ACPI_THERMAL_TRIP_PASSIVE ))
477
473
count ++ ;
478
474
479
475
for (i = 0 ; i < ACPI_THERMAL_MAX_ACTIVE ; i ++ ) {
480
- if (acpi_thermal_init_active_trip (tz , i ))
476
+ if (acpi_thermal_init_trip (tz , i ))
481
477
count ++ ;
482
478
else
483
479
break ;
0 commit comments