diff options
author | Matthew Wilcox <willy@linux.intel.com> | 2008-10-10 02:22:59 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2008-10-11 02:47:33 -0400 |
commit | 27663c5855b10af9ec67bc7dfba001426ba21222 (patch) | |
tree | 2b8c520bb57a792045d7d072398a4d840fada6c0 /drivers/acpi/thermal.c | |
parent | 3fa8749e584b55f1180411ab1b51117190bac1e5 (diff) |
ACPI: Change acpi_evaluate_integer to support 64-bit on 32-bit kernels
As of version 2.0, ACPI can return 64-bit integers. The current
acpi_evaluate_integer only supports 64-bit integers on 64-bit platforms.
Change the argument to take a pointer to an acpi_integer so we support
64-bit integers on all platforms.
lenb: replaced use of "acpi_integer" with "unsigned long long"
lenb: fixed bug in acpi_thermal_trips_update()
Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/thermal.c')
-rw-r--r-- | drivers/acpi/thermal.c | 43 |
1 files changed, 27 insertions, 16 deletions
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index 912703691d36..47abb94bdfb9 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c | |||
@@ -246,18 +246,18 @@ static const struct file_operations acpi_thermal_polling_fops = { | |||
246 | static int acpi_thermal_get_temperature(struct acpi_thermal *tz) | 246 | static int acpi_thermal_get_temperature(struct acpi_thermal *tz) |
247 | { | 247 | { |
248 | acpi_status status = AE_OK; | 248 | acpi_status status = AE_OK; |
249 | 249 | unsigned long long tmp; | |
250 | 250 | ||
251 | if (!tz) | 251 | if (!tz) |
252 | return -EINVAL; | 252 | return -EINVAL; |
253 | 253 | ||
254 | tz->last_temperature = tz->temperature; | 254 | tz->last_temperature = tz->temperature; |
255 | 255 | ||
256 | status = | 256 | status = acpi_evaluate_integer(tz->device->handle, "_TMP", NULL, &tmp); |
257 | acpi_evaluate_integer(tz->device->handle, "_TMP", NULL, &tz->temperature); | ||
258 | if (ACPI_FAILURE(status)) | 257 | if (ACPI_FAILURE(status)) |
259 | return -ENODEV; | 258 | return -ENODEV; |
260 | 259 | ||
260 | tz->temperature = tmp; | ||
261 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Temperature is %lu dK\n", | 261 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Temperature is %lu dK\n", |
262 | tz->temperature)); | 262 | tz->temperature)); |
263 | 263 | ||
@@ -267,17 +267,16 @@ static int acpi_thermal_get_temperature(struct acpi_thermal *tz) | |||
267 | static int acpi_thermal_get_polling_frequency(struct acpi_thermal *tz) | 267 | static int acpi_thermal_get_polling_frequency(struct acpi_thermal *tz) |
268 | { | 268 | { |
269 | acpi_status status = AE_OK; | 269 | acpi_status status = AE_OK; |
270 | 270 | unsigned long long tmp; | |
271 | 271 | ||
272 | if (!tz) | 272 | if (!tz) |
273 | return -EINVAL; | 273 | return -EINVAL; |
274 | 274 | ||
275 | status = | 275 | status = acpi_evaluate_integer(tz->device->handle, "_TZP", NULL, &tmp); |
276 | acpi_evaluate_integer(tz->device->handle, "_TZP", NULL, | ||
277 | &tz->polling_frequency); | ||
278 | if (ACPI_FAILURE(status)) | 276 | if (ACPI_FAILURE(status)) |
279 | return -ENODEV; | 277 | return -ENODEV; |
280 | 278 | ||
279 | tz->polling_frequency = tmp; | ||
281 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Polling frequency is %lu dS\n", | 280 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Polling frequency is %lu dS\n", |
282 | tz->polling_frequency)); | 281 | tz->polling_frequency)); |
283 | 282 | ||
@@ -356,6 +355,7 @@ do { \ | |||
356 | static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag) | 355 | static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag) |
357 | { | 356 | { |
358 | acpi_status status = AE_OK; | 357 | acpi_status status = AE_OK; |
358 | unsigned long long tmp; | ||
359 | struct acpi_handle_list devices; | 359 | struct acpi_handle_list devices; |
360 | int valid = 0; | 360 | int valid = 0; |
361 | int i; | 361 | int i; |
@@ -363,7 +363,8 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag) | |||
363 | /* Critical Shutdown (required) */ | 363 | /* Critical Shutdown (required) */ |
364 | if (flag & ACPI_TRIPS_CRITICAL) { | 364 | if (flag & ACPI_TRIPS_CRITICAL) { |
365 | status = acpi_evaluate_integer(tz->device->handle, | 365 | status = acpi_evaluate_integer(tz->device->handle, |
366 | "_CRT", NULL, &tz->trips.critical.temperature); | 366 | "_CRT", NULL, &tmp); |
367 | tz->trips.critical.temperature = tmp; | ||
367 | /* | 368 | /* |
368 | * Treat freezing temperatures as invalid as well; some | 369 | * Treat freezing temperatures as invalid as well; some |
369 | * BIOSes return really low values and cause reboots at startup. | 370 | * BIOSes return really low values and cause reboots at startup. |
@@ -399,12 +400,13 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag) | |||
399 | /* Critical Sleep (optional) */ | 400 | /* Critical Sleep (optional) */ |
400 | if (flag & ACPI_TRIPS_HOT) { | 401 | if (flag & ACPI_TRIPS_HOT) { |
401 | status = acpi_evaluate_integer(tz->device->handle, | 402 | status = acpi_evaluate_integer(tz->device->handle, |
402 | "_HOT", NULL, &tz->trips.hot.temperature); | 403 | "_HOT", NULL, &tmp); |
403 | if (ACPI_FAILURE(status)) { | 404 | if (ACPI_FAILURE(status)) { |
404 | tz->trips.hot.flags.valid = 0; | 405 | tz->trips.hot.flags.valid = 0; |
405 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 406 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
406 | "No hot threshold\n")); | 407 | "No hot threshold\n")); |
407 | } else { | 408 | } else { |
409 | tz->trips.hot.temperature = tmp; | ||
408 | tz->trips.hot.flags.valid = 1; | 410 | tz->trips.hot.flags.valid = 1; |
409 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 411 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
410 | "Found hot threshold [%lu]\n", | 412 | "Found hot threshold [%lu]\n", |
@@ -418,33 +420,40 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag) | |||
418 | if (psv == -1) { | 420 | if (psv == -1) { |
419 | status = AE_SUPPORT; | 421 | status = AE_SUPPORT; |
420 | } else if (psv > 0) { | 422 | } else if (psv > 0) { |
421 | tz->trips.passive.temperature = CELSIUS_TO_KELVIN(psv); | 423 | tmp = CELSIUS_TO_KELVIN(psv); |
422 | status = AE_OK; | 424 | status = AE_OK; |
423 | } else { | 425 | } else { |
424 | status = acpi_evaluate_integer(tz->device->handle, | 426 | status = acpi_evaluate_integer(tz->device->handle, |
425 | "_PSV", NULL, &tz->trips.passive.temperature); | 427 | "_PSV", NULL, &tmp); |
426 | } | 428 | } |
427 | 429 | ||
428 | if (ACPI_FAILURE(status)) | 430 | if (ACPI_FAILURE(status)) |
429 | tz->trips.passive.flags.valid = 0; | 431 | tz->trips.passive.flags.valid = 0; |
430 | else { | 432 | else { |
433 | tz->trips.passive.temperature = tmp; | ||
431 | tz->trips.passive.flags.valid = 1; | 434 | tz->trips.passive.flags.valid = 1; |
432 | if (flag == ACPI_TRIPS_INIT) { | 435 | if (flag == ACPI_TRIPS_INIT) { |
433 | status = acpi_evaluate_integer( | 436 | status = acpi_evaluate_integer( |
434 | tz->device->handle, "_TC1", | 437 | tz->device->handle, "_TC1", |
435 | NULL, &tz->trips.passive.tc1); | 438 | NULL, &tmp); |
436 | if (ACPI_FAILURE(status)) | 439 | if (ACPI_FAILURE(status)) |
437 | tz->trips.passive.flags.valid = 0; | 440 | tz->trips.passive.flags.valid = 0; |
441 | else | ||
442 | tz->trips.passive.tc1 = tmp; | ||
438 | status = acpi_evaluate_integer( | 443 | status = acpi_evaluate_integer( |
439 | tz->device->handle, "_TC2", | 444 | tz->device->handle, "_TC2", |
440 | NULL, &tz->trips.passive.tc2); | 445 | NULL, &tmp); |
441 | if (ACPI_FAILURE(status)) | 446 | if (ACPI_FAILURE(status)) |
442 | tz->trips.passive.flags.valid = 0; | 447 | tz->trips.passive.flags.valid = 0; |
448 | else | ||
449 | tz->trips.passive.tc2 = tmp; | ||
443 | status = acpi_evaluate_integer( | 450 | status = acpi_evaluate_integer( |
444 | tz->device->handle, "_TSP", | 451 | tz->device->handle, "_TSP", |
445 | NULL, &tz->trips.passive.tsp); | 452 | NULL, &tmp); |
446 | if (ACPI_FAILURE(status)) | 453 | if (ACPI_FAILURE(status)) |
447 | tz->trips.passive.flags.valid = 0; | 454 | tz->trips.passive.flags.valid = 0; |
455 | else | ||
456 | tz->trips.passive.tsp = tmp; | ||
448 | } | 457 | } |
449 | } | 458 | } |
450 | } | 459 | } |
@@ -479,7 +488,7 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag) | |||
479 | 488 | ||
480 | if (flag & ACPI_TRIPS_ACTIVE) { | 489 | if (flag & ACPI_TRIPS_ACTIVE) { |
481 | status = acpi_evaluate_integer(tz->device->handle, | 490 | status = acpi_evaluate_integer(tz->device->handle, |
482 | name, NULL, &tz->trips.active[i].temperature); | 491 | name, NULL, &tmp); |
483 | if (ACPI_FAILURE(status)) { | 492 | if (ACPI_FAILURE(status)) { |
484 | tz->trips.active[i].flags.valid = 0; | 493 | tz->trips.active[i].flags.valid = 0; |
485 | if (i == 0) | 494 | if (i == 0) |
@@ -500,8 +509,10 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag) | |||
500 | tz->trips.active[i - 2].temperature : | 509 | tz->trips.active[i - 2].temperature : |
501 | CELSIUS_TO_KELVIN(act)); | 510 | CELSIUS_TO_KELVIN(act)); |
502 | break; | 511 | break; |
503 | } else | 512 | } else { |
513 | tz->trips.active[i].temperature = tmp; | ||
504 | tz->trips.active[i].flags.valid = 1; | 514 | tz->trips.active[i].flags.valid = 1; |
515 | } | ||
505 | } | 516 | } |
506 | 517 | ||
507 | name[2] = 'L'; | 518 | name[2] = 'L'; |