diff options
Diffstat (limited to 'drivers/acpi/thermal.c')
-rw-r--r-- | drivers/acpi/thermal.c | 218 |
1 files changed, 85 insertions, 133 deletions
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index e7fe3a14fdaf..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 | ||
@@ -325,8 +320,8 @@ static int acpi_thermal_get_trip_points(struct acpi_thermal *tz) | |||
325 | &tz->trips.critical.temperature); | 320 | &tz->trips.critical.temperature); |
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_DEBUG_PRINT((ACPI_DB_ERROR, "No critical threshold\n")); | 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, |
@@ -384,8 +379,7 @@ static int acpi_thermal_get_trip_points(struct acpi_thermal *tz) | |||
384 | tz->trips.passive.flags.valid = 0; | 379 | tz->trips.passive.flags.valid = 0; |
385 | 380 | ||
386 | if (!tz->trips.passive.flags.valid) | 381 | if (!tz->trips.passive.flags.valid) |
387 | ACPI_DEBUG_PRINT((ACPI_DB_WARN, | 382 | printk(KERN_WARNING PREFIX "Invalid passive threshold\n"); |
388 | "Invalid passive threshold\n")); | ||
389 | else | 383 | else |
390 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 384 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
391 | "Found passive threshold [%lu]\n", | 385 | "Found passive threshold [%lu]\n", |
@@ -414,29 +408,27 @@ static int acpi_thermal_get_trip_points(struct acpi_thermal *tz) | |||
414 | "Found active threshold [%d]:[%lu]\n", | 408 | "Found active threshold [%d]:[%lu]\n", |
415 | i, tz->trips.active[i].temperature)); | 409 | i, tz->trips.active[i].temperature)); |
416 | } else | 410 | } else |
417 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 411 | ACPI_EXCEPTION((AE_INFO, status, |
418 | "Invalid active threshold [%d]\n", | 412 | "Invalid active threshold [%d]", i)); |
419 | i)); | ||
420 | } | 413 | } |
421 | 414 | ||
422 | return_VALUE(0); | 415 | return 0; |
423 | } | 416 | } |
424 | 417 | ||
425 | static int acpi_thermal_get_devices(struct acpi_thermal *tz) | 418 | static int acpi_thermal_get_devices(struct acpi_thermal *tz) |
426 | { | 419 | { |
427 | acpi_status status = AE_OK; | 420 | acpi_status status = AE_OK; |
428 | 421 | ||
429 | ACPI_FUNCTION_TRACE("acpi_thermal_get_devices"); | ||
430 | 422 | ||
431 | if (!tz) | 423 | if (!tz) |
432 | return_VALUE(-EINVAL); | 424 | return -EINVAL; |
433 | 425 | ||
434 | status = | 426 | status = |
435 | acpi_evaluate_reference(tz->handle, "_TZD", NULL, &tz->devices); | 427 | acpi_evaluate_reference(tz->handle, "_TZD", NULL, &tz->devices); |
436 | if (ACPI_FAILURE(status)) | 428 | if (ACPI_FAILURE(status)) |
437 | return_VALUE(-ENODEV); | 429 | return -ENODEV; |
438 | 430 | ||
439 | return_VALUE(0); | 431 | return 0; |
440 | } | 432 | } |
441 | 433 | ||
442 | static int acpi_thermal_call_usermode(char *path) | 434 | static int acpi_thermal_call_usermode(char *path) |
@@ -444,10 +436,9 @@ static int acpi_thermal_call_usermode(char *path) | |||
444 | char *argv[2] = { NULL, NULL }; | 436 | char *argv[2] = { NULL, NULL }; |
445 | char *envp[3] = { NULL, NULL, NULL }; | 437 | char *envp[3] = { NULL, NULL, NULL }; |
446 | 438 | ||
447 | ACPI_FUNCTION_TRACE("acpi_thermal_call_usermode"); | ||
448 | 439 | ||
449 | if (!path) | 440 | if (!path) |
450 | return_VALUE(-EINVAL); | 441 | return -EINVAL; |
451 | 442 | ||
452 | argv[0] = path; | 443 | argv[0] = path; |
453 | 444 | ||
@@ -457,7 +448,7 @@ static int acpi_thermal_call_usermode(char *path) | |||
457 | 448 | ||
458 | call_usermodehelper(argv[0], argv, envp, 0); | 449 | call_usermodehelper(argv[0], argv, envp, 0); |
459 | 450 | ||
460 | return_VALUE(0); | 451 | return 0; |
461 | } | 452 | } |
462 | 453 | ||
463 | static int acpi_thermal_critical(struct acpi_thermal *tz) | 454 | static int acpi_thermal_critical(struct acpi_thermal *tz) |
@@ -465,20 +456,19 @@ static int acpi_thermal_critical(struct acpi_thermal *tz) | |||
465 | int result = 0; | 456 | int result = 0; |
466 | struct acpi_device *device = NULL; | 457 | struct acpi_device *device = NULL; |
467 | 458 | ||
468 | ACPI_FUNCTION_TRACE("acpi_thermal_critical"); | ||
469 | 459 | ||
470 | if (!tz || !tz->trips.critical.flags.valid) | 460 | if (!tz || !tz->trips.critical.flags.valid) |
471 | return_VALUE(-EINVAL); | 461 | return -EINVAL; |
472 | 462 | ||
473 | if (tz->temperature >= tz->trips.critical.temperature) { | 463 | if (tz->temperature >= tz->trips.critical.temperature) { |
474 | ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Critical trip point\n")); | 464 | printk(KERN_WARNING PREFIX "Critical trip point\n"); |
475 | tz->trips.critical.flags.enabled = 1; | 465 | tz->trips.critical.flags.enabled = 1; |
476 | } else if (tz->trips.critical.flags.enabled) | 466 | } else if (tz->trips.critical.flags.enabled) |
477 | tz->trips.critical.flags.enabled = 0; | 467 | tz->trips.critical.flags.enabled = 0; |
478 | 468 | ||
479 | result = acpi_bus_get_device(tz->handle, &device); | 469 | result = acpi_bus_get_device(tz->handle, &device); |
480 | if (result) | 470 | if (result) |
481 | return_VALUE(result); | 471 | return result; |
482 | 472 | ||
483 | printk(KERN_EMERG | 473 | printk(KERN_EMERG |
484 | "Critical temperature reached (%ld C), shutting down.\n", | 474 | "Critical temperature reached (%ld C), shutting down.\n", |
@@ -488,7 +478,7 @@ static int acpi_thermal_critical(struct acpi_thermal *tz) | |||
488 | 478 | ||
489 | acpi_thermal_call_usermode(ACPI_THERMAL_PATH_POWEROFF); | 479 | acpi_thermal_call_usermode(ACPI_THERMAL_PATH_POWEROFF); |
490 | 480 | ||
491 | return_VALUE(0); | 481 | return 0; |
492 | } | 482 | } |
493 | 483 | ||
494 | static int acpi_thermal_hot(struct acpi_thermal *tz) | 484 | static int acpi_thermal_hot(struct acpi_thermal *tz) |
@@ -496,27 +486,26 @@ static int acpi_thermal_hot(struct acpi_thermal *tz) | |||
496 | int result = 0; | 486 | int result = 0; |
497 | struct acpi_device *device = NULL; | 487 | struct acpi_device *device = NULL; |
498 | 488 | ||
499 | ACPI_FUNCTION_TRACE("acpi_thermal_hot"); | ||
500 | 489 | ||
501 | if (!tz || !tz->trips.hot.flags.valid) | 490 | if (!tz || !tz->trips.hot.flags.valid) |
502 | return_VALUE(-EINVAL); | 491 | return -EINVAL; |
503 | 492 | ||
504 | if (tz->temperature >= tz->trips.hot.temperature) { | 493 | if (tz->temperature >= tz->trips.hot.temperature) { |
505 | ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Hot trip point\n")); | 494 | printk(KERN_WARNING PREFIX "Hot trip point\n"); |
506 | tz->trips.hot.flags.enabled = 1; | 495 | tz->trips.hot.flags.enabled = 1; |
507 | } else if (tz->trips.hot.flags.enabled) | 496 | } else if (tz->trips.hot.flags.enabled) |
508 | tz->trips.hot.flags.enabled = 0; | 497 | tz->trips.hot.flags.enabled = 0; |
509 | 498 | ||
510 | result = acpi_bus_get_device(tz->handle, &device); | 499 | result = acpi_bus_get_device(tz->handle, &device); |
511 | if (result) | 500 | if (result) |
512 | return_VALUE(result); | 501 | return result; |
513 | 502 | ||
514 | acpi_bus_generate_event(device, ACPI_THERMAL_NOTIFY_HOT, | 503 | acpi_bus_generate_event(device, ACPI_THERMAL_NOTIFY_HOT, |
515 | tz->trips.hot.flags.enabled); | 504 | tz->trips.hot.flags.enabled); |
516 | 505 | ||
517 | /* TBD: Call user-mode "sleep(S4)" function */ | 506 | /* TBD: Call user-mode "sleep(S4)" function */ |
518 | 507 | ||
519 | return_VALUE(0); | 508 | return 0; |
520 | } | 509 | } |
521 | 510 | ||
522 | static void acpi_thermal_passive(struct acpi_thermal *tz) | 511 | static void acpi_thermal_passive(struct acpi_thermal *tz) |
@@ -526,7 +515,6 @@ static void acpi_thermal_passive(struct acpi_thermal *tz) | |||
526 | int trend = 0; | 515 | int trend = 0; |
527 | int i = 0; | 516 | int i = 0; |
528 | 517 | ||
529 | ACPI_FUNCTION_TRACE("acpi_thermal_passive"); | ||
530 | 518 | ||
531 | if (!tz || !tz->trips.passive.flags.valid) | 519 | if (!tz || !tz->trips.passive.flags.valid) |
532 | return; | 520 | return; |
@@ -615,7 +603,6 @@ static void acpi_thermal_active(struct acpi_thermal *tz) | |||
615 | int j = 0; | 603 | int j = 0; |
616 | unsigned long maxtemp = 0; | 604 | unsigned long maxtemp = 0; |
617 | 605 | ||
618 | ACPI_FUNCTION_TRACE("acpi_thermal_active"); | ||
619 | 606 | ||
620 | if (!tz) | 607 | if (!tz) |
621 | return; | 608 | return; |
@@ -642,10 +629,10 @@ static void acpi_thermal_active(struct acpi_thermal *tz) | |||
642 | handles[j], | 629 | handles[j], |
643 | ACPI_STATE_D0); | 630 | ACPI_STATE_D0); |
644 | if (result) { | 631 | if (result) { |
645 | ACPI_DEBUG_PRINT((ACPI_DB_WARN, | 632 | printk(KERN_WARNING PREFIX |
646 | "Unable to turn cooling device [%p] 'on'\n", | 633 | "Unable to turn cooling device [%p] 'on'\n", |
647 | active->devices. | 634 | active->devices. |
648 | handles[j])); | 635 | handles[j]); |
649 | continue; | 636 | continue; |
650 | } | 637 | } |
651 | active->flags.enabled = 1; | 638 | active->flags.enabled = 1; |
@@ -667,9 +654,9 @@ static void acpi_thermal_active(struct acpi_thermal *tz) | |||
667 | result = acpi_bus_set_power(active->devices.handles[j], | 654 | result = acpi_bus_set_power(active->devices.handles[j], |
668 | ACPI_STATE_D3); | 655 | ACPI_STATE_D3); |
669 | if (result) { | 656 | if (result) { |
670 | ACPI_DEBUG_PRINT((ACPI_DB_WARN, | 657 | printk(KERN_WARNING PREFIX |
671 | "Unable to turn cooling device [%p] 'off'\n", | 658 | "Unable to turn cooling device [%p] 'off'\n", |
672 | active->devices.handles[j])); | 659 | active->devices.handles[j]); |
673 | continue; | 660 | continue; |
674 | } | 661 | } |
675 | active->flags.enabled = 0; | 662 | active->flags.enabled = 0; |
@@ -697,18 +684,17 @@ static void acpi_thermal_check(void *data) | |||
697 | int i = 0; | 684 | int i = 0; |
698 | struct acpi_thermal_state state; | 685 | struct acpi_thermal_state state; |
699 | 686 | ||
700 | ACPI_FUNCTION_TRACE("acpi_thermal_check"); | ||
701 | 687 | ||
702 | if (!tz) { | 688 | if (!tz) { |
703 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid (NULL) context.\n")); | 689 | printk(KERN_ERR PREFIX "Invalid (NULL) context\n"); |
704 | return_VOID; | 690 | return; |
705 | } | 691 | } |
706 | 692 | ||
707 | state = tz->state; | 693 | state = tz->state; |
708 | 694 | ||
709 | result = acpi_thermal_get_temperature(tz); | 695 | result = acpi_thermal_get_temperature(tz); |
710 | if (result) | 696 | if (result) |
711 | return_VOID; | 697 | return; |
712 | 698 | ||
713 | memset(&tz->state, 0, sizeof(tz->state)); | 699 | memset(&tz->state, 0, sizeof(tz->state)); |
714 | 700 | ||
@@ -797,7 +783,7 @@ static void acpi_thermal_check(void *data) | |||
797 | } | 783 | } |
798 | } | 784 | } |
799 | 785 | ||
800 | return_VOID; | 786 | return; |
801 | } | 787 | } |
802 | 788 | ||
803 | /* -------------------------------------------------------------------------- | 789 | /* -------------------------------------------------------------------------- |
@@ -810,7 +796,6 @@ static int acpi_thermal_state_seq_show(struct seq_file *seq, void *offset) | |||
810 | { | 796 | { |
811 | struct acpi_thermal *tz = (struct acpi_thermal *)seq->private; | 797 | struct acpi_thermal *tz = (struct acpi_thermal *)seq->private; |
812 | 798 | ||
813 | ACPI_FUNCTION_TRACE("acpi_thermal_state_seq_show"); | ||
814 | 799 | ||
815 | if (!tz) | 800 | if (!tz) |
816 | goto end; | 801 | goto end; |
@@ -833,7 +818,7 @@ static int acpi_thermal_state_seq_show(struct seq_file *seq, void *offset) | |||
833 | } | 818 | } |
834 | 819 | ||
835 | end: | 820 | end: |
836 | return_VALUE(0); | 821 | return 0; |
837 | } | 822 | } |
838 | 823 | ||
839 | 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) |
@@ -846,7 +831,6 @@ static int acpi_thermal_temp_seq_show(struct seq_file *seq, void *offset) | |||
846 | int result = 0; | 831 | int result = 0; |
847 | struct acpi_thermal *tz = (struct acpi_thermal *)seq->private; | 832 | struct acpi_thermal *tz = (struct acpi_thermal *)seq->private; |
848 | 833 | ||
849 | ACPI_FUNCTION_TRACE("acpi_thermal_temp_seq_show"); | ||
850 | 834 | ||
851 | if (!tz) | 835 | if (!tz) |
852 | goto end; | 836 | goto end; |
@@ -859,7 +843,7 @@ static int acpi_thermal_temp_seq_show(struct seq_file *seq, void *offset) | |||
859 | KELVIN_TO_CELSIUS(tz->temperature)); | 843 | KELVIN_TO_CELSIUS(tz->temperature)); |
860 | 844 | ||
861 | end: | 845 | end: |
862 | return_VALUE(0); | 846 | return 0; |
863 | } | 847 | } |
864 | 848 | ||
865 | 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) |
@@ -873,7 +857,6 @@ static int acpi_thermal_trip_seq_show(struct seq_file *seq, void *offset) | |||
873 | int i = 0; | 857 | int i = 0; |
874 | int j = 0; | 858 | int j = 0; |
875 | 859 | ||
876 | ACPI_FUNCTION_TRACE("acpi_thermal_trip_seq_show"); | ||
877 | 860 | ||
878 | if (!tz) | 861 | if (!tz) |
879 | goto end; | 862 | goto end; |
@@ -913,7 +896,7 @@ static int acpi_thermal_trip_seq_show(struct seq_file *seq, void *offset) | |||
913 | } | 896 | } |
914 | 897 | ||
915 | end: | 898 | end: |
916 | return_VALUE(0); | 899 | return 0; |
917 | } | 900 | } |
918 | 901 | ||
919 | 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) |
@@ -934,28 +917,25 @@ acpi_thermal_write_trip_points(struct file *file, | |||
934 | int *active; | 917 | int *active; |
935 | int i = 0; | 918 | int i = 0; |
936 | 919 | ||
937 | ACPI_FUNCTION_TRACE("acpi_thermal_write_trip_points"); | ||
938 | 920 | ||
939 | limit_string = kmalloc(ACPI_THERMAL_MAX_LIMIT_STR_LEN, GFP_KERNEL); | 921 | limit_string = kmalloc(ACPI_THERMAL_MAX_LIMIT_STR_LEN, GFP_KERNEL); |
940 | if (!limit_string) | 922 | if (!limit_string) |
941 | return_VALUE(-ENOMEM); | 923 | return -ENOMEM; |
942 | 924 | ||
943 | memset(limit_string, 0, ACPI_THERMAL_MAX_LIMIT_STR_LEN); | 925 | memset(limit_string, 0, ACPI_THERMAL_MAX_LIMIT_STR_LEN); |
944 | 926 | ||
945 | active = kmalloc(ACPI_THERMAL_MAX_ACTIVE * sizeof(int), GFP_KERNEL); | 927 | active = kmalloc(ACPI_THERMAL_MAX_ACTIVE * sizeof(int), GFP_KERNEL); |
946 | if (!active) { | 928 | if (!active) { |
947 | kfree(limit_string); | 929 | kfree(limit_string); |
948 | return_VALUE(-ENOMEM); | 930 | return -ENOMEM; |
949 | } | 931 | } |
950 | 932 | ||
951 | if (!tz || (count > ACPI_THERMAL_MAX_LIMIT_STR_LEN - 1)) { | 933 | if (!tz || (count > ACPI_THERMAL_MAX_LIMIT_STR_LEN - 1)) { |
952 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid argument\n")); | ||
953 | count = -EINVAL; | 934 | count = -EINVAL; |
954 | goto end; | 935 | goto end; |
955 | } | 936 | } |
956 | 937 | ||
957 | if (copy_from_user(limit_string, buffer, count)) { | 938 | if (copy_from_user(limit_string, buffer, count)) { |
958 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid data\n")); | ||
959 | count = -EFAULT; | 939 | count = -EFAULT; |
960 | goto end; | 940 | goto end; |
961 | } | 941 | } |
@@ -968,7 +948,6 @@ acpi_thermal_write_trip_points(struct file *file, | |||
968 | &active[5], &active[6], &active[7], &active[8], | 948 | &active[5], &active[6], &active[7], &active[8], |
969 | &active[9]); | 949 | &active[9]); |
970 | if (!(num >= 5 && num < (ACPI_THERMAL_MAX_ACTIVE + 3))) { | 950 | if (!(num >= 5 && num < (ACPI_THERMAL_MAX_ACTIVE + 3))) { |
971 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid data format\n")); | ||
972 | count = -EINVAL; | 951 | count = -EINVAL; |
973 | goto end; | 952 | goto end; |
974 | } | 953 | } |
@@ -985,14 +964,13 @@ acpi_thermal_write_trip_points(struct file *file, | |||
985 | end: | 964 | end: |
986 | kfree(active); | 965 | kfree(active); |
987 | kfree(limit_string); | 966 | kfree(limit_string); |
988 | return_VALUE(count); | 967 | return count; |
989 | } | 968 | } |
990 | 969 | ||
991 | 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) |
992 | { | 971 | { |
993 | struct acpi_thermal *tz = (struct acpi_thermal *)seq->private; | 972 | struct acpi_thermal *tz = (struct acpi_thermal *)seq->private; |
994 | 973 | ||
995 | ACPI_FUNCTION_TRACE("acpi_thermal_cooling_seq_show"); | ||
996 | 974 | ||
997 | if (!tz) | 975 | if (!tz) |
998 | goto end; | 976 | goto end; |
@@ -1008,7 +986,7 @@ static int acpi_thermal_cooling_seq_show(struct seq_file *seq, void *offset) | |||
1008 | tz->cooling_mode ? "passive" : "active"); | 986 | tz->cooling_mode ? "passive" : "active"); |
1009 | 987 | ||
1010 | end: | 988 | end: |
1011 | return_VALUE(0); | 989 | return 0; |
1012 | } | 990 | } |
1013 | 991 | ||
1014 | 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) |
@@ -1027,16 +1005,15 @@ acpi_thermal_write_cooling_mode(struct file *file, | |||
1027 | int result = 0; | 1005 | int result = 0; |
1028 | char mode_string[12] = { '\0' }; | 1006 | char mode_string[12] = { '\0' }; |
1029 | 1007 | ||
1030 | ACPI_FUNCTION_TRACE("acpi_thermal_write_cooling_mode"); | ||
1031 | 1008 | ||
1032 | if (!tz || (count > sizeof(mode_string) - 1)) | 1009 | if (!tz || (count > sizeof(mode_string) - 1)) |
1033 | return_VALUE(-EINVAL); | 1010 | return -EINVAL; |
1034 | 1011 | ||
1035 | if (!tz->flags.cooling_mode) | 1012 | if (!tz->flags.cooling_mode) |
1036 | return_VALUE(-ENODEV); | 1013 | return -ENODEV; |
1037 | 1014 | ||
1038 | if (copy_from_user(mode_string, buffer, count)) | 1015 | if (copy_from_user(mode_string, buffer, count)) |
1039 | return_VALUE(-EFAULT); | 1016 | return -EFAULT; |
1040 | 1017 | ||
1041 | mode_string[count] = '\0'; | 1018 | mode_string[count] = '\0'; |
1042 | 1019 | ||
@@ -1044,18 +1021,17 @@ acpi_thermal_write_cooling_mode(struct file *file, | |||
1044 | simple_strtoul(mode_string, NULL, | 1021 | simple_strtoul(mode_string, NULL, |
1045 | 0)); | 1022 | 0)); |
1046 | if (result) | 1023 | if (result) |
1047 | return_VALUE(result); | 1024 | return result; |
1048 | 1025 | ||
1049 | acpi_thermal_check(tz); | 1026 | acpi_thermal_check(tz); |
1050 | 1027 | ||
1051 | return_VALUE(count); | 1028 | return count; |
1052 | } | 1029 | } |
1053 | 1030 | ||
1054 | 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) |
1055 | { | 1032 | { |
1056 | struct acpi_thermal *tz = (struct acpi_thermal *)seq->private; | 1033 | struct acpi_thermal *tz = (struct acpi_thermal *)seq->private; |
1057 | 1034 | ||
1058 | ACPI_FUNCTION_TRACE("acpi_thermal_polling_seq_show"); | ||
1059 | 1035 | ||
1060 | if (!tz) | 1036 | if (!tz) |
1061 | goto end; | 1037 | goto end; |
@@ -1069,7 +1045,7 @@ static int acpi_thermal_polling_seq_show(struct seq_file *seq, void *offset) | |||
1069 | (tz->polling_frequency / 10)); | 1045 | (tz->polling_frequency / 10)); |
1070 | 1046 | ||
1071 | end: | 1047 | end: |
1072 | return_VALUE(0); | 1048 | return 0; |
1073 | } | 1049 | } |
1074 | 1050 | ||
1075 | 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) |
@@ -1089,13 +1065,12 @@ acpi_thermal_write_polling(struct file *file, | |||
1089 | char polling_string[12] = { '\0' }; | 1065 | char polling_string[12] = { '\0' }; |
1090 | int seconds = 0; | 1066 | int seconds = 0; |
1091 | 1067 | ||
1092 | ACPI_FUNCTION_TRACE("acpi_thermal_write_polling"); | ||
1093 | 1068 | ||
1094 | if (!tz || (count > sizeof(polling_string) - 1)) | 1069 | if (!tz || (count > sizeof(polling_string) - 1)) |
1095 | return_VALUE(-EINVAL); | 1070 | return -EINVAL; |
1096 | 1071 | ||
1097 | if (copy_from_user(polling_string, buffer, count)) | 1072 | if (copy_from_user(polling_string, buffer, count)) |
1098 | return_VALUE(-EFAULT); | 1073 | return -EFAULT; |
1099 | 1074 | ||
1100 | polling_string[count] = '\0'; | 1075 | polling_string[count] = '\0'; |
1101 | 1076 | ||
@@ -1103,24 +1078,23 @@ acpi_thermal_write_polling(struct file *file, | |||
1103 | 1078 | ||
1104 | result = acpi_thermal_set_polling(tz, seconds); | 1079 | result = acpi_thermal_set_polling(tz, seconds); |
1105 | if (result) | 1080 | if (result) |
1106 | return_VALUE(result); | 1081 | return result; |
1107 | 1082 | ||
1108 | acpi_thermal_check(tz); | 1083 | acpi_thermal_check(tz); |
1109 | 1084 | ||
1110 | return_VALUE(count); | 1085 | return count; |
1111 | } | 1086 | } |
1112 | 1087 | ||
1113 | static int acpi_thermal_add_fs(struct acpi_device *device) | 1088 | static int acpi_thermal_add_fs(struct acpi_device *device) |
1114 | { | 1089 | { |
1115 | struct proc_dir_entry *entry = NULL; | 1090 | struct proc_dir_entry *entry = NULL; |
1116 | 1091 | ||
1117 | ACPI_FUNCTION_TRACE("acpi_thermal_add_fs"); | ||
1118 | 1092 | ||
1119 | if (!acpi_device_dir(device)) { | 1093 | if (!acpi_device_dir(device)) { |
1120 | acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), | 1094 | acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), |
1121 | acpi_thermal_dir); | 1095 | acpi_thermal_dir); |
1122 | if (!acpi_device_dir(device)) | 1096 | if (!acpi_device_dir(device)) |
1123 | return_VALUE(-ENODEV); | 1097 | return -ENODEV; |
1124 | acpi_device_dir(device)->owner = THIS_MODULE; | 1098 | acpi_device_dir(device)->owner = THIS_MODULE; |
1125 | } | 1099 | } |
1126 | 1100 | ||
@@ -1128,9 +1102,7 @@ static int acpi_thermal_add_fs(struct acpi_device *device) | |||
1128 | entry = create_proc_entry(ACPI_THERMAL_FILE_STATE, | 1102 | entry = create_proc_entry(ACPI_THERMAL_FILE_STATE, |
1129 | S_IRUGO, acpi_device_dir(device)); | 1103 | S_IRUGO, acpi_device_dir(device)); |
1130 | if (!entry) | 1104 | if (!entry) |
1131 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 1105 | return -ENODEV; |
1132 | "Unable to create '%s' fs entry\n", | ||
1133 | ACPI_THERMAL_FILE_STATE)); | ||
1134 | else { | 1106 | else { |
1135 | entry->proc_fops = &acpi_thermal_state_fops; | 1107 | entry->proc_fops = &acpi_thermal_state_fops; |
1136 | entry->data = acpi_driver_data(device); | 1108 | entry->data = acpi_driver_data(device); |
@@ -1141,9 +1113,7 @@ static int acpi_thermal_add_fs(struct acpi_device *device) | |||
1141 | entry = create_proc_entry(ACPI_THERMAL_FILE_TEMPERATURE, | 1113 | entry = create_proc_entry(ACPI_THERMAL_FILE_TEMPERATURE, |
1142 | S_IRUGO, acpi_device_dir(device)); | 1114 | S_IRUGO, acpi_device_dir(device)); |
1143 | if (!entry) | 1115 | if (!entry) |
1144 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 1116 | return -ENODEV; |
1145 | "Unable to create '%s' fs entry\n", | ||
1146 | ACPI_THERMAL_FILE_TEMPERATURE)); | ||
1147 | else { | 1117 | else { |
1148 | entry->proc_fops = &acpi_thermal_temp_fops; | 1118 | entry->proc_fops = &acpi_thermal_temp_fops; |
1149 | entry->data = acpi_driver_data(device); | 1119 | entry->data = acpi_driver_data(device); |
@@ -1155,9 +1125,7 @@ static int acpi_thermal_add_fs(struct acpi_device *device) | |||
1155 | S_IFREG | S_IRUGO | S_IWUSR, | 1125 | S_IFREG | S_IRUGO | S_IWUSR, |
1156 | acpi_device_dir(device)); | 1126 | acpi_device_dir(device)); |
1157 | if (!entry) | 1127 | if (!entry) |
1158 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 1128 | return -ENODEV; |
1159 | "Unable to create '%s' fs entry\n", | ||
1160 | ACPI_THERMAL_FILE_TRIP_POINTS)); | ||
1161 | else { | 1129 | else { |
1162 | entry->proc_fops = &acpi_thermal_trip_fops; | 1130 | entry->proc_fops = &acpi_thermal_trip_fops; |
1163 | entry->data = acpi_driver_data(device); | 1131 | entry->data = acpi_driver_data(device); |
@@ -1169,9 +1137,7 @@ static int acpi_thermal_add_fs(struct acpi_device *device) | |||
1169 | S_IFREG | S_IRUGO | S_IWUSR, | 1137 | S_IFREG | S_IRUGO | S_IWUSR, |
1170 | acpi_device_dir(device)); | 1138 | acpi_device_dir(device)); |
1171 | if (!entry) | 1139 | if (!entry) |
1172 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 1140 | return -ENODEV; |
1173 | "Unable to create '%s' fs entry\n", | ||
1174 | ACPI_THERMAL_FILE_COOLING_MODE)); | ||
1175 | else { | 1141 | else { |
1176 | entry->proc_fops = &acpi_thermal_cooling_fops; | 1142 | entry->proc_fops = &acpi_thermal_cooling_fops; |
1177 | entry->data = acpi_driver_data(device); | 1143 | entry->data = acpi_driver_data(device); |
@@ -1183,21 +1149,18 @@ static int acpi_thermal_add_fs(struct acpi_device *device) | |||
1183 | S_IFREG | S_IRUGO | S_IWUSR, | 1149 | S_IFREG | S_IRUGO | S_IWUSR, |
1184 | acpi_device_dir(device)); | 1150 | acpi_device_dir(device)); |
1185 | if (!entry) | 1151 | if (!entry) |
1186 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 1152 | return -ENODEV; |
1187 | "Unable to create '%s' fs entry\n", | ||
1188 | ACPI_THERMAL_FILE_POLLING_FREQ)); | ||
1189 | else { | 1153 | else { |
1190 | entry->proc_fops = &acpi_thermal_polling_fops; | 1154 | entry->proc_fops = &acpi_thermal_polling_fops; |
1191 | entry->data = acpi_driver_data(device); | 1155 | entry->data = acpi_driver_data(device); |
1192 | entry->owner = THIS_MODULE; | 1156 | entry->owner = THIS_MODULE; |
1193 | } | 1157 | } |
1194 | 1158 | ||
1195 | return_VALUE(0); | 1159 | return 0; |
1196 | } | 1160 | } |
1197 | 1161 | ||
1198 | static int acpi_thermal_remove_fs(struct acpi_device *device) | 1162 | static int acpi_thermal_remove_fs(struct acpi_device *device) |
1199 | { | 1163 | { |
1200 | ACPI_FUNCTION_TRACE("acpi_thermal_remove_fs"); | ||
1201 | 1164 | ||
1202 | if (acpi_device_dir(device)) { | 1165 | if (acpi_device_dir(device)) { |
1203 | remove_proc_entry(ACPI_THERMAL_FILE_POLLING_FREQ, | 1166 | remove_proc_entry(ACPI_THERMAL_FILE_POLLING_FREQ, |
@@ -1214,7 +1177,7 @@ static int acpi_thermal_remove_fs(struct acpi_device *device) | |||
1214 | acpi_device_dir(device) = NULL; | 1177 | acpi_device_dir(device) = NULL; |
1215 | } | 1178 | } |
1216 | 1179 | ||
1217 | return_VALUE(0); | 1180 | return 0; |
1218 | } | 1181 | } |
1219 | 1182 | ||
1220 | /* -------------------------------------------------------------------------- | 1183 | /* -------------------------------------------------------------------------- |
@@ -1226,13 +1189,12 @@ static void acpi_thermal_notify(acpi_handle handle, u32 event, void *data) | |||
1226 | struct acpi_thermal *tz = (struct acpi_thermal *)data; | 1189 | struct acpi_thermal *tz = (struct acpi_thermal *)data; |
1227 | struct acpi_device *device = NULL; | 1190 | struct acpi_device *device = NULL; |
1228 | 1191 | ||
1229 | ACPI_FUNCTION_TRACE("acpi_thermal_notify"); | ||
1230 | 1192 | ||
1231 | if (!tz) | 1193 | if (!tz) |
1232 | return_VOID; | 1194 | return; |
1233 | 1195 | ||
1234 | if (acpi_bus_get_device(tz->handle, &device)) | 1196 | if (acpi_bus_get_device(tz->handle, &device)) |
1235 | return_VOID; | 1197 | return; |
1236 | 1198 | ||
1237 | switch (event) { | 1199 | switch (event) { |
1238 | case ACPI_THERMAL_NOTIFY_TEMPERATURE: | 1200 | case ACPI_THERMAL_NOTIFY_TEMPERATURE: |
@@ -1254,27 +1216,26 @@ static void acpi_thermal_notify(acpi_handle handle, u32 event, void *data) | |||
1254 | break; | 1216 | break; |
1255 | } | 1217 | } |
1256 | 1218 | ||
1257 | return_VOID; | 1219 | return; |
1258 | } | 1220 | } |
1259 | 1221 | ||
1260 | static int acpi_thermal_get_info(struct acpi_thermal *tz) | 1222 | static int acpi_thermal_get_info(struct acpi_thermal *tz) |
1261 | { | 1223 | { |
1262 | int result = 0; | 1224 | int result = 0; |
1263 | 1225 | ||
1264 | ACPI_FUNCTION_TRACE("acpi_thermal_get_info"); | ||
1265 | 1226 | ||
1266 | if (!tz) | 1227 | if (!tz) |
1267 | return_VALUE(-EINVAL); | 1228 | return -EINVAL; |
1268 | 1229 | ||
1269 | /* Get temperature [_TMP] (required) */ | 1230 | /* Get temperature [_TMP] (required) */ |
1270 | result = acpi_thermal_get_temperature(tz); | 1231 | result = acpi_thermal_get_temperature(tz); |
1271 | if (result) | 1232 | if (result) |
1272 | return_VALUE(result); | 1233 | return result; |
1273 | 1234 | ||
1274 | /* Get trip points [_CRT, _PSV, etc.] (required) */ | 1235 | /* Get trip points [_CRT, _PSV, etc.] (required) */ |
1275 | result = acpi_thermal_get_trip_points(tz); | 1236 | result = acpi_thermal_get_trip_points(tz); |
1276 | if (result) | 1237 | if (result) |
1277 | return_VALUE(result); | 1238 | return result; |
1278 | 1239 | ||
1279 | /* Set the cooling mode [_SCP] to active cooling (default) */ | 1240 | /* Set the cooling mode [_SCP] to active cooling (default) */ |
1280 | result = acpi_thermal_set_cooling_mode(tz, ACPI_THERMAL_MODE_ACTIVE); | 1241 | result = acpi_thermal_set_cooling_mode(tz, ACPI_THERMAL_MODE_ACTIVE); |
@@ -1314,7 +1275,7 @@ static int acpi_thermal_get_info(struct acpi_thermal *tz) | |||
1314 | if (!result) | 1275 | if (!result) |
1315 | tz->flags.devices = 1; | 1276 | tz->flags.devices = 1; |
1316 | 1277 | ||
1317 | return_VALUE(0); | 1278 | return 0; |
1318 | } | 1279 | } |
1319 | 1280 | ||
1320 | static int acpi_thermal_add(struct acpi_device *device) | 1281 | static int acpi_thermal_add(struct acpi_device *device) |
@@ -1323,14 +1284,13 @@ static int acpi_thermal_add(struct acpi_device *device) | |||
1323 | acpi_status status = AE_OK; | 1284 | acpi_status status = AE_OK; |
1324 | struct acpi_thermal *tz = NULL; | 1285 | struct acpi_thermal *tz = NULL; |
1325 | 1286 | ||
1326 | ACPI_FUNCTION_TRACE("acpi_thermal_add"); | ||
1327 | 1287 | ||
1328 | if (!device) | 1288 | if (!device) |
1329 | return_VALUE(-EINVAL); | 1289 | return -EINVAL; |
1330 | 1290 | ||
1331 | tz = kmalloc(sizeof(struct acpi_thermal), GFP_KERNEL); | 1291 | tz = kmalloc(sizeof(struct acpi_thermal), GFP_KERNEL); |
1332 | if (!tz) | 1292 | if (!tz) |
1333 | return_VALUE(-ENOMEM); | 1293 | return -ENOMEM; |
1334 | memset(tz, 0, sizeof(struct acpi_thermal)); | 1294 | memset(tz, 0, sizeof(struct acpi_thermal)); |
1335 | 1295 | ||
1336 | tz->handle = device->handle; | 1296 | tz->handle = device->handle; |
@@ -1355,8 +1315,6 @@ static int acpi_thermal_add(struct acpi_device *device) | |||
1355 | ACPI_DEVICE_NOTIFY, | 1315 | ACPI_DEVICE_NOTIFY, |
1356 | acpi_thermal_notify, tz); | 1316 | acpi_thermal_notify, tz); |
1357 | if (ACPI_FAILURE(status)) { | 1317 | if (ACPI_FAILURE(status)) { |
1358 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | ||
1359 | "Error installing notify handler\n")); | ||
1360 | result = -ENODEV; | 1318 | result = -ENODEV; |
1361 | goto end; | 1319 | goto end; |
1362 | } | 1320 | } |
@@ -1371,7 +1329,7 @@ static int acpi_thermal_add(struct acpi_device *device) | |||
1371 | kfree(tz); | 1329 | kfree(tz); |
1372 | } | 1330 | } |
1373 | 1331 | ||
1374 | return_VALUE(result); | 1332 | return result; |
1375 | } | 1333 | } |
1376 | 1334 | ||
1377 | static int acpi_thermal_remove(struct acpi_device *device, int type) | 1335 | static int acpi_thermal_remove(struct acpi_device *device, int type) |
@@ -1379,10 +1337,9 @@ static int acpi_thermal_remove(struct acpi_device *device, int type) | |||
1379 | acpi_status status = AE_OK; | 1337 | acpi_status status = AE_OK; |
1380 | struct acpi_thermal *tz = NULL; | 1338 | struct acpi_thermal *tz = NULL; |
1381 | 1339 | ||
1382 | ACPI_FUNCTION_TRACE("acpi_thermal_remove"); | ||
1383 | 1340 | ||
1384 | if (!device || !acpi_driver_data(device)) | 1341 | if (!device || !acpi_driver_data(device)) |
1385 | return_VALUE(-EINVAL); | 1342 | return -EINVAL; |
1386 | 1343 | ||
1387 | tz = (struct acpi_thermal *)acpi_driver_data(device); | 1344 | tz = (struct acpi_thermal *)acpi_driver_data(device); |
1388 | 1345 | ||
@@ -1398,9 +1355,6 @@ static int acpi_thermal_remove(struct acpi_device *device, int type) | |||
1398 | status = acpi_remove_notify_handler(tz->handle, | 1355 | status = acpi_remove_notify_handler(tz->handle, |
1399 | ACPI_DEVICE_NOTIFY, | 1356 | ACPI_DEVICE_NOTIFY, |
1400 | acpi_thermal_notify); | 1357 | acpi_thermal_notify); |
1401 | if (ACPI_FAILURE(status)) | ||
1402 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | ||
1403 | "Error removing notify handler\n")); | ||
1404 | 1358 | ||
1405 | /* Terminate policy */ | 1359 | /* Terminate policy */ |
1406 | if (tz->trips.passive.flags.valid && tz->trips.passive.flags.enabled) { | 1360 | if (tz->trips.passive.flags.valid && tz->trips.passive.flags.enabled) { |
@@ -1416,7 +1370,7 @@ static int acpi_thermal_remove(struct acpi_device *device, int type) | |||
1416 | acpi_thermal_remove_fs(device); | 1370 | acpi_thermal_remove_fs(device); |
1417 | 1371 | ||
1418 | kfree(tz); | 1372 | kfree(tz); |
1419 | return_VALUE(0); | 1373 | return 0; |
1420 | } | 1374 | } |
1421 | 1375 | ||
1422 | static int acpi_thermal_resume(struct acpi_device *device, int state) | 1376 | static int acpi_thermal_resume(struct acpi_device *device, int state) |
@@ -1424,7 +1378,7 @@ static int acpi_thermal_resume(struct acpi_device *device, int state) | |||
1424 | struct acpi_thermal *tz = NULL; | 1378 | struct acpi_thermal *tz = NULL; |
1425 | 1379 | ||
1426 | if (!device || !acpi_driver_data(device)) | 1380 | if (!device || !acpi_driver_data(device)) |
1427 | return_VALUE(-EINVAL); | 1381 | return -EINVAL; |
1428 | 1382 | ||
1429 | tz = (struct acpi_thermal *)acpi_driver_data(device); | 1383 | tz = (struct acpi_thermal *)acpi_driver_data(device); |
1430 | 1384 | ||
@@ -1437,31 +1391,29 @@ static int __init acpi_thermal_init(void) | |||
1437 | { | 1391 | { |
1438 | int result = 0; | 1392 | int result = 0; |
1439 | 1393 | ||
1440 | ACPI_FUNCTION_TRACE("acpi_thermal_init"); | ||
1441 | 1394 | ||
1442 | acpi_thermal_dir = proc_mkdir(ACPI_THERMAL_CLASS, acpi_root_dir); | 1395 | acpi_thermal_dir = proc_mkdir(ACPI_THERMAL_CLASS, acpi_root_dir); |
1443 | if (!acpi_thermal_dir) | 1396 | if (!acpi_thermal_dir) |
1444 | return_VALUE(-ENODEV); | 1397 | return -ENODEV; |
1445 | acpi_thermal_dir->owner = THIS_MODULE; | 1398 | acpi_thermal_dir->owner = THIS_MODULE; |
1446 | 1399 | ||
1447 | result = acpi_bus_register_driver(&acpi_thermal_driver); | 1400 | result = acpi_bus_register_driver(&acpi_thermal_driver); |
1448 | if (result < 0) { | 1401 | if (result < 0) { |
1449 | remove_proc_entry(ACPI_THERMAL_CLASS, acpi_root_dir); | 1402 | remove_proc_entry(ACPI_THERMAL_CLASS, acpi_root_dir); |
1450 | return_VALUE(-ENODEV); | 1403 | return -ENODEV; |
1451 | } | 1404 | } |
1452 | 1405 | ||
1453 | return_VALUE(0); | 1406 | return 0; |
1454 | } | 1407 | } |
1455 | 1408 | ||
1456 | static void __exit acpi_thermal_exit(void) | 1409 | static void __exit acpi_thermal_exit(void) |
1457 | { | 1410 | { |
1458 | ACPI_FUNCTION_TRACE("acpi_thermal_exit"); | ||
1459 | 1411 | ||
1460 | acpi_bus_unregister_driver(&acpi_thermal_driver); | 1412 | acpi_bus_unregister_driver(&acpi_thermal_driver); |
1461 | 1413 | ||
1462 | remove_proc_entry(ACPI_THERMAL_CLASS, acpi_root_dir); | 1414 | remove_proc_entry(ACPI_THERMAL_CLASS, acpi_root_dir); |
1463 | 1415 | ||
1464 | return_VOID; | 1416 | return; |
1465 | } | 1417 | } |
1466 | 1418 | ||
1467 | module_init(acpi_thermal_init); | 1419 | module_init(acpi_thermal_init); |