diff options
Diffstat (limited to 'drivers/acpi/sbs.c')
-rw-r--r-- | drivers/acpi/sbs.c | 142 |
1 files changed, 40 insertions, 102 deletions
diff --git a/drivers/acpi/sbs.c b/drivers/acpi/sbs.c index 8bebcebff5f0..db7b350a5035 100644 --- a/drivers/acpi/sbs.c +++ b/drivers/acpi/sbs.c | |||
@@ -187,8 +187,6 @@ static void acpi_battery_smbus_err_handler(struct acpi_ec_smbus *smbus) | |||
187 | char *err_str; | 187 | char *err_str; |
188 | int err_number; | 188 | int err_number; |
189 | 189 | ||
190 | ACPI_FUNCTION_TRACE("acpi_battery_smbus_err_handler"); | ||
191 | |||
192 | data.word = 0; | 190 | data.word = 0; |
193 | 191 | ||
194 | result = smbus->adapter.algo-> | 192 | result = smbus->adapter.algo-> |
@@ -239,8 +237,6 @@ acpi_sbs_smbus_read_word(struct acpi_ec_smbus *smbus, int addr, int func, | |||
239 | int result = 0; | 237 | int result = 0; |
240 | int i; | 238 | int i; |
241 | 239 | ||
242 | ACPI_FUNCTION_TRACE("acpi_sbs_smbus_read_word"); | ||
243 | |||
244 | if (err_handler == NULL) { | 240 | if (err_handler == NULL) { |
245 | err_handler = acpi_battery_smbus_err_handler; | 241 | err_handler = acpi_battery_smbus_err_handler; |
246 | } | 242 | } |
@@ -263,7 +259,7 @@ acpi_sbs_smbus_read_word(struct acpi_ec_smbus *smbus, int addr, int func, | |||
263 | } | 259 | } |
264 | } | 260 | } |
265 | 261 | ||
266 | return_VALUE(result); | 262 | return result; |
267 | } | 263 | } |
268 | 264 | ||
269 | static int | 265 | static int |
@@ -275,8 +271,6 @@ acpi_sbs_smbus_read_str(struct acpi_ec_smbus *smbus, int addr, int func, | |||
275 | int result = 0; | 271 | int result = 0; |
276 | int i; | 272 | int i; |
277 | 273 | ||
278 | ACPI_FUNCTION_TRACE("acpi_sbs_smbus_read_str"); | ||
279 | |||
280 | if (err_handler == NULL) { | 274 | if (err_handler == NULL) { |
281 | err_handler = acpi_battery_smbus_err_handler; | 275 | err_handler = acpi_battery_smbus_err_handler; |
282 | } | 276 | } |
@@ -302,7 +296,7 @@ acpi_sbs_smbus_read_str(struct acpi_ec_smbus *smbus, int addr, int func, | |||
302 | } | 296 | } |
303 | } | 297 | } |
304 | 298 | ||
305 | return_VALUE(result); | 299 | return result; |
306 | } | 300 | } |
307 | 301 | ||
308 | static int | 302 | static int |
@@ -314,8 +308,6 @@ acpi_sbs_smbus_write_word(struct acpi_ec_smbus *smbus, int addr, int func, | |||
314 | int result = 0; | 308 | int result = 0; |
315 | int i; | 309 | int i; |
316 | 310 | ||
317 | ACPI_FUNCTION_TRACE("acpi_sbs_smbus_write_word"); | ||
318 | |||
319 | if (err_handler == NULL) { | 311 | if (err_handler == NULL) { |
320 | err_handler = acpi_battery_smbus_err_handler; | 312 | err_handler = acpi_battery_smbus_err_handler; |
321 | } | 313 | } |
@@ -339,7 +331,7 @@ acpi_sbs_smbus_write_word(struct acpi_ec_smbus *smbus, int addr, int func, | |||
339 | } | 331 | } |
340 | } | 332 | } |
341 | 333 | ||
342 | return_VALUE(result); | 334 | return result; |
343 | } | 335 | } |
344 | 336 | ||
345 | /* -------------------------------------------------------------------------- | 337 | /* -------------------------------------------------------------------------- |
@@ -355,8 +347,6 @@ static int acpi_sbs_generate_event(struct acpi_device *device, | |||
355 | char class_saved[20]; | 347 | char class_saved[20]; |
356 | int result = 0; | 348 | int result = 0; |
357 | 349 | ||
358 | ACPI_FUNCTION_TRACE("acpi_sbs_generate_event"); | ||
359 | |||
360 | strcpy(bid_saved, acpi_device_bid(device)); | 350 | strcpy(bid_saved, acpi_device_bid(device)); |
361 | strcpy(class_saved, acpi_device_class(device)); | 351 | strcpy(class_saved, acpi_device_class(device)); |
362 | 352 | ||
@@ -368,7 +358,7 @@ static int acpi_sbs_generate_event(struct acpi_device *device, | |||
368 | strcpy(acpi_device_bid(device), bid_saved); | 358 | strcpy(acpi_device_bid(device), bid_saved); |
369 | strcpy(acpi_device_class(device), class_saved); | 359 | strcpy(acpi_device_class(device), class_saved); |
370 | 360 | ||
371 | return_VALUE(result); | 361 | return result; |
372 | } | 362 | } |
373 | 363 | ||
374 | static int acpi_battery_get_present(struct acpi_battery *battery) | 364 | static int acpi_battery_get_present(struct acpi_battery *battery) |
@@ -377,8 +367,6 @@ static int acpi_battery_get_present(struct acpi_battery *battery) | |||
377 | int result = 0; | 367 | int result = 0; |
378 | int is_present = 0; | 368 | int is_present = 0; |
379 | 369 | ||
380 | ACPI_FUNCTION_TRACE("acpi_battery_get_present"); | ||
381 | |||
382 | result = acpi_sbs_smbus_read_word(battery->sbs->smbus, | 370 | result = acpi_sbs_smbus_read_word(battery->sbs->smbus, |
383 | ACPI_SBSM_SMBUS_ADDR, 0x01, | 371 | ACPI_SBSM_SMBUS_ADDR, 0x01, |
384 | &state, NULL); | 372 | &state, NULL); |
@@ -391,7 +379,7 @@ static int acpi_battery_get_present(struct acpi_battery *battery) | |||
391 | } | 379 | } |
392 | battery->battery_present = is_present; | 380 | battery->battery_present = is_present; |
393 | 381 | ||
394 | return_VALUE(result); | 382 | return result; |
395 | } | 383 | } |
396 | 384 | ||
397 | static int acpi_battery_is_present(struct acpi_battery *battery) | 385 | static int acpi_battery_is_present(struct acpi_battery *battery) |
@@ -411,8 +399,6 @@ static int acpi_battery_select(struct acpi_battery *battery) | |||
411 | s16 state; | 399 | s16 state; |
412 | int foo; | 400 | int foo; |
413 | 401 | ||
414 | ACPI_FUNCTION_TRACE("acpi_battery_select"); | ||
415 | |||
416 | if (battery->sbs->sbsm_present) { | 402 | if (battery->sbs->sbsm_present) { |
417 | 403 | ||
418 | /* Take special care not to knobble other nibbles of | 404 | /* Take special care not to knobble other nibbles of |
@@ -440,7 +426,7 @@ static int acpi_battery_select(struct acpi_battery *battery) | |||
440 | } | 426 | } |
441 | 427 | ||
442 | end: | 428 | end: |
443 | return_VALUE(result); | 429 | return result; |
444 | } | 430 | } |
445 | 431 | ||
446 | static int acpi_sbsm_get_info(struct acpi_sbs *sbs) | 432 | static int acpi_sbsm_get_info(struct acpi_sbs *sbs) |
@@ -449,8 +435,6 @@ static int acpi_sbsm_get_info(struct acpi_sbs *sbs) | |||
449 | int result = 0; | 435 | int result = 0; |
450 | s16 battery_system_info; | 436 | s16 battery_system_info; |
451 | 437 | ||
452 | ACPI_FUNCTION_TRACE("acpi_sbsm_get_info"); | ||
453 | |||
454 | result = acpi_sbs_smbus_read_word(smbus, ACPI_SBSM_SMBUS_ADDR, 0x04, | 438 | result = acpi_sbs_smbus_read_word(smbus, ACPI_SBSM_SMBUS_ADDR, 0x04, |
455 | &battery_system_info, NULL); | 439 | &battery_system_info, NULL); |
456 | if (result) { | 440 | if (result) { |
@@ -463,7 +447,7 @@ static int acpi_sbsm_get_info(struct acpi_sbs *sbs) | |||
463 | 447 | ||
464 | end: | 448 | end: |
465 | 449 | ||
466 | return_VALUE(result); | 450 | return result; |
467 | } | 451 | } |
468 | 452 | ||
469 | static int acpi_battery_get_info(struct acpi_battery *battery) | 453 | static int acpi_battery_get_info(struct acpi_battery *battery) |
@@ -473,8 +457,6 @@ static int acpi_battery_get_info(struct acpi_battery *battery) | |||
473 | s16 battery_mode; | 457 | s16 battery_mode; |
474 | s16 specification_info; | 458 | s16 specification_info; |
475 | 459 | ||
476 | ACPI_FUNCTION_TRACE("acpi_battery_get_info"); | ||
477 | |||
478 | result = acpi_sbs_smbus_read_word(smbus, ACPI_SB_SMBUS_ADDR, 0x03, | 460 | result = acpi_sbs_smbus_read_word(smbus, ACPI_SB_SMBUS_ADDR, 0x03, |
479 | &battery_mode, | 461 | &battery_mode, |
480 | &acpi_battery_smbus_err_handler); | 462 | &acpi_battery_smbus_err_handler); |
@@ -583,12 +565,11 @@ static int acpi_battery_get_info(struct acpi_battery *battery) | |||
583 | } | 565 | } |
584 | 566 | ||
585 | end: | 567 | end: |
586 | return_VALUE(result); | 568 | return result; |
587 | } | 569 | } |
588 | 570 | ||
589 | static void acpi_update_delay(struct acpi_sbs *sbs) | 571 | static void acpi_update_delay(struct acpi_sbs *sbs) |
590 | { | 572 | { |
591 | ACPI_FUNCTION_TRACE("acpi_update_delay"); | ||
592 | if (sbs->zombie) { | 573 | if (sbs->zombie) { |
593 | return; | 574 | return; |
594 | } | 575 | } |
@@ -602,8 +583,6 @@ static int acpi_battery_get_state(struct acpi_battery *battery) | |||
602 | struct acpi_ec_smbus *smbus = battery->sbs->smbus; | 583 | struct acpi_ec_smbus *smbus = battery->sbs->smbus; |
603 | int result = 0; | 584 | int result = 0; |
604 | 585 | ||
605 | ACPI_FUNCTION_TRACE("acpi_battery_get_state"); | ||
606 | |||
607 | acpi_update_delay(battery->sbs); | 586 | acpi_update_delay(battery->sbs); |
608 | result = acpi_sbs_smbus_read_word(smbus, ACPI_SB_SMBUS_ADDR, 0x09, | 587 | result = acpi_sbs_smbus_read_word(smbus, ACPI_SB_SMBUS_ADDR, 0x09, |
609 | &battery->state.voltage, | 588 | &battery->state.voltage, |
@@ -667,7 +646,7 @@ static int acpi_battery_get_state(struct acpi_battery *battery) | |||
667 | acpi_update_delay(battery->sbs); | 646 | acpi_update_delay(battery->sbs); |
668 | 647 | ||
669 | end: | 648 | end: |
670 | return_VALUE(result); | 649 | return result; |
671 | } | 650 | } |
672 | 651 | ||
673 | static int acpi_battery_get_alarm(struct acpi_battery *battery) | 652 | static int acpi_battery_get_alarm(struct acpi_battery *battery) |
@@ -675,8 +654,6 @@ static int acpi_battery_get_alarm(struct acpi_battery *battery) | |||
675 | struct acpi_ec_smbus *smbus = battery->sbs->smbus; | 654 | struct acpi_ec_smbus *smbus = battery->sbs->smbus; |
676 | int result = 0; | 655 | int result = 0; |
677 | 656 | ||
678 | ACPI_FUNCTION_TRACE("acpi_battery_get_alarm"); | ||
679 | |||
680 | result = acpi_sbs_smbus_read_word(smbus, ACPI_SB_SMBUS_ADDR, 0x01, | 657 | result = acpi_sbs_smbus_read_word(smbus, ACPI_SB_SMBUS_ADDR, 0x01, |
681 | &battery->alarm.remaining_capacity, | 658 | &battery->alarm.remaining_capacity, |
682 | &acpi_battery_smbus_err_handler); | 659 | &acpi_battery_smbus_err_handler); |
@@ -690,7 +667,7 @@ static int acpi_battery_get_alarm(struct acpi_battery *battery) | |||
690 | 667 | ||
691 | end: | 668 | end: |
692 | 669 | ||
693 | return_VALUE(result); | 670 | return result; |
694 | } | 671 | } |
695 | 672 | ||
696 | static int acpi_battery_set_alarm(struct acpi_battery *battery, | 673 | static int acpi_battery_set_alarm(struct acpi_battery *battery, |
@@ -701,8 +678,6 @@ static int acpi_battery_set_alarm(struct acpi_battery *battery, | |||
701 | s16 battery_mode; | 678 | s16 battery_mode; |
702 | int foo; | 679 | int foo; |
703 | 680 | ||
704 | ACPI_FUNCTION_TRACE("acpi_battery_set_alarm"); | ||
705 | |||
706 | result = acpi_battery_select(battery); | 681 | result = acpi_battery_select(battery); |
707 | if (result) { | 682 | if (result) { |
708 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 683 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
@@ -746,7 +721,7 @@ static int acpi_battery_set_alarm(struct acpi_battery *battery, | |||
746 | 721 | ||
747 | end: | 722 | end: |
748 | 723 | ||
749 | return_VALUE(result); | 724 | return result; |
750 | } | 725 | } |
751 | 726 | ||
752 | static int acpi_battery_set_mode(struct acpi_battery *battery) | 727 | static int acpi_battery_set_mode(struct acpi_battery *battery) |
@@ -754,8 +729,6 @@ static int acpi_battery_set_mode(struct acpi_battery *battery) | |||
754 | int result = 0; | 729 | int result = 0; |
755 | s16 battery_mode; | 730 | s16 battery_mode; |
756 | 731 | ||
757 | ACPI_FUNCTION_TRACE("acpi_battery_set_mode"); | ||
758 | |||
759 | if (capacity_mode == DEF_CAPACITY_UNIT) { | 732 | if (capacity_mode == DEF_CAPACITY_UNIT) { |
760 | goto end; | 733 | goto end; |
761 | } | 734 | } |
@@ -793,15 +766,13 @@ static int acpi_battery_set_mode(struct acpi_battery *battery) | |||
793 | } | 766 | } |
794 | 767 | ||
795 | end: | 768 | end: |
796 | return_VALUE(result); | 769 | return result; |
797 | } | 770 | } |
798 | 771 | ||
799 | static int acpi_battery_init(struct acpi_battery *battery) | 772 | static int acpi_battery_init(struct acpi_battery *battery) |
800 | { | 773 | { |
801 | int result = 0; | 774 | int result = 0; |
802 | 775 | ||
803 | ACPI_FUNCTION_TRACE("acpi_battery_init"); | ||
804 | |||
805 | result = acpi_battery_select(battery); | 776 | result = acpi_battery_select(battery); |
806 | if (result) { | 777 | if (result) { |
807 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 778 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
@@ -838,7 +809,7 @@ static int acpi_battery_init(struct acpi_battery *battery) | |||
838 | } | 809 | } |
839 | 810 | ||
840 | end: | 811 | end: |
841 | return_VALUE(result); | 812 | return result; |
842 | } | 813 | } |
843 | 814 | ||
844 | static int acpi_ac_get_present(struct acpi_sbs *sbs) | 815 | static int acpi_ac_get_present(struct acpi_sbs *sbs) |
@@ -847,8 +818,6 @@ static int acpi_ac_get_present(struct acpi_sbs *sbs) | |||
847 | int result = 0; | 818 | int result = 0; |
848 | s16 charger_status; | 819 | s16 charger_status; |
849 | 820 | ||
850 | ACPI_FUNCTION_TRACE("acpi_ac_get_present"); | ||
851 | |||
852 | result = acpi_sbs_smbus_read_word(smbus, ACPI_SBC_SMBUS_ADDR, 0x13, | 821 | result = acpi_sbs_smbus_read_word(smbus, ACPI_SBC_SMBUS_ADDR, 0x13, |
853 | &charger_status, NULL); | 822 | &charger_status, NULL); |
854 | 823 | ||
@@ -862,7 +831,7 @@ static int acpi_ac_get_present(struct acpi_sbs *sbs) | |||
862 | 831 | ||
863 | end: | 832 | end: |
864 | 833 | ||
865 | return_VALUE(result); | 834 | return result; |
866 | } | 835 | } |
867 | 836 | ||
868 | /* -------------------------------------------------------------------------- | 837 | /* -------------------------------------------------------------------------- |
@@ -881,14 +850,12 @@ acpi_sbs_generic_add_fs(struct proc_dir_entry **dir, | |||
881 | { | 850 | { |
882 | struct proc_dir_entry *entry = NULL; | 851 | struct proc_dir_entry *entry = NULL; |
883 | 852 | ||
884 | ACPI_FUNCTION_TRACE("acpi_sbs_generic_add_fs"); | ||
885 | |||
886 | if (!*dir) { | 853 | if (!*dir) { |
887 | *dir = proc_mkdir(dir_name, parent_dir); | 854 | *dir = proc_mkdir(dir_name, parent_dir); |
888 | if (!*dir) { | 855 | if (!*dir) { |
889 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 856 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
890 | "proc_mkdir() failed\n")); | 857 | "proc_mkdir() failed\n")); |
891 | return_VALUE(-ENODEV); | 858 | return -ENODEV; |
892 | } | 859 | } |
893 | (*dir)->owner = THIS_MODULE; | 860 | (*dir)->owner = THIS_MODULE; |
894 | } | 861 | } |
@@ -932,14 +899,13 @@ acpi_sbs_generic_add_fs(struct proc_dir_entry **dir, | |||
932 | } | 899 | } |
933 | } | 900 | } |
934 | 901 | ||
935 | return_VALUE(0); | 902 | return 0; |
936 | } | 903 | } |
937 | 904 | ||
938 | static void | 905 | static void |
939 | acpi_sbs_generic_remove_fs(struct proc_dir_entry **dir, | 906 | acpi_sbs_generic_remove_fs(struct proc_dir_entry **dir, |
940 | struct proc_dir_entry *parent_dir) | 907 | struct proc_dir_entry *parent_dir) |
941 | { | 908 | { |
942 | ACPI_FUNCTION_TRACE("acpi_sbs_generic_remove_fs"); | ||
943 | 909 | ||
944 | if (*dir) { | 910 | if (*dir) { |
945 | remove_proc_entry(ACPI_SBS_FILE_INFO, *dir); | 911 | remove_proc_entry(ACPI_SBS_FILE_INFO, *dir); |
@@ -961,10 +927,8 @@ static int acpi_battery_read_info(struct seq_file *seq, void *offset) | |||
961 | int cscale; | 927 | int cscale; |
962 | int result = 0; | 928 | int result = 0; |
963 | 929 | ||
964 | ACPI_FUNCTION_TRACE("acpi_battery_read_info"); | ||
965 | |||
966 | if (battery->sbs->zombie) { | 930 | if (battery->sbs->zombie) { |
967 | return_VALUE(-ENODEV); | 931 | return -ENODEV; |
968 | } | 932 | } |
969 | 933 | ||
970 | down(&sbs_sem); | 934 | down(&sbs_sem); |
@@ -1023,7 +987,7 @@ static int acpi_battery_read_info(struct seq_file *seq, void *offset) | |||
1023 | 987 | ||
1024 | up(&sbs_sem); | 988 | up(&sbs_sem); |
1025 | 989 | ||
1026 | return_VALUE(result); | 990 | return result; |
1027 | } | 991 | } |
1028 | 992 | ||
1029 | static int acpi_battery_info_open_fs(struct inode *inode, struct file *file) | 993 | static int acpi_battery_info_open_fs(struct inode *inode, struct file *file) |
@@ -1038,10 +1002,8 @@ static int acpi_battery_read_state(struct seq_file *seq, void *offset) | |||
1038 | int cscale; | 1002 | int cscale; |
1039 | int foo; | 1003 | int foo; |
1040 | 1004 | ||
1041 | ACPI_FUNCTION_TRACE("acpi_battery_read_state"); | ||
1042 | |||
1043 | if (battery->sbs->zombie) { | 1005 | if (battery->sbs->zombie) { |
1044 | return_VALUE(-ENODEV); | 1006 | return -ENODEV; |
1045 | } | 1007 | } |
1046 | 1008 | ||
1047 | down(&sbs_sem); | 1009 | down(&sbs_sem); |
@@ -1104,7 +1066,7 @@ static int acpi_battery_read_state(struct seq_file *seq, void *offset) | |||
1104 | 1066 | ||
1105 | up(&sbs_sem); | 1067 | up(&sbs_sem); |
1106 | 1068 | ||
1107 | return_VALUE(result); | 1069 | return result; |
1108 | } | 1070 | } |
1109 | 1071 | ||
1110 | static int acpi_battery_state_open_fs(struct inode *inode, struct file *file) | 1072 | static int acpi_battery_state_open_fs(struct inode *inode, struct file *file) |
@@ -1118,10 +1080,8 @@ static int acpi_battery_read_alarm(struct seq_file *seq, void *offset) | |||
1118 | int result = 0; | 1080 | int result = 0; |
1119 | int cscale; | 1081 | int cscale; |
1120 | 1082 | ||
1121 | ACPI_FUNCTION_TRACE("acpi_battery_read_alarm"); | ||
1122 | |||
1123 | if (battery->sbs->zombie) { | 1083 | if (battery->sbs->zombie) { |
1124 | return_VALUE(-ENODEV); | 1084 | return -ENODEV; |
1125 | } | 1085 | } |
1126 | 1086 | ||
1127 | down(&sbs_sem); | 1087 | down(&sbs_sem); |
@@ -1158,7 +1118,7 @@ static int acpi_battery_read_alarm(struct seq_file *seq, void *offset) | |||
1158 | 1118 | ||
1159 | up(&sbs_sem); | 1119 | up(&sbs_sem); |
1160 | 1120 | ||
1161 | return_VALUE(result); | 1121 | return result; |
1162 | } | 1122 | } |
1163 | 1123 | ||
1164 | static ssize_t | 1124 | static ssize_t |
@@ -1170,10 +1130,8 @@ acpi_battery_write_alarm(struct file *file, const char __user * buffer, | |||
1170 | char alarm_string[12] = { '\0' }; | 1130 | char alarm_string[12] = { '\0' }; |
1171 | int result, old_alarm, new_alarm; | 1131 | int result, old_alarm, new_alarm; |
1172 | 1132 | ||
1173 | ACPI_FUNCTION_TRACE("acpi_battery_write_alarm"); | ||
1174 | |||
1175 | if (battery->sbs->zombie) { | 1133 | if (battery->sbs->zombie) { |
1176 | return_VALUE(-ENODEV); | 1134 | return -ENODEV; |
1177 | } | 1135 | } |
1178 | 1136 | ||
1179 | down(&sbs_sem); | 1137 | down(&sbs_sem); |
@@ -1217,9 +1175,9 @@ acpi_battery_write_alarm(struct file *file, const char __user * buffer, | |||
1217 | up(&sbs_sem); | 1175 | up(&sbs_sem); |
1218 | 1176 | ||
1219 | if (result) { | 1177 | if (result) { |
1220 | return_VALUE(result); | 1178 | return result; |
1221 | } else { | 1179 | } else { |
1222 | return_VALUE(count); | 1180 | return count; |
1223 | } | 1181 | } |
1224 | } | 1182 | } |
1225 | 1183 | ||
@@ -1262,10 +1220,8 @@ static int acpi_ac_read_state(struct seq_file *seq, void *offset) | |||
1262 | struct acpi_sbs *sbs = (struct acpi_sbs *)seq->private; | 1220 | struct acpi_sbs *sbs = (struct acpi_sbs *)seq->private; |
1263 | int result; | 1221 | int result; |
1264 | 1222 | ||
1265 | ACPI_FUNCTION_TRACE("acpi_ac_read_state"); | ||
1266 | |||
1267 | if (sbs->zombie) { | 1223 | if (sbs->zombie) { |
1268 | return_VALUE(-ENODEV); | 1224 | return -ENODEV; |
1269 | } | 1225 | } |
1270 | 1226 | ||
1271 | down(&sbs_sem); | 1227 | down(&sbs_sem); |
@@ -1283,7 +1239,7 @@ static int acpi_ac_read_state(struct seq_file *seq, void *offset) | |||
1283 | 1239 | ||
1284 | up(&sbs_sem); | 1240 | up(&sbs_sem); |
1285 | 1241 | ||
1286 | return_VALUE(0); | 1242 | return 0; |
1287 | } | 1243 | } |
1288 | 1244 | ||
1289 | static int acpi_ac_state_open_fs(struct inode *inode, struct file *file) | 1245 | static int acpi_ac_state_open_fs(struct inode *inode, struct file *file) |
@@ -1312,8 +1268,6 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id) | |||
1312 | char dir_name[32]; | 1268 | char dir_name[32]; |
1313 | struct acpi_battery *battery; | 1269 | struct acpi_battery *battery; |
1314 | 1270 | ||
1315 | ACPI_FUNCTION_TRACE("acpi_battery_add"); | ||
1316 | |||
1317 | battery = &sbs->battery[id]; | 1271 | battery = &sbs->battery[id]; |
1318 | 1272 | ||
1319 | battery->alive = 0; | 1273 | battery->alive = 0; |
@@ -1364,12 +1318,11 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id) | |||
1364 | battery->alive = 1; | 1318 | battery->alive = 1; |
1365 | 1319 | ||
1366 | end: | 1320 | end: |
1367 | return_VALUE(result); | 1321 | return result; |
1368 | } | 1322 | } |
1369 | 1323 | ||
1370 | static void acpi_battery_remove(struct acpi_sbs *sbs, int id) | 1324 | static void acpi_battery_remove(struct acpi_sbs *sbs, int id) |
1371 | { | 1325 | { |
1372 | ACPI_FUNCTION_TRACE("acpi_battery_remove"); | ||
1373 | 1326 | ||
1374 | if (sbs->battery[id].battery_entry) { | 1327 | if (sbs->battery[id].battery_entry) { |
1375 | acpi_sbs_generic_remove_fs(&(sbs->battery[id].battery_entry), | 1328 | acpi_sbs_generic_remove_fs(&(sbs->battery[id].battery_entry), |
@@ -1381,8 +1334,6 @@ static int acpi_ac_add(struct acpi_sbs *sbs) | |||
1381 | { | 1334 | { |
1382 | int result; | 1335 | int result; |
1383 | 1336 | ||
1384 | ACPI_FUNCTION_TRACE("acpi_ac_add"); | ||
1385 | |||
1386 | result = acpi_ac_get_present(sbs); | 1337 | result = acpi_ac_get_present(sbs); |
1387 | if (result) { | 1338 | if (result) { |
1388 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 1339 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
@@ -1402,12 +1353,11 @@ static int acpi_ac_add(struct acpi_sbs *sbs) | |||
1402 | 1353 | ||
1403 | end: | 1354 | end: |
1404 | 1355 | ||
1405 | return_VALUE(result); | 1356 | return result; |
1406 | } | 1357 | } |
1407 | 1358 | ||
1408 | static void acpi_ac_remove(struct acpi_sbs *sbs) | 1359 | static void acpi_ac_remove(struct acpi_sbs *sbs) |
1409 | { | 1360 | { |
1410 | ACPI_FUNCTION_TRACE("acpi_ac_remove"); | ||
1411 | 1361 | ||
1412 | if (sbs->ac_entry) { | 1362 | if (sbs->ac_entry) { |
1413 | acpi_sbs_generic_remove_fs(&sbs->ac_entry, acpi_ac_dir); | 1363 | acpi_sbs_generic_remove_fs(&sbs->ac_entry, acpi_ac_dir); |
@@ -1416,7 +1366,6 @@ static void acpi_ac_remove(struct acpi_sbs *sbs) | |||
1416 | 1366 | ||
1417 | static void acpi_sbs_update_queue_run(unsigned long data) | 1367 | static void acpi_sbs_update_queue_run(unsigned long data) |
1418 | { | 1368 | { |
1419 | ACPI_FUNCTION_TRACE("acpi_sbs_update_queue_run"); | ||
1420 | acpi_os_execute(OSL_GPE_HANDLER, acpi_sbs_update_queue, (void *)data); | 1369 | acpi_os_execute(OSL_GPE_HANDLER, acpi_sbs_update_queue, (void *)data); |
1421 | } | 1370 | } |
1422 | 1371 | ||
@@ -1433,8 +1382,6 @@ static int acpi_sbs_update_run(struct acpi_sbs *sbs, int data_type) | |||
1433 | int do_battery_init, do_ac_init; | 1382 | int do_battery_init, do_ac_init; |
1434 | s16 old_remaining_capacity; | 1383 | s16 old_remaining_capacity; |
1435 | 1384 | ||
1436 | ACPI_FUNCTION_TRACE("acpi_sbs_update_run"); | ||
1437 | |||
1438 | if (sbs->zombie) { | 1385 | if (sbs->zombie) { |
1439 | goto end; | 1386 | goto end; |
1440 | } | 1387 | } |
@@ -1584,7 +1531,7 @@ static int acpi_sbs_update_run(struct acpi_sbs *sbs, int data_type) | |||
1584 | } | 1531 | } |
1585 | 1532 | ||
1586 | end: | 1533 | end: |
1587 | return_VALUE(result); | 1534 | return result; |
1588 | } | 1535 | } |
1589 | 1536 | ||
1590 | static void acpi_sbs_update_queue(void *data) | 1537 | static void acpi_sbs_update_queue(void *data) |
@@ -1593,8 +1540,6 @@ static void acpi_sbs_update_queue(void *data) | |||
1593 | unsigned long delay = -1; | 1540 | unsigned long delay = -1; |
1594 | int result; | 1541 | int result; |
1595 | 1542 | ||
1596 | ACPI_FUNCTION_TRACE("acpi_sbs_update_queue"); | ||
1597 | |||
1598 | if (sbs->zombie) { | 1543 | if (sbs->zombie) { |
1599 | goto end; | 1544 | goto end; |
1600 | } | 1545 | } |
@@ -1631,12 +1576,10 @@ static int acpi_sbs_add(struct acpi_device *device) | |||
1631 | int id, cnt; | 1576 | int id, cnt; |
1632 | acpi_status status = AE_OK; | 1577 | acpi_status status = AE_OK; |
1633 | 1578 | ||
1634 | ACPI_FUNCTION_TRACE("acpi_sbs_add"); | ||
1635 | |||
1636 | sbs = kmalloc(sizeof(struct acpi_sbs), GFP_KERNEL); | 1579 | sbs = kmalloc(sizeof(struct acpi_sbs), GFP_KERNEL); |
1637 | if (!sbs) { | 1580 | if (!sbs) { |
1638 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "kmalloc() failed\n")); | 1581 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "kmalloc() failed\n")); |
1639 | return_VALUE(-ENOMEM); | 1582 | return -ENOMEM; |
1640 | } | 1583 | } |
1641 | memset(sbs, 0, sizeof(struct acpi_sbs)); | 1584 | memset(sbs, 0, sizeof(struct acpi_sbs)); |
1642 | 1585 | ||
@@ -1737,7 +1680,7 @@ static int acpi_sbs_add(struct acpi_device *device) | |||
1737 | } | 1680 | } |
1738 | } | 1681 | } |
1739 | 1682 | ||
1740 | return_VALUE(result); | 1683 | return result; |
1741 | } | 1684 | } |
1742 | 1685 | ||
1743 | int acpi_sbs_remove(struct acpi_device *device, int type) | 1686 | int acpi_sbs_remove(struct acpi_device *device, int type) |
@@ -1745,10 +1688,8 @@ int acpi_sbs_remove(struct acpi_device *device, int type) | |||
1745 | struct acpi_sbs *sbs = (struct acpi_sbs *)acpi_driver_data(device); | 1688 | struct acpi_sbs *sbs = (struct acpi_sbs *)acpi_driver_data(device); |
1746 | int id; | 1689 | int id; |
1747 | 1690 | ||
1748 | ACPI_FUNCTION_TRACE("acpi_sbs_remove"); | ||
1749 | |||
1750 | if (!device || !sbs) { | 1691 | if (!device || !sbs) { |
1751 | return_VALUE(-EINVAL); | 1692 | return -EINVAL; |
1752 | } | 1693 | } |
1753 | 1694 | ||
1754 | sbs->zombie = 1; | 1695 | sbs->zombie = 1; |
@@ -1766,15 +1707,13 @@ int acpi_sbs_remove(struct acpi_device *device, int type) | |||
1766 | 1707 | ||
1767 | kfree(sbs); | 1708 | kfree(sbs); |
1768 | 1709 | ||
1769 | return_VALUE(0); | 1710 | return 0; |
1770 | } | 1711 | } |
1771 | 1712 | ||
1772 | static int __init acpi_sbs_init(void) | 1713 | static int __init acpi_sbs_init(void) |
1773 | { | 1714 | { |
1774 | int result = 0; | 1715 | int result = 0; |
1775 | 1716 | ||
1776 | ACPI_FUNCTION_TRACE("acpi_sbs_init"); | ||
1777 | |||
1778 | init_MUTEX(&sbs_sem); | 1717 | init_MUTEX(&sbs_sem); |
1779 | 1718 | ||
1780 | if (capacity_mode != DEF_CAPACITY_UNIT | 1719 | if (capacity_mode != DEF_CAPACITY_UNIT |
@@ -1783,36 +1722,35 @@ static int __init acpi_sbs_init(void) | |||
1783 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "acpi_sbs_init: " | 1722 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "acpi_sbs_init: " |
1784 | "invalid capacity_mode = %d\n", | 1723 | "invalid capacity_mode = %d\n", |
1785 | capacity_mode)); | 1724 | capacity_mode)); |
1786 | return_VALUE(-EINVAL); | 1725 | return -EINVAL; |
1787 | } | 1726 | } |
1788 | 1727 | ||
1789 | acpi_ac_dir = acpi_lock_ac_dir(); | 1728 | acpi_ac_dir = acpi_lock_ac_dir(); |
1790 | if (!acpi_ac_dir) { | 1729 | if (!acpi_ac_dir) { |
1791 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 1730 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
1792 | "acpi_lock_ac_dir() failed\n")); | 1731 | "acpi_lock_ac_dir() failed\n")); |
1793 | return_VALUE(-ENODEV); | 1732 | return -ENODEV; |
1794 | } | 1733 | } |
1795 | 1734 | ||
1796 | acpi_battery_dir = acpi_lock_battery_dir(); | 1735 | acpi_battery_dir = acpi_lock_battery_dir(); |
1797 | if (!acpi_battery_dir) { | 1736 | if (!acpi_battery_dir) { |
1798 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 1737 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
1799 | "acpi_lock_battery_dir() failed\n")); | 1738 | "acpi_lock_battery_dir() failed\n")); |
1800 | return_VALUE(-ENODEV); | 1739 | return -ENODEV; |
1801 | } | 1740 | } |
1802 | 1741 | ||
1803 | result = acpi_bus_register_driver(&acpi_sbs_driver); | 1742 | result = acpi_bus_register_driver(&acpi_sbs_driver); |
1804 | if (result < 0) { | 1743 | if (result < 0) { |
1805 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 1744 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
1806 | "acpi_bus_register_driver() failed\n")); | 1745 | "acpi_bus_register_driver() failed\n")); |
1807 | return_VALUE(-ENODEV); | 1746 | return -ENODEV; |
1808 | } | 1747 | } |
1809 | 1748 | ||
1810 | return_VALUE(0); | 1749 | return 0; |
1811 | } | 1750 | } |
1812 | 1751 | ||
1813 | static void __exit acpi_sbs_exit(void) | 1752 | static void __exit acpi_sbs_exit(void) |
1814 | { | 1753 | { |
1815 | ACPI_FUNCTION_TRACE("acpi_sbs_exit"); | ||
1816 | 1754 | ||
1817 | acpi_bus_unregister_driver(&acpi_sbs_driver); | 1755 | acpi_bus_unregister_driver(&acpi_sbs_driver); |
1818 | 1756 | ||
@@ -1821,7 +1759,7 @@ static void __exit acpi_sbs_exit(void) | |||
1821 | acpi_unlock_battery_dir(acpi_battery_dir); | 1759 | acpi_unlock_battery_dir(acpi_battery_dir); |
1822 | acpi_battery_dir = NULL; | 1760 | acpi_battery_dir = NULL; |
1823 | 1761 | ||
1824 | return_VOID; | 1762 | return; |
1825 | } | 1763 | } |
1826 | 1764 | ||
1827 | module_init(acpi_sbs_init); | 1765 | module_init(acpi_sbs_init); |