diff options
Diffstat (limited to 'drivers/acpi/thermal.c')
-rw-r--r-- | drivers/acpi/thermal.c | 170 |
1 files changed, 71 insertions, 99 deletions
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index 1b9754919f72..c855f4446b5f 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c | |||
@@ -222,51 +222,48 @@ static int acpi_thermal_get_temperature(struct acpi_thermal *tz) | |||
222 | { | 222 | { |
223 | acpi_status status = AE_OK; | 223 | acpi_status status = AE_OK; |
224 | 224 | ||
225 | ACPI_FUNCTION_TRACE("acpi_thermal_get_temperature"); | ||
226 | 225 | ||
227 | if (!tz) | 226 | if (!tz) |
228 | return_VALUE(-EINVAL); | 227 | return -EINVAL; |
229 | 228 | ||
230 | tz->last_temperature = tz->temperature; | 229 | tz->last_temperature = tz->temperature; |
231 | 230 | ||
232 | status = | 231 | status = |
233 | acpi_evaluate_integer(tz->handle, "_TMP", NULL, &tz->temperature); | 232 | acpi_evaluate_integer(tz->handle, "_TMP", NULL, &tz->temperature); |
234 | if (ACPI_FAILURE(status)) | 233 | if (ACPI_FAILURE(status)) |
235 | return_VALUE(-ENODEV); | 234 | return -ENODEV; |
236 | 235 | ||
237 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Temperature is %lu dK\n", | 236 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Temperature is %lu dK\n", |
238 | tz->temperature)); | 237 | tz->temperature)); |
239 | 238 | ||
240 | return_VALUE(0); | 239 | return 0; |
241 | } | 240 | } |
242 | 241 | ||
243 | static int acpi_thermal_get_polling_frequency(struct acpi_thermal *tz) | 242 | static int acpi_thermal_get_polling_frequency(struct acpi_thermal *tz) |
244 | { | 243 | { |
245 | acpi_status status = AE_OK; | 244 | acpi_status status = AE_OK; |
246 | 245 | ||
247 | ACPI_FUNCTION_TRACE("acpi_thermal_get_polling_frequency"); | ||
248 | 246 | ||
249 | if (!tz) | 247 | if (!tz) |
250 | return_VALUE(-EINVAL); | 248 | return -EINVAL; |
251 | 249 | ||
252 | status = | 250 | status = |
253 | acpi_evaluate_integer(tz->handle, "_TZP", NULL, | 251 | acpi_evaluate_integer(tz->handle, "_TZP", NULL, |
254 | &tz->polling_frequency); | 252 | &tz->polling_frequency); |
255 | if (ACPI_FAILURE(status)) | 253 | if (ACPI_FAILURE(status)) |
256 | return_VALUE(-ENODEV); | 254 | return -ENODEV; |
257 | 255 | ||
258 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Polling frequency is %lu dS\n", | 256 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Polling frequency is %lu dS\n", |
259 | tz->polling_frequency)); | 257 | tz->polling_frequency)); |
260 | 258 | ||
261 | return_VALUE(0); | 259 | return 0; |
262 | } | 260 | } |
263 | 261 | ||
264 | static int acpi_thermal_set_polling(struct acpi_thermal *tz, int seconds) | 262 | static int acpi_thermal_set_polling(struct acpi_thermal *tz, int seconds) |
265 | { | 263 | { |
266 | ACPI_FUNCTION_TRACE("acpi_thermal_set_polling"); | ||
267 | 264 | ||
268 | if (!tz) | 265 | if (!tz) |
269 | return_VALUE(-EINVAL); | 266 | return -EINVAL; |
270 | 267 | ||
271 | tz->polling_frequency = seconds * 10; /* Convert value to deci-seconds */ | 268 | tz->polling_frequency = seconds * 10; /* Convert value to deci-seconds */ |
272 | 269 | ||
@@ -274,7 +271,7 @@ static int acpi_thermal_set_polling(struct acpi_thermal *tz, int seconds) | |||
274 | "Polling frequency set to %lu seconds\n", | 271 | "Polling frequency set to %lu seconds\n", |
275 | tz->polling_frequency)); | 272 | tz->polling_frequency)); |
276 | 273 | ||
277 | return_VALUE(0); | 274 | return 0; |
278 | } | 275 | } |
279 | 276 | ||
280 | static int acpi_thermal_set_cooling_mode(struct acpi_thermal *tz, int mode) | 277 | static int acpi_thermal_set_cooling_mode(struct acpi_thermal *tz, int mode) |
@@ -284,29 +281,28 @@ static int acpi_thermal_set_cooling_mode(struct acpi_thermal *tz, int mode) | |||
284 | struct acpi_object_list arg_list = { 1, &arg0 }; | 281 | struct acpi_object_list arg_list = { 1, &arg0 }; |
285 | acpi_handle handle = NULL; | 282 | acpi_handle handle = NULL; |
286 | 283 | ||
287 | ACPI_FUNCTION_TRACE("acpi_thermal_set_cooling_mode"); | ||
288 | 284 | ||
289 | if (!tz) | 285 | if (!tz) |
290 | return_VALUE(-EINVAL); | 286 | return -EINVAL; |
291 | 287 | ||
292 | status = acpi_get_handle(tz->handle, "_SCP", &handle); | 288 | status = acpi_get_handle(tz->handle, "_SCP", &handle); |
293 | if (ACPI_FAILURE(status)) { | 289 | if (ACPI_FAILURE(status)) { |
294 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "_SCP not present\n")); | 290 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "_SCP not present\n")); |
295 | return_VALUE(-ENODEV); | 291 | return -ENODEV; |
296 | } | 292 | } |
297 | 293 | ||
298 | arg0.integer.value = mode; | 294 | arg0.integer.value = mode; |
299 | 295 | ||
300 | status = acpi_evaluate_object(handle, NULL, &arg_list, NULL); | 296 | status = acpi_evaluate_object(handle, NULL, &arg_list, NULL); |
301 | if (ACPI_FAILURE(status)) | 297 | if (ACPI_FAILURE(status)) |
302 | return_VALUE(-ENODEV); | 298 | return -ENODEV; |
303 | 299 | ||
304 | tz->cooling_mode = mode; | 300 | tz->cooling_mode = mode; |
305 | 301 | ||
306 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Cooling mode [%s]\n", | 302 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Cooling mode [%s]\n", |
307 | mode ? "passive" : "active")); | 303 | mode ? "passive" : "active")); |
308 | 304 | ||
309 | return_VALUE(0); | 305 | return 0; |
310 | } | 306 | } |
311 | 307 | ||
312 | static int acpi_thermal_get_trip_points(struct acpi_thermal *tz) | 308 | static int acpi_thermal_get_trip_points(struct acpi_thermal *tz) |
@@ -314,10 +310,9 @@ static int acpi_thermal_get_trip_points(struct acpi_thermal *tz) | |||
314 | acpi_status status = AE_OK; | 310 | acpi_status status = AE_OK; |
315 | int i = 0; | 311 | int i = 0; |
316 | 312 | ||
317 | ACPI_FUNCTION_TRACE("acpi_thermal_get_trip_points"); | ||
318 | 313 | ||
319 | if (!tz) | 314 | if (!tz) |
320 | return_VALUE(-EINVAL); | 315 | return -EINVAL; |
321 | 316 | ||
322 | /* Critical Shutdown (required) */ | 317 | /* Critical Shutdown (required) */ |
323 | 318 | ||
@@ -326,7 +321,7 @@ static int acpi_thermal_get_trip_points(struct acpi_thermal *tz) | |||
326 | if (ACPI_FAILURE(status)) { | 321 | if (ACPI_FAILURE(status)) { |
327 | tz->trips.critical.flags.valid = 0; | 322 | tz->trips.critical.flags.valid = 0; |
328 | ACPI_EXCEPTION((AE_INFO, status, "No critical threshold")); | 323 | ACPI_EXCEPTION((AE_INFO, status, "No critical threshold")); |
329 | return_VALUE(-ENODEV); | 324 | return -ENODEV; |
330 | } else { | 325 | } else { |
331 | tz->trips.critical.flags.valid = 1; | 326 | tz->trips.critical.flags.valid = 1; |
332 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 327 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
@@ -417,24 +412,23 @@ static int acpi_thermal_get_trip_points(struct acpi_thermal *tz) | |||
417 | "Invalid active threshold [%d]", i)); | 412 | "Invalid active threshold [%d]", i)); |
418 | } | 413 | } |
419 | 414 | ||
420 | return_VALUE(0); | 415 | return 0; |
421 | } | 416 | } |
422 | 417 | ||
423 | static int acpi_thermal_get_devices(struct acpi_thermal *tz) | 418 | static int acpi_thermal_get_devices(struct acpi_thermal *tz) |
424 | { | 419 | { |
425 | acpi_status status = AE_OK; | 420 | acpi_status status = AE_OK; |
426 | 421 | ||
427 | ACPI_FUNCTION_TRACE("acpi_thermal_get_devices"); | ||
428 | 422 | ||
429 | if (!tz) | 423 | if (!tz) |
430 | return_VALUE(-EINVAL); | 424 | return -EINVAL; |
431 | 425 | ||
432 | status = | 426 | status = |
433 | acpi_evaluate_reference(tz->handle, "_TZD", NULL, &tz->devices); | 427 | acpi_evaluate_reference(tz->handle, "_TZD", NULL, &tz->devices); |
434 | if (ACPI_FAILURE(status)) | 428 | if (ACPI_FAILURE(status)) |
435 | return_VALUE(-ENODEV); | 429 | return -ENODEV; |
436 | 430 | ||
437 | return_VALUE(0); | 431 | return 0; |
438 | } | 432 | } |
439 | 433 | ||
440 | static int acpi_thermal_call_usermode(char *path) | 434 | static int acpi_thermal_call_usermode(char *path) |
@@ -442,10 +436,9 @@ static int acpi_thermal_call_usermode(char *path) | |||
442 | char *argv[2] = { NULL, NULL }; | 436 | char *argv[2] = { NULL, NULL }; |
443 | char *envp[3] = { NULL, NULL, NULL }; | 437 | char *envp[3] = { NULL, NULL, NULL }; |
444 | 438 | ||
445 | ACPI_FUNCTION_TRACE("acpi_thermal_call_usermode"); | ||
446 | 439 | ||
447 | if (!path) | 440 | if (!path) |
448 | return_VALUE(-EINVAL); | 441 | return -EINVAL; |
449 | 442 | ||
450 | argv[0] = path; | 443 | argv[0] = path; |
451 | 444 | ||
@@ -455,7 +448,7 @@ static int acpi_thermal_call_usermode(char *path) | |||
455 | 448 | ||
456 | call_usermodehelper(argv[0], argv, envp, 0); | 449 | call_usermodehelper(argv[0], argv, envp, 0); |
457 | 450 | ||
458 | return_VALUE(0); | 451 | return 0; |
459 | } | 452 | } |
460 | 453 | ||
461 | static int acpi_thermal_critical(struct acpi_thermal *tz) | 454 | static int acpi_thermal_critical(struct acpi_thermal *tz) |
@@ -463,10 +456,9 @@ static int acpi_thermal_critical(struct acpi_thermal *tz) | |||
463 | int result = 0; | 456 | int result = 0; |
464 | struct acpi_device *device = NULL; | 457 | struct acpi_device *device = NULL; |
465 | 458 | ||
466 | ACPI_FUNCTION_TRACE("acpi_thermal_critical"); | ||
467 | 459 | ||
468 | if (!tz || !tz->trips.critical.flags.valid) | 460 | if (!tz || !tz->trips.critical.flags.valid) |
469 | return_VALUE(-EINVAL); | 461 | return -EINVAL; |
470 | 462 | ||
471 | if (tz->temperature >= tz->trips.critical.temperature) { | 463 | if (tz->temperature >= tz->trips.critical.temperature) { |
472 | printk(KERN_WARNING PREFIX "Critical trip point\n"); | 464 | printk(KERN_WARNING PREFIX "Critical trip point\n"); |
@@ -476,7 +468,7 @@ static int acpi_thermal_critical(struct acpi_thermal *tz) | |||
476 | 468 | ||
477 | result = acpi_bus_get_device(tz->handle, &device); | 469 | result = acpi_bus_get_device(tz->handle, &device); |
478 | if (result) | 470 | if (result) |
479 | return_VALUE(result); | 471 | return result; |
480 | 472 | ||
481 | printk(KERN_EMERG | 473 | printk(KERN_EMERG |
482 | "Critical temperature reached (%ld C), shutting down.\n", | 474 | "Critical temperature reached (%ld C), shutting down.\n", |
@@ -486,7 +478,7 @@ static int acpi_thermal_critical(struct acpi_thermal *tz) | |||
486 | 478 | ||
487 | acpi_thermal_call_usermode(ACPI_THERMAL_PATH_POWEROFF); | 479 | acpi_thermal_call_usermode(ACPI_THERMAL_PATH_POWEROFF); |
488 | 480 | ||
489 | return_VALUE(0); | 481 | return 0; |
490 | } | 482 | } |
491 | 483 | ||
492 | static int acpi_thermal_hot(struct acpi_thermal *tz) | 484 | static int acpi_thermal_hot(struct acpi_thermal *tz) |
@@ -494,10 +486,9 @@ static int acpi_thermal_hot(struct acpi_thermal *tz) | |||
494 | int result = 0; | 486 | int result = 0; |
495 | struct acpi_device *device = NULL; | 487 | struct acpi_device *device = NULL; |
496 | 488 | ||
497 | ACPI_FUNCTION_TRACE("acpi_thermal_hot"); | ||
498 | 489 | ||
499 | if (!tz || !tz->trips.hot.flags.valid) | 490 | if (!tz || !tz->trips.hot.flags.valid) |
500 | return_VALUE(-EINVAL); | 491 | return -EINVAL; |
501 | 492 | ||
502 | if (tz->temperature >= tz->trips.hot.temperature) { | 493 | if (tz->temperature >= tz->trips.hot.temperature) { |
503 | printk(KERN_WARNING PREFIX "Hot trip point\n"); | 494 | printk(KERN_WARNING PREFIX "Hot trip point\n"); |
@@ -507,14 +498,14 @@ static int acpi_thermal_hot(struct acpi_thermal *tz) | |||
507 | 498 | ||
508 | result = acpi_bus_get_device(tz->handle, &device); | 499 | result = acpi_bus_get_device(tz->handle, &device); |
509 | if (result) | 500 | if (result) |
510 | return_VALUE(result); | 501 | return result; |
511 | 502 | ||
512 | acpi_bus_generate_event(device, ACPI_THERMAL_NOTIFY_HOT, | 503 | acpi_bus_generate_event(device, ACPI_THERMAL_NOTIFY_HOT, |
513 | tz->trips.hot.flags.enabled); | 504 | tz->trips.hot.flags.enabled); |
514 | 505 | ||
515 | /* TBD: Call user-mode "sleep(S4)" function */ | 506 | /* TBD: Call user-mode "sleep(S4)" function */ |
516 | 507 | ||
517 | return_VALUE(0); | 508 | return 0; |
518 | } | 509 | } |
519 | 510 | ||
520 | static void acpi_thermal_passive(struct acpi_thermal *tz) | 511 | static void acpi_thermal_passive(struct acpi_thermal *tz) |
@@ -524,7 +515,6 @@ static void acpi_thermal_passive(struct acpi_thermal *tz) | |||
524 | int trend = 0; | 515 | int trend = 0; |
525 | int i = 0; | 516 | int i = 0; |
526 | 517 | ||
527 | ACPI_FUNCTION_TRACE("acpi_thermal_passive"); | ||
528 | 518 | ||
529 | if (!tz || !tz->trips.passive.flags.valid) | 519 | if (!tz || !tz->trips.passive.flags.valid) |
530 | return; | 520 | return; |
@@ -613,7 +603,6 @@ static void acpi_thermal_active(struct acpi_thermal *tz) | |||
613 | int j = 0; | 603 | int j = 0; |
614 | unsigned long maxtemp = 0; | 604 | unsigned long maxtemp = 0; |
615 | 605 | ||
616 | ACPI_FUNCTION_TRACE("acpi_thermal_active"); | ||
617 | 606 | ||
618 | if (!tz) | 607 | if (!tz) |
619 | return; | 608 | return; |
@@ -695,18 +684,17 @@ static void acpi_thermal_check(void *data) | |||
695 | int i = 0; | 684 | int i = 0; |
696 | struct acpi_thermal_state state; | 685 | struct acpi_thermal_state state; |
697 | 686 | ||
698 | ACPI_FUNCTION_TRACE("acpi_thermal_check"); | ||
699 | 687 | ||
700 | if (!tz) { | 688 | if (!tz) { |
701 | printk(KERN_ERR PREFIX "Invalid (NULL) context\n"); | 689 | printk(KERN_ERR PREFIX "Invalid (NULL) context\n"); |
702 | return_VOID; | 690 | return; |
703 | } | 691 | } |
704 | 692 | ||
705 | state = tz->state; | 693 | state = tz->state; |
706 | 694 | ||
707 | result = acpi_thermal_get_temperature(tz); | 695 | result = acpi_thermal_get_temperature(tz); |
708 | if (result) | 696 | if (result) |
709 | return_VOID; | 697 | return; |
710 | 698 | ||
711 | memset(&tz->state, 0, sizeof(tz->state)); | 699 | memset(&tz->state, 0, sizeof(tz->state)); |
712 | 700 | ||
@@ -795,7 +783,7 @@ static void acpi_thermal_check(void *data) | |||
795 | } | 783 | } |
796 | } | 784 | } |
797 | 785 | ||
798 | return_VOID; | 786 | return; |
799 | } | 787 | } |
800 | 788 | ||
801 | /* -------------------------------------------------------------------------- | 789 | /* -------------------------------------------------------------------------- |
@@ -808,7 +796,6 @@ static int acpi_thermal_state_seq_show(struct seq_file *seq, void *offset) | |||
808 | { | 796 | { |
809 | struct acpi_thermal *tz = (struct acpi_thermal *)seq->private; | 797 | struct acpi_thermal *tz = (struct acpi_thermal *)seq->private; |
810 | 798 | ||
811 | ACPI_FUNCTION_TRACE("acpi_thermal_state_seq_show"); | ||
812 | 799 | ||
813 | if (!tz) | 800 | if (!tz) |
814 | goto end; | 801 | goto end; |
@@ -831,7 +818,7 @@ static int acpi_thermal_state_seq_show(struct seq_file *seq, void *offset) | |||
831 | } | 818 | } |
832 | 819 | ||
833 | end: | 820 | end: |
834 | return_VALUE(0); | 821 | return 0; |
835 | } | 822 | } |
836 | 823 | ||
837 | static int acpi_thermal_state_open_fs(struct inode *inode, struct file *file) | 824 | static int acpi_thermal_state_open_fs(struct inode *inode, struct file *file) |
@@ -844,7 +831,6 @@ static int acpi_thermal_temp_seq_show(struct seq_file *seq, void *offset) | |||
844 | int result = 0; | 831 | int result = 0; |
845 | struct acpi_thermal *tz = (struct acpi_thermal *)seq->private; | 832 | struct acpi_thermal *tz = (struct acpi_thermal *)seq->private; |
846 | 833 | ||
847 | ACPI_FUNCTION_TRACE("acpi_thermal_temp_seq_show"); | ||
848 | 834 | ||
849 | if (!tz) | 835 | if (!tz) |
850 | goto end; | 836 | goto end; |
@@ -857,7 +843,7 @@ static int acpi_thermal_temp_seq_show(struct seq_file *seq, void *offset) | |||
857 | KELVIN_TO_CELSIUS(tz->temperature)); | 843 | KELVIN_TO_CELSIUS(tz->temperature)); |
858 | 844 | ||
859 | end: | 845 | end: |
860 | return_VALUE(0); | 846 | return 0; |
861 | } | 847 | } |
862 | 848 | ||
863 | static int acpi_thermal_temp_open_fs(struct inode *inode, struct file *file) | 849 | static int acpi_thermal_temp_open_fs(struct inode *inode, struct file *file) |
@@ -871,7 +857,6 @@ static int acpi_thermal_trip_seq_show(struct seq_file *seq, void *offset) | |||
871 | int i = 0; | 857 | int i = 0; |
872 | int j = 0; | 858 | int j = 0; |
873 | 859 | ||
874 | ACPI_FUNCTION_TRACE("acpi_thermal_trip_seq_show"); | ||
875 | 860 | ||
876 | if (!tz) | 861 | if (!tz) |
877 | goto end; | 862 | goto end; |
@@ -911,7 +896,7 @@ static int acpi_thermal_trip_seq_show(struct seq_file *seq, void *offset) | |||
911 | } | 896 | } |
912 | 897 | ||
913 | end: | 898 | end: |
914 | return_VALUE(0); | 899 | return 0; |
915 | } | 900 | } |
916 | 901 | ||
917 | static int acpi_thermal_trip_open_fs(struct inode *inode, struct file *file) | 902 | static int acpi_thermal_trip_open_fs(struct inode *inode, struct file *file) |
@@ -932,18 +917,17 @@ acpi_thermal_write_trip_points(struct file *file, | |||
932 | int *active; | 917 | int *active; |
933 | int i = 0; | 918 | int i = 0; |
934 | 919 | ||
935 | ACPI_FUNCTION_TRACE("acpi_thermal_write_trip_points"); | ||
936 | 920 | ||
937 | limit_string = kmalloc(ACPI_THERMAL_MAX_LIMIT_STR_LEN, GFP_KERNEL); | 921 | limit_string = kmalloc(ACPI_THERMAL_MAX_LIMIT_STR_LEN, GFP_KERNEL); |
938 | if (!limit_string) | 922 | if (!limit_string) |
939 | return_VALUE(-ENOMEM); | 923 | return -ENOMEM; |
940 | 924 | ||
941 | memset(limit_string, 0, ACPI_THERMAL_MAX_LIMIT_STR_LEN); | 925 | memset(limit_string, 0, ACPI_THERMAL_MAX_LIMIT_STR_LEN); |
942 | 926 | ||
943 | active = kmalloc(ACPI_THERMAL_MAX_ACTIVE * sizeof(int), GFP_KERNEL); | 927 | active = kmalloc(ACPI_THERMAL_MAX_ACTIVE * sizeof(int), GFP_KERNEL); |
944 | if (!active) { | 928 | if (!active) { |
945 | kfree(limit_string); | 929 | kfree(limit_string); |
946 | return_VALUE(-ENOMEM); | 930 | return -ENOMEM; |
947 | } | 931 | } |
948 | 932 | ||
949 | if (!tz || (count > ACPI_THERMAL_MAX_LIMIT_STR_LEN - 1)) { | 933 | if (!tz || (count > ACPI_THERMAL_MAX_LIMIT_STR_LEN - 1)) { |
@@ -980,14 +964,13 @@ acpi_thermal_write_trip_points(struct file *file, | |||
980 | end: | 964 | end: |
981 | kfree(active); | 965 | kfree(active); |
982 | kfree(limit_string); | 966 | kfree(limit_string); |
983 | return_VALUE(count); | 967 | return count; |
984 | } | 968 | } |
985 | 969 | ||
986 | static int acpi_thermal_cooling_seq_show(struct seq_file *seq, void *offset) | 970 | static int acpi_thermal_cooling_seq_show(struct seq_file *seq, void *offset) |
987 | { | 971 | { |
988 | struct acpi_thermal *tz = (struct acpi_thermal *)seq->private; | 972 | struct acpi_thermal *tz = (struct acpi_thermal *)seq->private; |
989 | 973 | ||
990 | ACPI_FUNCTION_TRACE("acpi_thermal_cooling_seq_show"); | ||
991 | 974 | ||
992 | if (!tz) | 975 | if (!tz) |
993 | goto end; | 976 | goto end; |
@@ -1003,7 +986,7 @@ static int acpi_thermal_cooling_seq_show(struct seq_file *seq, void *offset) | |||
1003 | tz->cooling_mode ? "passive" : "active"); | 986 | tz->cooling_mode ? "passive" : "active"); |
1004 | 987 | ||
1005 | end: | 988 | end: |
1006 | return_VALUE(0); | 989 | return 0; |
1007 | } | 990 | } |
1008 | 991 | ||
1009 | static int acpi_thermal_cooling_open_fs(struct inode *inode, struct file *file) | 992 | static int acpi_thermal_cooling_open_fs(struct inode *inode, struct file *file) |
@@ -1022,16 +1005,15 @@ acpi_thermal_write_cooling_mode(struct file *file, | |||
1022 | int result = 0; | 1005 | int result = 0; |
1023 | char mode_string[12] = { '\0' }; | 1006 | char mode_string[12] = { '\0' }; |
1024 | 1007 | ||
1025 | ACPI_FUNCTION_TRACE("acpi_thermal_write_cooling_mode"); | ||
1026 | 1008 | ||
1027 | if (!tz || (count > sizeof(mode_string) - 1)) | 1009 | if (!tz || (count > sizeof(mode_string) - 1)) |
1028 | return_VALUE(-EINVAL); | 1010 | return -EINVAL; |
1029 | 1011 | ||
1030 | if (!tz->flags.cooling_mode) | 1012 | if (!tz->flags.cooling_mode) |
1031 | return_VALUE(-ENODEV); | 1013 | return -ENODEV; |
1032 | 1014 | ||
1033 | if (copy_from_user(mode_string, buffer, count)) | 1015 | if (copy_from_user(mode_string, buffer, count)) |
1034 | return_VALUE(-EFAULT); | 1016 | return -EFAULT; |
1035 | 1017 | ||
1036 | mode_string[count] = '\0'; | 1018 | mode_string[count] = '\0'; |
1037 | 1019 | ||
@@ -1039,18 +1021,17 @@ acpi_thermal_write_cooling_mode(struct file *file, | |||
1039 | simple_strtoul(mode_string, NULL, | 1021 | simple_strtoul(mode_string, NULL, |
1040 | 0)); | 1022 | 0)); |
1041 | if (result) | 1023 | if (result) |
1042 | return_VALUE(result); | 1024 | return result; |
1043 | 1025 | ||
1044 | acpi_thermal_check(tz); | 1026 | acpi_thermal_check(tz); |
1045 | 1027 | ||
1046 | return_VALUE(count); | 1028 | return count; |
1047 | } | 1029 | } |
1048 | 1030 | ||
1049 | static int acpi_thermal_polling_seq_show(struct seq_file *seq, void *offset) | 1031 | static int acpi_thermal_polling_seq_show(struct seq_file *seq, void *offset) |
1050 | { | 1032 | { |
1051 | struct acpi_thermal *tz = (struct acpi_thermal *)seq->private; | 1033 | struct acpi_thermal *tz = (struct acpi_thermal *)seq->private; |
1052 | 1034 | ||
1053 | ACPI_FUNCTION_TRACE("acpi_thermal_polling_seq_show"); | ||
1054 | 1035 | ||
1055 | if (!tz) | 1036 | if (!tz) |
1056 | goto end; | 1037 | goto end; |
@@ -1064,7 +1045,7 @@ static int acpi_thermal_polling_seq_show(struct seq_file *seq, void *offset) | |||
1064 | (tz->polling_frequency / 10)); | 1045 | (tz->polling_frequency / 10)); |
1065 | 1046 | ||
1066 | end: | 1047 | end: |
1067 | return_VALUE(0); | 1048 | return 0; |
1068 | } | 1049 | } |
1069 | 1050 | ||
1070 | static int acpi_thermal_polling_open_fs(struct inode *inode, struct file *file) | 1051 | static int acpi_thermal_polling_open_fs(struct inode *inode, struct file *file) |
@@ -1084,13 +1065,12 @@ acpi_thermal_write_polling(struct file *file, | |||
1084 | char polling_string[12] = { '\0' }; | 1065 | char polling_string[12] = { '\0' }; |
1085 | int seconds = 0; | 1066 | int seconds = 0; |
1086 | 1067 | ||
1087 | ACPI_FUNCTION_TRACE("acpi_thermal_write_polling"); | ||
1088 | 1068 | ||
1089 | if (!tz || (count > sizeof(polling_string) - 1)) | 1069 | if (!tz || (count > sizeof(polling_string) - 1)) |
1090 | return_VALUE(-EINVAL); | 1070 | return -EINVAL; |
1091 | 1071 | ||
1092 | if (copy_from_user(polling_string, buffer, count)) | 1072 | if (copy_from_user(polling_string, buffer, count)) |
1093 | return_VALUE(-EFAULT); | 1073 | return -EFAULT; |
1094 | 1074 | ||
1095 | polling_string[count] = '\0'; | 1075 | polling_string[count] = '\0'; |
1096 | 1076 | ||
@@ -1098,24 +1078,23 @@ acpi_thermal_write_polling(struct file *file, | |||
1098 | 1078 | ||
1099 | result = acpi_thermal_set_polling(tz, seconds); | 1079 | result = acpi_thermal_set_polling(tz, seconds); |
1100 | if (result) | 1080 | if (result) |
1101 | return_VALUE(result); | 1081 | return result; |
1102 | 1082 | ||
1103 | acpi_thermal_check(tz); | 1083 | acpi_thermal_check(tz); |
1104 | 1084 | ||
1105 | return_VALUE(count); | 1085 | return count; |
1106 | } | 1086 | } |
1107 | 1087 | ||
1108 | static int acpi_thermal_add_fs(struct acpi_device *device) | 1088 | static int acpi_thermal_add_fs(struct acpi_device *device) |
1109 | { | 1089 | { |
1110 | struct proc_dir_entry *entry = NULL; | 1090 | struct proc_dir_entry *entry = NULL; |
1111 | 1091 | ||
1112 | ACPI_FUNCTION_TRACE("acpi_thermal_add_fs"); | ||
1113 | 1092 | ||
1114 | if (!acpi_device_dir(device)) { | 1093 | if (!acpi_device_dir(device)) { |
1115 | acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), | 1094 | acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), |
1116 | acpi_thermal_dir); | 1095 | acpi_thermal_dir); |
1117 | if (!acpi_device_dir(device)) | 1096 | if (!acpi_device_dir(device)) |
1118 | return_VALUE(-ENODEV); | 1097 | return -ENODEV; |
1119 | acpi_device_dir(device)->owner = THIS_MODULE; | 1098 | acpi_device_dir(device)->owner = THIS_MODULE; |
1120 | } | 1099 | } |
1121 | 1100 | ||
@@ -1123,7 +1102,7 @@ static int acpi_thermal_add_fs(struct acpi_device *device) | |||
1123 | entry = create_proc_entry(ACPI_THERMAL_FILE_STATE, | 1102 | entry = create_proc_entry(ACPI_THERMAL_FILE_STATE, |
1124 | S_IRUGO, acpi_device_dir(device)); | 1103 | S_IRUGO, acpi_device_dir(device)); |
1125 | if (!entry) | 1104 | if (!entry) |
1126 | return_VALUE(-ENODEV); | 1105 | return -ENODEV; |
1127 | else { | 1106 | else { |
1128 | entry->proc_fops = &acpi_thermal_state_fops; | 1107 | entry->proc_fops = &acpi_thermal_state_fops; |
1129 | entry->data = acpi_driver_data(device); | 1108 | entry->data = acpi_driver_data(device); |
@@ -1134,7 +1113,7 @@ static int acpi_thermal_add_fs(struct acpi_device *device) | |||
1134 | entry = create_proc_entry(ACPI_THERMAL_FILE_TEMPERATURE, | 1113 | entry = create_proc_entry(ACPI_THERMAL_FILE_TEMPERATURE, |
1135 | S_IRUGO, acpi_device_dir(device)); | 1114 | S_IRUGO, acpi_device_dir(device)); |
1136 | if (!entry) | 1115 | if (!entry) |
1137 | return_VALUE(-ENODEV); | 1116 | return -ENODEV; |
1138 | else { | 1117 | else { |
1139 | entry->proc_fops = &acpi_thermal_temp_fops; | 1118 | entry->proc_fops = &acpi_thermal_temp_fops; |
1140 | entry->data = acpi_driver_data(device); | 1119 | entry->data = acpi_driver_data(device); |
@@ -1146,7 +1125,7 @@ static int acpi_thermal_add_fs(struct acpi_device *device) | |||
1146 | S_IFREG | S_IRUGO | S_IWUSR, | 1125 | S_IFREG | S_IRUGO | S_IWUSR, |
1147 | acpi_device_dir(device)); | 1126 | acpi_device_dir(device)); |
1148 | if (!entry) | 1127 | if (!entry) |
1149 | return_VALUE(-ENODEV); | 1128 | return -ENODEV; |
1150 | else { | 1129 | else { |
1151 | entry->proc_fops = &acpi_thermal_trip_fops; | 1130 | entry->proc_fops = &acpi_thermal_trip_fops; |
1152 | entry->data = acpi_driver_data(device); | 1131 | entry->data = acpi_driver_data(device); |
@@ -1158,7 +1137,7 @@ static int acpi_thermal_add_fs(struct acpi_device *device) | |||
1158 | S_IFREG | S_IRUGO | S_IWUSR, | 1137 | S_IFREG | S_IRUGO | S_IWUSR, |
1159 | acpi_device_dir(device)); | 1138 | acpi_device_dir(device)); |
1160 | if (!entry) | 1139 | if (!entry) |
1161 | return_VALUE(-ENODEV); | 1140 | return -ENODEV; |
1162 | else { | 1141 | else { |
1163 | entry->proc_fops = &acpi_thermal_cooling_fops; | 1142 | entry->proc_fops = &acpi_thermal_cooling_fops; |
1164 | entry->data = acpi_driver_data(device); | 1143 | entry->data = acpi_driver_data(device); |
@@ -1170,19 +1149,18 @@ static int acpi_thermal_add_fs(struct acpi_device *device) | |||
1170 | S_IFREG | S_IRUGO | S_IWUSR, | 1149 | S_IFREG | S_IRUGO | S_IWUSR, |
1171 | acpi_device_dir(device)); | 1150 | acpi_device_dir(device)); |
1172 | if (!entry) | 1151 | if (!entry) |
1173 | return_VALUE(-ENODEV); | 1152 | return -ENODEV; |
1174 | else { | 1153 | else { |
1175 | entry->proc_fops = &acpi_thermal_polling_fops; | 1154 | entry->proc_fops = &acpi_thermal_polling_fops; |
1176 | entry->data = acpi_driver_data(device); | 1155 | entry->data = acpi_driver_data(device); |
1177 | entry->owner = THIS_MODULE; | 1156 | entry->owner = THIS_MODULE; |
1178 | } | 1157 | } |
1179 | 1158 | ||
1180 | return_VALUE(0); | 1159 | return 0; |
1181 | } | 1160 | } |
1182 | 1161 | ||
1183 | static int acpi_thermal_remove_fs(struct acpi_device *device) | 1162 | static int acpi_thermal_remove_fs(struct acpi_device *device) |
1184 | { | 1163 | { |
1185 | ACPI_FUNCTION_TRACE("acpi_thermal_remove_fs"); | ||
1186 | 1164 | ||
1187 | if (acpi_device_dir(device)) { | 1165 | if (acpi_device_dir(device)) { |
1188 | remove_proc_entry(ACPI_THERMAL_FILE_POLLING_FREQ, | 1166 | remove_proc_entry(ACPI_THERMAL_FILE_POLLING_FREQ, |
@@ -1199,7 +1177,7 @@ static int acpi_thermal_remove_fs(struct acpi_device *device) | |||
1199 | acpi_device_dir(device) = NULL; | 1177 | acpi_device_dir(device) = NULL; |
1200 | } | 1178 | } |
1201 | 1179 | ||
1202 | return_VALUE(0); | 1180 | return 0; |
1203 | } | 1181 | } |
1204 | 1182 | ||
1205 | /* -------------------------------------------------------------------------- | 1183 | /* -------------------------------------------------------------------------- |
@@ -1211,13 +1189,12 @@ static void acpi_thermal_notify(acpi_handle handle, u32 event, void *data) | |||
1211 | struct acpi_thermal *tz = (struct acpi_thermal *)data; | 1189 | struct acpi_thermal *tz = (struct acpi_thermal *)data; |
1212 | struct acpi_device *device = NULL; | 1190 | struct acpi_device *device = NULL; |
1213 | 1191 | ||
1214 | ACPI_FUNCTION_TRACE("acpi_thermal_notify"); | ||
1215 | 1192 | ||
1216 | if (!tz) | 1193 | if (!tz) |
1217 | return_VOID; | 1194 | return; |
1218 | 1195 | ||
1219 | if (acpi_bus_get_device(tz->handle, &device)) | 1196 | if (acpi_bus_get_device(tz->handle, &device)) |
1220 | return_VOID; | 1197 | return; |
1221 | 1198 | ||
1222 | switch (event) { | 1199 | switch (event) { |
1223 | case ACPI_THERMAL_NOTIFY_TEMPERATURE: | 1200 | case ACPI_THERMAL_NOTIFY_TEMPERATURE: |
@@ -1239,27 +1216,26 @@ static void acpi_thermal_notify(acpi_handle handle, u32 event, void *data) | |||
1239 | break; | 1216 | break; |
1240 | } | 1217 | } |
1241 | 1218 | ||
1242 | return_VOID; | 1219 | return; |
1243 | } | 1220 | } |
1244 | 1221 | ||
1245 | static int acpi_thermal_get_info(struct acpi_thermal *tz) | 1222 | static int acpi_thermal_get_info(struct acpi_thermal *tz) |
1246 | { | 1223 | { |
1247 | int result = 0; | 1224 | int result = 0; |
1248 | 1225 | ||
1249 | ACPI_FUNCTION_TRACE("acpi_thermal_get_info"); | ||
1250 | 1226 | ||
1251 | if (!tz) | 1227 | if (!tz) |
1252 | return_VALUE(-EINVAL); | 1228 | return -EINVAL; |
1253 | 1229 | ||
1254 | /* Get temperature [_TMP] (required) */ | 1230 | /* Get temperature [_TMP] (required) */ |
1255 | result = acpi_thermal_get_temperature(tz); | 1231 | result = acpi_thermal_get_temperature(tz); |
1256 | if (result) | 1232 | if (result) |
1257 | return_VALUE(result); | 1233 | return result; |
1258 | 1234 | ||
1259 | /* Get trip points [_CRT, _PSV, etc.] (required) */ | 1235 | /* Get trip points [_CRT, _PSV, etc.] (required) */ |
1260 | result = acpi_thermal_get_trip_points(tz); | 1236 | result = acpi_thermal_get_trip_points(tz); |
1261 | if (result) | 1237 | if (result) |
1262 | return_VALUE(result); | 1238 | return result; |
1263 | 1239 | ||
1264 | /* Set the cooling mode [_SCP] to active cooling (default) */ | 1240 | /* Set the cooling mode [_SCP] to active cooling (default) */ |
1265 | result = acpi_thermal_set_cooling_mode(tz, ACPI_THERMAL_MODE_ACTIVE); | 1241 | result = acpi_thermal_set_cooling_mode(tz, ACPI_THERMAL_MODE_ACTIVE); |
@@ -1299,7 +1275,7 @@ static int acpi_thermal_get_info(struct acpi_thermal *tz) | |||
1299 | if (!result) | 1275 | if (!result) |
1300 | tz->flags.devices = 1; | 1276 | tz->flags.devices = 1; |
1301 | 1277 | ||
1302 | return_VALUE(0); | 1278 | return 0; |
1303 | } | 1279 | } |
1304 | 1280 | ||
1305 | static int acpi_thermal_add(struct acpi_device *device) | 1281 | static int acpi_thermal_add(struct acpi_device *device) |
@@ -1308,14 +1284,13 @@ static int acpi_thermal_add(struct acpi_device *device) | |||
1308 | acpi_status status = AE_OK; | 1284 | acpi_status status = AE_OK; |
1309 | struct acpi_thermal *tz = NULL; | 1285 | struct acpi_thermal *tz = NULL; |
1310 | 1286 | ||
1311 | ACPI_FUNCTION_TRACE("acpi_thermal_add"); | ||
1312 | 1287 | ||
1313 | if (!device) | 1288 | if (!device) |
1314 | return_VALUE(-EINVAL); | 1289 | return -EINVAL; |
1315 | 1290 | ||
1316 | tz = kmalloc(sizeof(struct acpi_thermal), GFP_KERNEL); | 1291 | tz = kmalloc(sizeof(struct acpi_thermal), GFP_KERNEL); |
1317 | if (!tz) | 1292 | if (!tz) |
1318 | return_VALUE(-ENOMEM); | 1293 | return -ENOMEM; |
1319 | memset(tz, 0, sizeof(struct acpi_thermal)); | 1294 | memset(tz, 0, sizeof(struct acpi_thermal)); |
1320 | 1295 | ||
1321 | tz->handle = device->handle; | 1296 | tz->handle = device->handle; |
@@ -1354,7 +1329,7 @@ static int acpi_thermal_add(struct acpi_device *device) | |||
1354 | kfree(tz); | 1329 | kfree(tz); |
1355 | } | 1330 | } |
1356 | 1331 | ||
1357 | return_VALUE(result); | 1332 | return result; |
1358 | } | 1333 | } |
1359 | 1334 | ||
1360 | static int acpi_thermal_remove(struct acpi_device *device, int type) | 1335 | static int acpi_thermal_remove(struct acpi_device *device, int type) |
@@ -1362,10 +1337,9 @@ static int acpi_thermal_remove(struct acpi_device *device, int type) | |||
1362 | acpi_status status = AE_OK; | 1337 | acpi_status status = AE_OK; |
1363 | struct acpi_thermal *tz = NULL; | 1338 | struct acpi_thermal *tz = NULL; |
1364 | 1339 | ||
1365 | ACPI_FUNCTION_TRACE("acpi_thermal_remove"); | ||
1366 | 1340 | ||
1367 | if (!device || !acpi_driver_data(device)) | 1341 | if (!device || !acpi_driver_data(device)) |
1368 | return_VALUE(-EINVAL); | 1342 | return -EINVAL; |
1369 | 1343 | ||
1370 | tz = (struct acpi_thermal *)acpi_driver_data(device); | 1344 | tz = (struct acpi_thermal *)acpi_driver_data(device); |
1371 | 1345 | ||
@@ -1396,7 +1370,7 @@ static int acpi_thermal_remove(struct acpi_device *device, int type) | |||
1396 | acpi_thermal_remove_fs(device); | 1370 | acpi_thermal_remove_fs(device); |
1397 | 1371 | ||
1398 | kfree(tz); | 1372 | kfree(tz); |
1399 | return_VALUE(0); | 1373 | return 0; |
1400 | } | 1374 | } |
1401 | 1375 | ||
1402 | static int acpi_thermal_resume(struct acpi_device *device, int state) | 1376 | static int acpi_thermal_resume(struct acpi_device *device, int state) |
@@ -1404,7 +1378,7 @@ static int acpi_thermal_resume(struct acpi_device *device, int state) | |||
1404 | struct acpi_thermal *tz = NULL; | 1378 | struct acpi_thermal *tz = NULL; |
1405 | 1379 | ||
1406 | if (!device || !acpi_driver_data(device)) | 1380 | if (!device || !acpi_driver_data(device)) |
1407 | return_VALUE(-EINVAL); | 1381 | return -EINVAL; |
1408 | 1382 | ||
1409 | tz = (struct acpi_thermal *)acpi_driver_data(device); | 1383 | tz = (struct acpi_thermal *)acpi_driver_data(device); |
1410 | 1384 | ||
@@ -1417,31 +1391,29 @@ static int __init acpi_thermal_init(void) | |||
1417 | { | 1391 | { |
1418 | int result = 0; | 1392 | int result = 0; |
1419 | 1393 | ||
1420 | ACPI_FUNCTION_TRACE("acpi_thermal_init"); | ||
1421 | 1394 | ||
1422 | acpi_thermal_dir = proc_mkdir(ACPI_THERMAL_CLASS, acpi_root_dir); | 1395 | acpi_thermal_dir = proc_mkdir(ACPI_THERMAL_CLASS, acpi_root_dir); |
1423 | if (!acpi_thermal_dir) | 1396 | if (!acpi_thermal_dir) |
1424 | return_VALUE(-ENODEV); | 1397 | return -ENODEV; |
1425 | acpi_thermal_dir->owner = THIS_MODULE; | 1398 | acpi_thermal_dir->owner = THIS_MODULE; |
1426 | 1399 | ||
1427 | result = acpi_bus_register_driver(&acpi_thermal_driver); | 1400 | result = acpi_bus_register_driver(&acpi_thermal_driver); |
1428 | if (result < 0) { | 1401 | if (result < 0) { |
1429 | remove_proc_entry(ACPI_THERMAL_CLASS, acpi_root_dir); | 1402 | remove_proc_entry(ACPI_THERMAL_CLASS, acpi_root_dir); |
1430 | return_VALUE(-ENODEV); | 1403 | return -ENODEV; |
1431 | } | 1404 | } |
1432 | 1405 | ||
1433 | return_VALUE(0); | 1406 | return 0; |
1434 | } | 1407 | } |
1435 | 1408 | ||
1436 | static void __exit acpi_thermal_exit(void) | 1409 | static void __exit acpi_thermal_exit(void) |
1437 | { | 1410 | { |
1438 | ACPI_FUNCTION_TRACE("acpi_thermal_exit"); | ||
1439 | 1411 | ||
1440 | acpi_bus_unregister_driver(&acpi_thermal_driver); | 1412 | acpi_bus_unregister_driver(&acpi_thermal_driver); |
1441 | 1413 | ||
1442 | remove_proc_entry(ACPI_THERMAL_CLASS, acpi_root_dir); | 1414 | remove_proc_entry(ACPI_THERMAL_CLASS, acpi_root_dir); |
1443 | 1415 | ||
1444 | return_VOID; | 1416 | return; |
1445 | } | 1417 | } |
1446 | 1418 | ||
1447 | module_init(acpi_thermal_init); | 1419 | module_init(acpi_thermal_init); |