31
31
#include <linux/uaccess.h>
32
32
#include <linux/units.h>
33
33
34
+ #include "internal.h"
35
+
34
36
#define ACPI_THERMAL_CLASS "thermal_zone"
35
37
#define ACPI_THERMAL_DEVICE_NAME "Thermal Zone"
36
38
#define ACPI_THERMAL_NOTIFY_TEMPERATURE 0x80
@@ -188,24 +190,19 @@ static int active_trip_index(struct acpi_thermal *tz,
188
190
189
191
static long get_passive_temp (struct acpi_thermal * tz )
190
192
{
191
- unsigned long long tmp ;
192
- acpi_status status ;
193
+ int temp ;
193
194
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 ))
196
196
return THERMAL_TEMP_INVALID ;
197
197
198
- return tmp ;
198
+ return temp ;
199
199
}
200
200
201
201
static long get_active_temp (struct acpi_thermal * tz , int index )
202
202
{
203
- char method [] = { '_' , 'A' , 'C' , '0' + index , '\0' };
204
- unsigned long long tmp ;
205
- acpi_status status ;
203
+ int temp ;
206
204
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 ))
209
206
return THERMAL_TEMP_INVALID ;
210
207
211
208
/*
@@ -215,10 +212,10 @@ static long get_active_temp(struct acpi_thermal *tz, int index)
215
212
if (act > 0 ) {
216
213
unsigned long long override = celsius_to_deci_kelvin (act );
217
214
218
- if (tmp > override )
219
- tmp = override ;
215
+ if (temp > override )
216
+ return override ;
220
217
}
221
- return tmp ;
218
+ return temp ;
222
219
}
223
220
224
221
static 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)
339
336
dev_name (& adev -> dev ), event , 0 );
340
337
}
341
338
342
- static long acpi_thermal_get_critical_trip (struct acpi_thermal * tz )
339
+ static int acpi_thermal_get_critical_trip (struct acpi_thermal * tz )
343
340
{
344
- unsigned long long tmp ;
345
- acpi_status status ;
341
+ int temp ;
346
342
347
343
if (crt > 0 ) {
348
- tmp = celsius_to_deci_kelvin (crt );
344
+ temp = celsius_to_deci_kelvin (crt );
349
345
goto set ;
350
346
}
351
347
if (crt == -1 ) {
352
348
acpi_handle_debug (tz -> device -> handle , "Critical threshold disabled\n" );
353
349
return THERMAL_TEMP_INVALID ;
354
350
}
355
351
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 ))
359
353
return THERMAL_TEMP_INVALID ;
360
- }
361
- if (tmp <= 2732 ) {
354
+
355
+ if (temp <= 2732 ) {
362
356
/*
363
357
* Below zero (Celsius) values clearly aren't right for sure,
364
358
* so discard them as invalid.
365
359
*/
366
- pr_info (FW_BUG "Invalid critical threshold (%llu )\n" , tmp );
360
+ pr_info (FW_BUG "Invalid critical threshold (%d )\n" , temp );
367
361
return THERMAL_TEMP_INVALID ;
368
362
}
369
363
370
364
set :
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 ;
373
367
}
374
368
375
- static long acpi_thermal_get_hot_trip (struct acpi_thermal * tz )
369
+ static int acpi_thermal_get_hot_trip (struct acpi_thermal * tz )
376
370
{
377
- unsigned long long tmp ;
378
- acpi_status status ;
371
+ int temp ;
379
372
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 ) {
382
374
acpi_handle_debug (tz -> device -> handle , "No hot threshold\n" );
383
375
return THERMAL_TEMP_INVALID ;
384
376
}
385
377
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 ;
388
380
}
389
381
390
382
static bool passive_trip_params_init (struct acpi_thermal * tz )
@@ -1142,6 +1134,7 @@ static void __exit acpi_thermal_exit(void)
1142
1134
module_init (acpi_thermal_init );
1143
1135
module_exit (acpi_thermal_exit );
1144
1136
1137
+ MODULE_IMPORT_NS (ACPI_THERMAL );
1145
1138
MODULE_AUTHOR ("Paul Diefenbaugh" );
1146
1139
MODULE_DESCRIPTION ("ACPI Thermal Zone Driver" );
1147
1140
MODULE_LICENSE ("GPL" );
0 commit comments