@@ -92,34 +92,27 @@ MODULE_PARM_DESC(psv, "Disable or override all passive trip points.");
9292
9393static struct workqueue_struct * acpi_thermal_pm_queue ;
9494
95- struct acpi_thermal_critical {
96- unsigned long temperature ;
97- bool valid ;
98- };
99-
100- struct acpi_thermal_hot {
95+ struct acpi_thermal_trip {
10196 unsigned long temperature ;
10297 bool valid ;
10398};
10499
105100struct acpi_thermal_passive {
101+ struct acpi_thermal_trip trip ;
106102 struct acpi_handle_list devices ;
107- unsigned long temperature ;
108103 unsigned long tc1 ;
109104 unsigned long tc2 ;
110105 unsigned long tsp ;
111- bool valid ;
112106};
113107
114108struct acpi_thermal_active {
109+ struct acpi_thermal_trip trip ;
115110 struct acpi_handle_list devices ;
116- unsigned long temperature ;
117- bool valid ;
118111};
119112
120113struct acpi_thermal_trips {
121- struct acpi_thermal_critical critical ;
122- struct acpi_thermal_hot hot ;
114+ struct acpi_thermal_trip critical ;
115+ struct acpi_thermal_trip hot ;
123116 struct acpi_thermal_passive passive ;
124117 struct acpi_thermal_active active [ACPI_THERMAL_MAX_ACTIVE ];
125118};
@@ -250,9 +243,9 @@ static void __acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)
250243 }
251244
252245 /* Passive (optional) */
253- if (((flag & ACPI_TRIPS_PASSIVE ) && tz -> trips .passive .valid ) ||
246+ if (((flag & ACPI_TRIPS_PASSIVE ) && tz -> trips .passive .trip . valid ) ||
254247 flag == ACPI_TRIPS_INIT ) {
255- valid = tz -> trips .passive .valid ;
248+ valid = tz -> trips .passive .trip . valid ;
256249 if (psv == -1 ) {
257250 status = AE_SUPPORT ;
258251 } else if (psv > 0 ) {
@@ -264,44 +257,44 @@ static void __acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)
264257 }
265258
266259 if (ACPI_FAILURE (status )) {
267- tz -> trips .passive .valid = false;
260+ tz -> trips .passive .trip . valid = false;
268261 } else {
269- tz -> trips .passive .temperature = tmp ;
270- tz -> trips .passive .valid = true;
262+ tz -> trips .passive .trip . temperature = tmp ;
263+ tz -> trips .passive .trip . valid = true;
271264 if (flag == ACPI_TRIPS_INIT ) {
272265 status = acpi_evaluate_integer (tz -> device -> handle ,
273266 "_TC1" , NULL , & tmp );
274267 if (ACPI_FAILURE (status ))
275- tz -> trips .passive .valid = false;
268+ tz -> trips .passive .trip . valid = false;
276269 else
277270 tz -> trips .passive .tc1 = tmp ;
278271
279272 status = acpi_evaluate_integer (tz -> device -> handle ,
280273 "_TC2" , NULL , & tmp );
281274 if (ACPI_FAILURE (status ))
282- tz -> trips .passive .valid = false;
275+ tz -> trips .passive .trip . valid = false;
283276 else
284277 tz -> trips .passive .tc2 = tmp ;
285278
286279 status = acpi_evaluate_integer (tz -> device -> handle ,
287280 "_TSP" , NULL , & tmp );
288281 if (ACPI_FAILURE (status ))
289- tz -> trips .passive .valid = false;
282+ tz -> trips .passive .trip . valid = false;
290283 else
291284 tz -> trips .passive .tsp = tmp ;
292285 }
293286 }
294287 }
295- if ((flag & ACPI_TRIPS_DEVICES ) && tz -> trips .passive .valid ) {
288+ if ((flag & ACPI_TRIPS_DEVICES ) && tz -> trips .passive .trip . valid ) {
296289 memset (& devices , 0 , sizeof (struct acpi_handle_list ));
297290 status = acpi_evaluate_reference (tz -> device -> handle , "_PSL" ,
298291 NULL , & devices );
299292 if (ACPI_FAILURE (status )) {
300293 acpi_handle_info (tz -> device -> handle ,
301294 "Invalid passive threshold\n" );
302- tz -> trips .passive .valid = false;
295+ tz -> trips .passive .trip . valid = false;
303296 } else {
304- tz -> trips .passive .valid = true;
297+ tz -> trips .passive .trip . valid = true;
305298 }
306299
307300 if (memcmp (& tz -> trips .passive .devices , & devices ,
@@ -312,60 +305,61 @@ static void __acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)
312305 }
313306 }
314307 if ((flag & ACPI_TRIPS_PASSIVE ) || (flag & ACPI_TRIPS_DEVICES )) {
315- if (valid != tz -> trips .passive .valid )
308+ if (valid != tz -> trips .passive .trip . valid )
316309 ACPI_THERMAL_TRIPS_EXCEPTION (flag , tz , "state" );
317310 }
318311
319312 /* Active (optional) */
320313 for (i = 0 ; i < ACPI_THERMAL_MAX_ACTIVE ; i ++ ) {
321314 char name [5 ] = { '_' , 'A' , 'C' , ('0' + i ), '\0' };
322- valid = tz -> trips .active [i ].valid ;
315+ valid = tz -> trips .active [i ].trip . valid ;
323316
324317 if (act == -1 )
325318 break ; /* disable all active trip points */
326319
327320 if (flag == ACPI_TRIPS_INIT || ((flag & ACPI_TRIPS_ACTIVE ) &&
328- tz -> trips .active [i ].valid )) {
321+ tz -> trips .active [i ].trip . valid )) {
329322 status = acpi_evaluate_integer (tz -> device -> handle ,
330323 name , NULL , & tmp );
331324 if (ACPI_FAILURE (status )) {
332- tz -> trips .active [i ].valid = false;
325+ tz -> trips .active [i ].trip . valid = false;
333326 if (i == 0 )
334327 break ;
335328
336329 if (act <= 0 )
337330 break ;
338331
339332 if (i == 1 )
340- tz -> trips .active [0 ].temperature = celsius_to_deci_kelvin (act );
333+ tz -> trips .active [0 ].trip .temperature =
334+ celsius_to_deci_kelvin (act );
341335 else
342336 /*
343337 * Don't allow override higher than
344338 * the next higher trip point
345339 */
346- tz -> trips .active [i - 1 ].temperature =
340+ tz -> trips .active [i - 1 ].trip . temperature =
347341 min_t (unsigned long ,
348- tz -> trips .active [i - 2 ].temperature ,
342+ tz -> trips .active [i - 2 ].trip . temperature ,
349343 celsius_to_deci_kelvin (act ));
350344
351345 break ;
352346 } else {
353- tz -> trips .active [i ].temperature = tmp ;
354- tz -> trips .active [i ].valid = true;
347+ tz -> trips .active [i ].trip . temperature = tmp ;
348+ tz -> trips .active [i ].trip . valid = true;
355349 }
356350 }
357351
358352 name [2 ] = 'L' ;
359- if ((flag & ACPI_TRIPS_DEVICES ) && tz -> trips .active [i ].valid ) {
353+ if ((flag & ACPI_TRIPS_DEVICES ) && tz -> trips .active [i ].trip . valid ) {
360354 memset (& devices , 0 , sizeof (struct acpi_handle_list ));
361355 status = acpi_evaluate_reference (tz -> device -> handle ,
362356 name , NULL , & devices );
363357 if (ACPI_FAILURE (status )) {
364358 acpi_handle_info (tz -> device -> handle ,
365359 "Invalid active%d threshold\n" , i );
366- tz -> trips .active [i ].valid = false;
360+ tz -> trips .active [i ].trip . valid = false;
367361 } else {
368- tz -> trips .active [i ].valid = true;
362+ tz -> trips .active [i ].trip . valid = true;
369363 }
370364
371365 if (memcmp (& tz -> trips .active [i ].devices , & devices ,
@@ -376,10 +370,10 @@ static void __acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)
376370 }
377371 }
378372 if ((flag & ACPI_TRIPS_ACTIVE ) || (flag & ACPI_TRIPS_DEVICES ))
379- if (valid != tz -> trips .active [i ].valid )
373+ if (valid != tz -> trips .active [i ].trip . valid )
380374 ACPI_THERMAL_TRIPS_EXCEPTION (flag , tz , "state" );
381375
382- if (!tz -> trips .active [i ].valid )
376+ if (!tz -> trips .active [i ].trip . valid )
383377 break ;
384378 }
385379
@@ -430,10 +424,10 @@ static int acpi_thermal_get_trip_points(struct acpi_thermal *tz)
430424
431425 valid = tz -> trips .critical .valid |
432426 tz -> trips .hot .valid |
433- tz -> trips .passive .valid ;
427+ tz -> trips .passive .trip . valid ;
434428
435429 for (i = 0 ; i < ACPI_THERMAL_MAX_ACTIVE ; i ++ )
436- valid = valid || tz -> trips .active [i ].valid ;
430+ valid = valid || tz -> trips .active [i ].trip . valid ;
437431
438432 if (!valid ) {
439433 pr_warn (FW_BUG "No valid trip found\n" );
@@ -486,15 +480,15 @@ static int thermal_get_trip_type(struct thermal_zone_device *thermal,
486480 trip -- ;
487481 }
488482
489- if (tz -> trips .passive .valid ) {
483+ if (tz -> trips .passive .trip . valid ) {
490484 if (!trip ) {
491485 * type = THERMAL_TRIP_PASSIVE ;
492486 return 0 ;
493487 }
494488 trip -- ;
495489 }
496490
497- for (i = 0 ; i < ACPI_THERMAL_MAX_ACTIVE && tz -> trips .active [i ].valid ; i ++ ) {
491+ for (i = 0 ; i < ACPI_THERMAL_MAX_ACTIVE && tz -> trips .active [i ].trip . valid ; i ++ ) {
498492 if (!trip ) {
499493 * type = THERMAL_TRIP_ACTIVE ;
500494 return 0 ;
@@ -534,21 +528,21 @@ static int thermal_get_trip_temp(struct thermal_zone_device *thermal,
534528 trip -- ;
535529 }
536530
537- if (tz -> trips .passive .valid ) {
531+ if (tz -> trips .passive .trip . valid ) {
538532 if (!trip ) {
539533 * temp = deci_kelvin_to_millicelsius_with_offset (
540- tz -> trips .passive .temperature ,
534+ tz -> trips .passive .trip . temperature ,
541535 tz -> kelvin_offset );
542536 return 0 ;
543537 }
544538 trip -- ;
545539 }
546540
547541 for (i = 0 ; i < ACPI_THERMAL_MAX_ACTIVE &&
548- tz -> trips .active [i ].valid ; i ++ ) {
542+ tz -> trips .active [i ].trip . valid ; i ++ ) {
549543 if (!trip ) {
550544 * temp = deci_kelvin_to_millicelsius_with_offset (
551- tz -> trips .active [i ].temperature ,
545+ tz -> trips .active [i ].trip . temperature ,
552546 tz -> kelvin_offset );
553547 return 0 ;
554548 }
@@ -604,7 +598,7 @@ static int thermal_get_trend(struct thermal_zone_device *thermal,
604598 * before this callback being invoked
605599 */
606600 i = tz -> trips .passive .tc1 * (tz -> temperature - tz -> last_temperature ) +
607- tz -> trips .passive .tc2 * (tz -> temperature - tz -> trips .passive .temperature );
601+ tz -> trips .passive .tc2 * (tz -> temperature - tz -> trips .passive .trip . temperature );
608602
609603 if (i > 0 )
610604 * trend = THERMAL_TREND_RAISING ;
@@ -655,7 +649,7 @@ static int acpi_thermal_cooling_device_cb(struct thermal_zone_device *thermal,
655649 if (tz -> trips .hot .valid )
656650 trip ++ ;
657651
658- if (tz -> trips .passive .valid ) {
652+ if (tz -> trips .passive .trip . valid ) {
659653 trip ++ ;
660654 for (i = 0 ; i < tz -> trips .passive .devices .count ; i ++ ) {
661655 handle = tz -> trips .passive .devices .handles [i ];
@@ -680,7 +674,7 @@ static int acpi_thermal_cooling_device_cb(struct thermal_zone_device *thermal,
680674 }
681675
682676 for (i = 0 ; i < ACPI_THERMAL_MAX_ACTIVE ; i ++ ) {
683- if (!tz -> trips .active [i ].valid )
677+ if (!tz -> trips .active [i ].trip . valid )
684678 break ;
685679
686680 trip ++ ;
@@ -774,12 +768,12 @@ static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz)
774768 if (tz -> trips .hot .valid )
775769 trip_count ++ ;
776770
777- if (tz -> trips .passive .valid ) {
771+ if (tz -> trips .passive .trip . valid ) {
778772 trip_count ++ ;
779773 passive_delay = tz -> trips .passive .tsp * 100 ;
780774 }
781775
782- for (i = 0 ; i < ACPI_THERMAL_MAX_ACTIVE && tz -> trips .active [i ].valid ; i ++ )
776+ for (i = 0 ; i < ACPI_THERMAL_MAX_ACTIVE && tz -> trips .active [i ].trip . valid ; i ++ )
783777 trip_count ++ ;
784778
785779 tz -> thermal_zone = thermal_zone_device_register ("acpitz" , trip_count , 0 ,
@@ -1049,7 +1043,7 @@ static int acpi_thermal_resume(struct device *dev)
10491043 return - EINVAL ;
10501044
10511045 for (i = 0 ; i < ACPI_THERMAL_MAX_ACTIVE ; i ++ ) {
1052- if (!tz -> trips .active [i ].valid )
1046+ if (!tz -> trips .active [i ].trip . valid )
10531047 break ;
10541048
10551049 for (j = 0 ; j < tz -> trips .active [i ].devices .count ; j ++ ) {
0 commit comments