3131#include <linux/uaccess.h>
3232#include <linux/units.h>
3333
34+ #include "internal.h"
35+
3436#define ACPI_THERMAL_CLASS "thermal_zone"
3537#define ACPI_THERMAL_DEVICE_NAME "Thermal Zone"
3638#define ACPI_THERMAL_NOTIFY_TEMPERATURE 0x80
@@ -188,24 +190,19 @@ static int active_trip_index(struct acpi_thermal *tz,
188190
189191static long get_passive_temp (struct acpi_thermal * tz )
190192{
191- unsigned long long tmp ;
192- acpi_status status ;
193+ int temp ;
193194
194- status = acpi_evaluate_integer (tz -> device -> handle , "_PSV" , NULL , & tmp );
195- if (ACPI_FAILURE (status ))
195+ if (acpi_passive_trip_temp (tz -> device , & temp ))
196196 return THERMAL_TEMP_INVALID ;
197197
198- return tmp ;
198+ return temp ;
199199}
200200
201201static long get_active_temp (struct acpi_thermal * tz , int index )
202202{
203- char method [] = { '_' , 'A' , 'C' , '0' + index , '\0' };
204- unsigned long long tmp ;
205- acpi_status status ;
203+ int temp ;
206204
207- status = acpi_evaluate_integer (tz -> device -> handle , method , NULL , & tmp );
208- if (ACPI_FAILURE (status ))
205+ if (acpi_active_trip_temp (tz -> device , index , & temp ))
209206 return THERMAL_TEMP_INVALID ;
210207
211208 /*
@@ -215,10 +212,10 @@ static long get_active_temp(struct acpi_thermal *tz, int index)
215212 if (act > 0 ) {
216213 unsigned long long override = celsius_to_deci_kelvin (act );
217214
218- if (tmp > override )
219- tmp = override ;
215+ if (temp > override )
216+ return override ;
220217 }
221- return tmp ;
218+ return temp ;
222219}
223220
224221static void acpi_thermal_update_trip (struct acpi_thermal * tz ,
@@ -339,52 +336,47 @@ static void acpi_thermal_trips_update(struct acpi_thermal *tz, u32 event)
339336 dev_name (& adev -> dev ), event , 0 );
340337}
341338
342- static long acpi_thermal_get_critical_trip (struct acpi_thermal * tz )
339+ static int acpi_thermal_get_critical_trip (struct acpi_thermal * tz )
343340{
344- unsigned long long tmp ;
345- acpi_status status ;
341+ int temp ;
346342
347343 if (crt > 0 ) {
348- tmp = celsius_to_deci_kelvin (crt );
344+ temp = celsius_to_deci_kelvin (crt );
349345 goto set ;
350346 }
351347 if (crt == -1 ) {
352348 acpi_handle_debug (tz -> device -> handle , "Critical threshold disabled\n" );
353349 return THERMAL_TEMP_INVALID ;
354350 }
355351
356- status = acpi_evaluate_integer (tz -> device -> handle , "_CRT" , NULL , & tmp );
357- if (ACPI_FAILURE (status )) {
358- acpi_handle_debug (tz -> device -> handle , "No critical threshold\n" );
352+ if (acpi_critical_trip_temp (tz -> device , & temp ))
359353 return THERMAL_TEMP_INVALID ;
360- }
361- if (tmp <= 2732 ) {
354+
355+ if (temp <= 2732 ) {
362356 /*
363357 * Below zero (Celsius) values clearly aren't right for sure,
364358 * so discard them as invalid.
365359 */
366- pr_info (FW_BUG "Invalid critical threshold (%llu )\n" , tmp );
360+ pr_info (FW_BUG "Invalid critical threshold (%d )\n" , temp );
367361 return THERMAL_TEMP_INVALID ;
368362 }
369363
370364set :
371- acpi_handle_debug (tz -> device -> handle , "Critical threshold [%llu ]\n" , tmp );
372- return tmp ;
365+ acpi_handle_debug (tz -> device -> handle , "Critical threshold [%d ]\n" , temp );
366+ return temp ;
373367}
374368
375- static long acpi_thermal_get_hot_trip (struct acpi_thermal * tz )
369+ static int acpi_thermal_get_hot_trip (struct acpi_thermal * tz )
376370{
377- unsigned long long tmp ;
378- acpi_status status ;
371+ int temp ;
379372
380- status = acpi_evaluate_integer (tz -> device -> handle , "_HOT" , NULL , & tmp );
381- if (ACPI_FAILURE (status )) {
373+ if (acpi_hot_trip_temp (tz -> device , & temp ) || temp == THERMAL_TEMP_INVALID ) {
382374 acpi_handle_debug (tz -> device -> handle , "No hot threshold\n" );
383375 return THERMAL_TEMP_INVALID ;
384376 }
385377
386- acpi_handle_debug (tz -> device -> handle , "Hot threshold [%llu ]\n" , tmp );
387- return tmp ;
378+ acpi_handle_debug (tz -> device -> handle , "Hot threshold [%d ]\n" , temp );
379+ return temp ;
388380}
389381
390382static bool passive_trip_params_init (struct acpi_thermal * tz )
@@ -1142,6 +1134,7 @@ static void __exit acpi_thermal_exit(void)
11421134module_init (acpi_thermal_init );
11431135module_exit (acpi_thermal_exit );
11441136
1137+ MODULE_IMPORT_NS (ACPI_THERMAL );
11451138MODULE_AUTHOR ("Paul Diefenbaugh" );
11461139MODULE_DESCRIPTION ("ACPI Thermal Zone Driver" );
11471140MODULE_LICENSE ("GPL" );
0 commit comments