Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ACPI: battery: syntax cleanup

In response to review comments from Andrew Morton

Signed-off-by: Alexey Starikovskiy <aystarik@gmail.com>
Signed-off-by: Len Brown <len.brown@intel.com>

authored by

Alexey Starikovskiy and committed by
Len Brown
78490d82 6eedeef7

+173 -247
+173 -247
drivers/acpi/battery.c
··· 43 43 #define ACPI_BATTERY_CLASS "battery" 44 44 #define ACPI_BATTERY_HID "PNP0C0A" 45 45 #define ACPI_BATTERY_DEVICE_NAME "Battery" 46 - #define ACPI_BATTERY_FILE_INFO "info" 47 - #define ACPI_BATTERY_FILE_STATE "state" 48 - #define ACPI_BATTERY_FILE_ALARM "alarm" 49 46 #define ACPI_BATTERY_NOTIFY_STATUS 0x80 50 47 #define ACPI_BATTERY_NOTIFY_INFO 0x81 51 48 #define ACPI_BATTERY_UNITS_WATTS "mW" ··· 108 111 acpi_string oem_info; 109 112 }; 110 113 114 + enum acpi_battery_files{ 115 + ACPI_BATTERY_INFO = 0, 116 + ACPI_BATTERY_STATE, 117 + ACPI_BATTERY_ALARM, 118 + ACPI_BATTERY_NUMFILES, 119 + }; 120 + 111 121 struct acpi_battery_flags { 112 122 u8 battery_present_prev; 113 123 u8 alarm_present; 114 124 u8 init_update; 115 - u8 info_update; 116 - u8 state_update; 117 - u8 alarm_update; 125 + u8 update[ACPI_BATTERY_NUMFILES]; 118 126 u8 power_unit; 119 127 }; 120 128 ··· 130 128 struct acpi_buffer bif_data; 131 129 struct acpi_buffer bst_data; 132 130 unsigned long alarm; 133 - unsigned long info_update_time; 134 - unsigned long state_update_time; 135 - unsigned long alarm_update_time; 131 + unsigned long update_time[ACPI_BATTERY_NUMFILES]; 136 132 }; 137 133 138 - #define acpi_battery_present(battery) battery->device->status.battery_present 139 - #define acpi_battery_present_prev(battery) battery->flags.battery_present_prev 140 - #define acpi_battery_alarm_present(battery) battery->flags.alarm_present 141 - #define acpi_battery_init_update_flag(battery) battery->flags.init_update 142 - #define acpi_battery_info_update_flag(battery) battery->flags.info_update 143 - #define acpi_battery_state_update_flag(battery) battery->flags.state_update 144 - #define acpi_battery_alarm_update_flag(battery) battery->flags.alarm_update 145 - #define acpi_battery_power_units(battery) battery->flags.power_unit ? \ 146 - ACPI_BATTERY_UNITS_AMPS : ACPI_BATTERY_UNITS_WATTS 147 - #define acpi_battery_handle(battery) battery->device->handle 148 - #define acpi_battery_inserted(battery) (!acpi_battery_present_prev(battery) & acpi_battery_present(battery)) 149 - #define acpi_battery_removed(battery) (acpi_battery_present_prev(battery) & !acpi_battery_present(battery)) 150 - #define acpi_battery_bid(battery) acpi_device_bid(battery->device) 151 - #define acpi_battery_status_str(battery) acpi_battery_present(battery) ? "present" : "absent" 134 + inline int acpi_battery_present(struct acpi_battery *battery) 135 + { 136 + return battery->device->status.battery_present; 137 + } 138 + inline char *acpi_battery_power_units(struct acpi_battery *battery) 139 + { 140 + if (battery->flags.power_unit) 141 + return ACPI_BATTERY_UNITS_AMPS; 142 + else 143 + return ACPI_BATTERY_UNITS_WATTS; 144 + } 145 + 146 + inline acpi_handle acpi_battery_handle(struct acpi_battery *battery) 147 + { 148 + return battery->device->handle; 149 + } 152 150 153 151 /* -------------------------------------------------------------------------- 154 152 Battery Management 155 153 -------------------------------------------------------------------------- */ 156 - 157 - static void acpi_battery_mutex_lock(struct acpi_battery *battery) 158 - { 159 - mutex_lock(&battery->mutex); 160 - } 161 - 162 - static void acpi_battery_mutex_unlock(struct acpi_battery *battery) 163 - { 164 - mutex_unlock(&battery->mutex); 165 - } 166 154 167 155 static void acpi_battery_check_result(struct acpi_battery *battery, int result) 168 156 { ··· 160 168 return; 161 169 162 170 if (result) { 163 - acpi_battery_init_update_flag(battery) = 1; 171 + battery->flags.init_update = 1; 164 172 } 165 173 } 166 174 ··· 181 189 } 182 190 183 191 if (data_null.length != data->length) { 184 - if (data->pointer) { 185 - kfree(data->pointer); 186 - } 192 + kfree(data->pointer); 187 193 data->pointer = kzalloc(data_null.length, GFP_KERNEL); 188 194 if (!data->pointer) { 189 195 ACPI_EXCEPTION((AE_INFO, AE_NO_MEMORY, "kzalloc()")); ··· 224 234 struct acpi_buffer *data = NULL; 225 235 struct acpi_battery_info *bif = NULL; 226 236 227 - battery->info_update_time = get_seconds(); 237 + battery->update_time[ACPI_BATTERY_INFO] = get_seconds(); 228 238 229 239 if (!acpi_battery_present(battery)) 230 240 return 0; 231 241 232 - /* Evalute _BIF */ 242 + /* Evaluate _BIF */ 233 243 234 244 status = 235 245 acpi_evaluate_object(acpi_battery_handle(battery), "_BIF", NULL, ··· 253 263 254 264 end: 255 265 256 - if (buffer.pointer) { 257 - kfree(buffer.pointer); 258 - } 266 + kfree(buffer.pointer); 259 267 260 268 if (!result) { 261 269 bif = data->pointer; ··· 274 286 union acpi_object *package = NULL; 275 287 struct acpi_buffer *data = NULL; 276 288 277 - battery->state_update_time = get_seconds(); 289 + battery->update_time[ACPI_BATTERY_STATE] = get_seconds(); 278 290 279 291 if (!acpi_battery_present(battery)) 280 292 return 0; 281 293 282 - /* Evalute _BST */ 294 + /* Evaluate _BST */ 283 295 284 296 status = 285 297 acpi_evaluate_object(acpi_battery_handle(battery), "_BST", NULL, ··· 302 314 goto end; 303 315 304 316 end: 305 - if (buffer.pointer) { 306 - kfree(buffer.pointer); 307 - } 317 + kfree(buffer.pointer); 308 318 309 319 return result; 310 320 } 311 321 312 322 static int acpi_battery_get_alarm(struct acpi_battery *battery) 313 323 { 314 - battery->alarm_update_time = get_seconds(); 324 + battery->update_time[ACPI_BATTERY_ALARM] = get_seconds(); 315 325 316 326 return 0; 317 327 } ··· 321 335 union acpi_object arg0 = { ACPI_TYPE_INTEGER }; 322 336 struct acpi_object_list arg_list = { 1, &arg0 }; 323 337 324 - battery->alarm_update_time = get_seconds(); 338 + battery->update_time[ACPI_BATTERY_ALARM] = get_seconds(); 325 339 326 340 if (!acpi_battery_present(battery)) 327 341 return -ENODEV; 328 342 329 - if (!acpi_battery_alarm_present(battery)) 343 + if (!battery->flags.alarm_present) 330 344 return -ENODEV; 331 345 332 346 arg0.integer.value = alarm; ··· 356 370 357 371 status = acpi_get_handle(acpi_battery_handle(battery), "_BTP", &handle); 358 372 if (ACPI_SUCCESS(status)) { 359 - acpi_battery_alarm_present(battery) = 1; 373 + battery->flags.alarm_present = 1; 360 374 if (!alarm && bif) { 361 375 alarm = bif->design_capacity_warning; 362 376 } ··· 364 378 if (result) 365 379 goto end; 366 380 } else { 367 - acpi_battery_alarm_present(battery) = 0; 381 + battery->flags.alarm_present = 0; 368 382 } 369 383 370 384 end: ··· 380 394 if (result) 381 395 return result; 382 396 383 - acpi_battery_present_prev(battery) = acpi_battery_present(battery); 397 + battery->flags.battery_present_prev = acpi_battery_present(battery); 384 398 385 399 if (acpi_battery_present(battery)) { 386 400 result = acpi_battery_get_info(battery); ··· 406 420 update = 1; 407 421 } 408 422 409 - if (acpi_battery_init_update_flag(battery)) { 423 + if (battery->flags.init_update) { 410 424 result = acpi_battery_init_update(battery); 411 425 if (result) 412 - goto end;; 426 + goto end; 413 427 update_result = ACPI_BATTERY_INIT_UPDATE; 414 428 } else if (update) { 415 429 result = acpi_battery_get_status(battery); 416 430 if (result) 417 - goto end;; 418 - if (acpi_battery_inserted(battery) 419 - || acpi_battery_removed(battery)) { 431 + goto end; 432 + if ((!battery->flags.battery_present_prev & acpi_battery_present(battery)) 433 + || (battery->flags.battery_present_prev & !acpi_battery_present(battery))) { 420 434 result = acpi_battery_init_update(battery); 421 435 if (result) 422 - goto end;; 436 + goto end; 423 437 update_result = ACPI_BATTERY_INIT_UPDATE; 424 438 } else { 425 439 update_result = ACPI_BATTERY_EASY_UPDATE; ··· 428 442 429 443 end: 430 444 431 - acpi_battery_init_update_flag(battery) = (result != 0); 445 + battery->flags.init_update = (result != 0); 432 446 433 447 *update_result_ptr = update_result; 434 448 ··· 439 453 { 440 454 acpi_battery_get_status(battery); 441 455 442 - if (acpi_battery_init_update_flag(battery)) { 456 + if (battery->flags.init_update) { 443 457 return; 444 458 } 445 459 446 - if (acpi_battery_inserted(battery) || acpi_battery_removed(battery)) { 447 - acpi_battery_init_update_flag(battery) = 1; 460 + if ((!battery->flags.battery_present_prev & 461 + acpi_battery_present(battery)) || 462 + (battery->flags.battery_present_prev & 463 + !acpi_battery_present(battery))) { 464 + battery->flags.init_update = 1; 448 465 } else { 449 - acpi_battery_info_update_flag(battery) = 1; 450 - acpi_battery_state_update_flag(battery) = 1; 451 - acpi_battery_alarm_update_flag(battery) = 1; 466 + battery->flags.update[ACPI_BATTERY_INFO] = 1; 467 + battery->flags.update[ACPI_BATTERY_STATE] = 1; 468 + battery->flags.update[ACPI_BATTERY_ALARM] = 1; 452 469 } 453 470 } 454 471 ··· 461 472 462 473 static struct proc_dir_entry *acpi_battery_dir; 463 474 464 - static int acpi_battery_read_info_print(struct seq_file *seq, int result) 475 + static int acpi_battery_print_info(struct seq_file *seq, int result) 465 476 { 466 477 struct acpi_battery *battery = seq->private; 467 478 struct acpi_battery_info *bif = NULL; ··· 538 549 return result; 539 550 } 540 551 541 - static int acpi_battery_read_info(struct seq_file *seq, void *offset) 542 - { 543 - struct acpi_battery *battery = seq->private; 544 - int result = 0; 545 - int update_result = ACPI_BATTERY_NONE_UPDATE; 546 - int update = 0; 547 - 548 - acpi_battery_mutex_lock(battery); 549 - 550 - update = (get_seconds() - battery->info_update_time >= update_time); 551 - update = (update | acpi_battery_info_update_flag(battery)); 552 - 553 - result = acpi_battery_update(battery, update, &update_result); 554 - if (result) 555 - goto end; 556 - 557 - /* Battery Info (_BIF) */ 558 - 559 - if (update_result == ACPI_BATTERY_EASY_UPDATE) { 560 - result = acpi_battery_get_info(battery); 561 - if (result) 562 - goto end; 563 - } 564 - 565 - end: 566 - 567 - result = acpi_battery_read_info_print(seq, result); 568 - 569 - acpi_battery_check_result(battery, result); 570 - 571 - acpi_battery_info_update_flag(battery) = result; 572 - 573 - acpi_battery_mutex_unlock(battery); 574 - 575 - return result; 576 - } 577 - 578 - static int acpi_battery_info_open_fs(struct inode *inode, struct file *file) 579 - { 580 - return single_open(file, acpi_battery_read_info, PDE(inode)->data); 581 - } 582 - 583 - static int acpi_battery_read_state_print(struct seq_file *seq, int result) 552 + static int acpi_battery_print_state(struct seq_file *seq, int result) 584 553 { 585 554 struct acpi_battery *battery = seq->private; 586 555 struct acpi_battery_state *bst = NULL; ··· 608 661 return result; 609 662 } 610 663 611 - static int acpi_battery_read_state(struct seq_file *seq, void *offset) 612 - { 613 - struct acpi_battery *battery = seq->private; 614 - int result = 0; 615 - int update_result = ACPI_BATTERY_NONE_UPDATE; 616 - int update = 0; 617 - 618 - acpi_battery_mutex_lock(battery); 619 - 620 - update = (get_seconds() - battery->state_update_time >= update_time); 621 - update = (update | acpi_battery_state_update_flag(battery)); 622 - 623 - result = acpi_battery_update(battery, update, &update_result); 624 - if (result) 625 - goto end; 626 - 627 - /* Battery State (_BST) */ 628 - 629 - if (update_result == ACPI_BATTERY_EASY_UPDATE) { 630 - result = acpi_battery_get_state(battery); 631 - if (result) 632 - goto end; 633 - } 634 - 635 - end: 636 - 637 - result = acpi_battery_read_state_print(seq, result); 638 - 639 - acpi_battery_check_result(battery, result); 640 - 641 - acpi_battery_state_update_flag(battery) = result; 642 - 643 - acpi_battery_mutex_unlock(battery); 644 - 645 - return result; 646 - } 647 - 648 - static int acpi_battery_state_open_fs(struct inode *inode, struct file *file) 649 - { 650 - return single_open(file, acpi_battery_read_state, PDE(inode)->data); 651 - } 652 - 653 - static int acpi_battery_read_alarm_print(struct seq_file *seq, int result) 664 + static int acpi_battery_print_alarm(struct seq_file *seq, int result) 654 665 { 655 666 struct acpi_battery *battery = seq->private; 656 667 char *units = "?"; ··· 639 734 return result; 640 735 } 641 736 642 - static int acpi_battery_read_alarm(struct seq_file *seq, void *offset) 643 - { 644 - struct acpi_battery *battery = seq->private; 645 - int result = 0; 646 - int update_result = ACPI_BATTERY_NONE_UPDATE; 647 - int update = 0; 648 - 649 - acpi_battery_mutex_lock(battery); 650 - 651 - update = (get_seconds() - battery->alarm_update_time >= update_time); 652 - update = (update | acpi_battery_alarm_update_flag(battery)); 653 - 654 - result = acpi_battery_update(battery, update, &update_result); 655 - if (result) 656 - goto end; 657 - 658 - /* Battery Alarm */ 659 - 660 - if (update_result == ACPI_BATTERY_EASY_UPDATE) { 661 - result = acpi_battery_get_alarm(battery); 662 - if (result) 663 - goto end; 664 - } 665 - 666 - end: 667 - 668 - result = acpi_battery_read_alarm_print(seq, result); 669 - 670 - acpi_battery_check_result(battery, result); 671 - 672 - acpi_battery_alarm_update_flag(battery) = result; 673 - 674 - acpi_battery_mutex_unlock(battery); 675 - 676 - return result; 677 - } 678 - 679 737 static ssize_t 680 738 acpi_battery_write_alarm(struct file *file, 681 739 const char __user * buffer, ··· 653 785 if (!battery || (count > sizeof(alarm_string) - 1)) 654 786 return -EINVAL; 655 787 656 - acpi_battery_mutex_lock(battery); 788 + mutex_lock(&battery->mutex); 657 789 658 790 result = acpi_battery_update(battery, 1, &update_result); 659 791 if (result) { ··· 685 817 if (!result) 686 818 result = count; 687 819 688 - acpi_battery_mutex_unlock(battery); 820 + mutex_unlock(&battery->mutex); 689 821 690 822 return result; 823 + } 824 + 825 + typedef int(*print_func)(struct seq_file *seq, int result); 826 + typedef int(*get_func)(struct acpi_battery *battery); 827 + 828 + static struct acpi_read_mux { 829 + print_func print; 830 + get_func get; 831 + } acpi_read_funcs[ACPI_BATTERY_NUMFILES] = { 832 + {.get = acpi_battery_get_info, .print = acpi_battery_print_info}, 833 + {.get = acpi_battery_get_state, .print = acpi_battery_print_state}, 834 + {.get = acpi_battery_get_alarm, .print = acpi_battery_print_alarm}, 835 + }; 836 + 837 + static int acpi_battery_read(int fid, struct seq_file *seq) 838 + { 839 + struct acpi_battery *battery = seq->private; 840 + int result = 0; 841 + int update_result = ACPI_BATTERY_NONE_UPDATE; 842 + int update = 0; 843 + 844 + mutex_lock(&battery->mutex); 845 + 846 + update = (get_seconds() - battery->update_time[fid] >= update_time); 847 + update = (update | battery->flags.update[fid]); 848 + 849 + result = acpi_battery_update(battery, update, &update_result); 850 + if (result) 851 + goto end; 852 + 853 + if (update_result == ACPI_BATTERY_EASY_UPDATE) { 854 + result = acpi_read_funcs[fid].get(battery); 855 + if (result) 856 + goto end; 857 + } 858 + 859 + end: 860 + result = acpi_read_funcs[fid].print(seq, result); 861 + acpi_battery_check_result(battery, result); 862 + battery->flags.update[fid] = result; 863 + mutex_unlock(&battery->mutex); 864 + return result; 865 + } 866 + 867 + static int acpi_battery_read_info(struct seq_file *seq, void *offset) 868 + { 869 + return acpi_battery_read(ACPI_BATTERY_INFO, seq); 870 + } 871 + 872 + static int acpi_battery_read_state(struct seq_file *seq, void *offset) 873 + { 874 + return acpi_battery_read(ACPI_BATTERY_STATE, seq); 875 + } 876 + 877 + static int acpi_battery_read_alarm(struct seq_file *seq, void *offset) 878 + { 879 + return acpi_battery_read(ACPI_BATTERY_ALARM, seq); 880 + } 881 + 882 + static int acpi_battery_info_open_fs(struct inode *inode, struct file *file) 883 + { 884 + return single_open(file, acpi_battery_read_info, PDE(inode)->data); 885 + } 886 + 887 + static int acpi_battery_state_open_fs(struct inode *inode, struct file *file) 888 + { 889 + return single_open(file, acpi_battery_read_state, PDE(inode)->data); 691 890 } 692 891 693 892 static int acpi_battery_alarm_open_fs(struct inode *inode, struct file *file) ··· 762 827 return single_open(file, acpi_battery_read_alarm, PDE(inode)->data); 763 828 } 764 829 765 - static const struct file_operations acpi_battery_info_ops = { 830 + static struct battery_file { 831 + struct file_operations ops; 832 + mode_t mode; 833 + char *name; 834 + } acpi_battery_file[] = { 835 + { 836 + .name = "info", 837 + .mode = S_IRUGO, 838 + .ops = { 766 839 .open = acpi_battery_info_open_fs, 767 840 .read = seq_read, 768 841 .llseek = seq_lseek, 769 842 .release = single_release, 770 843 .owner = THIS_MODULE, 771 - }; 772 - 773 - static const struct file_operations acpi_battery_state_ops = { 844 + }, 845 + }, 846 + { 847 + .name = "state", 848 + .mode = S_IRUGO, 849 + .ops = { 774 850 .open = acpi_battery_state_open_fs, 775 851 .read = seq_read, 776 852 .llseek = seq_lseek, 777 853 .release = single_release, 778 854 .owner = THIS_MODULE, 779 - }; 780 - 781 - static const struct file_operations acpi_battery_alarm_ops = { 855 + }, 856 + }, 857 + { 858 + .name = "alarm", 859 + .mode = S_IFREG | S_IRUGO | S_IWUSR, 860 + .ops = { 782 861 .open = acpi_battery_alarm_open_fs, 783 862 .read = seq_read, 784 863 .write = acpi_battery_write_alarm, 785 864 .llseek = seq_lseek, 786 865 .release = single_release, 787 866 .owner = THIS_MODULE, 867 + }, 868 + }, 788 869 }; 789 870 790 871 static int acpi_battery_add_fs(struct acpi_device *device) 791 872 { 792 873 struct proc_dir_entry *entry = NULL; 874 + int i; 793 875 794 876 if (!acpi_device_dir(device)) { 795 877 acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), ··· 816 864 acpi_device_dir(device)->owner = THIS_MODULE; 817 865 } 818 866 819 - /* 'info' [R] */ 820 - entry = create_proc_entry(ACPI_BATTERY_FILE_INFO, 821 - S_IRUGO, acpi_device_dir(device)); 822 - if (!entry) 823 - return -ENODEV; 824 - else { 825 - entry->proc_fops = &acpi_battery_info_ops; 826 - entry->data = acpi_driver_data(device); 827 - entry->owner = THIS_MODULE; 828 - } 829 - 830 - /* 'status' [R] */ 831 - entry = create_proc_entry(ACPI_BATTERY_FILE_STATE, 832 - S_IRUGO, acpi_device_dir(device)); 833 - if (!entry) 834 - return -ENODEV; 835 - else { 836 - entry->proc_fops = &acpi_battery_state_ops; 837 - entry->data = acpi_driver_data(device); 838 - entry->owner = THIS_MODULE; 839 - } 840 - 841 - /* 'alarm' [R/W] */ 842 - entry = create_proc_entry(ACPI_BATTERY_FILE_ALARM, 843 - S_IFREG | S_IRUGO | S_IWUSR, 844 - acpi_device_dir(device)); 845 - if (!entry) 846 - return -ENODEV; 847 - else { 848 - entry->proc_fops = &acpi_battery_alarm_ops; 849 - entry->data = acpi_driver_data(device); 850 - entry->owner = THIS_MODULE; 867 + for (i = 0; i < ACPI_BATTERY_NUMFILES; ++i) { 868 + entry = create_proc_entry(acpi_battery_file[i].name, 869 + acpi_battery_file[i].mode, acpi_device_dir(device)); 870 + if (!entry) 871 + return -ENODEV; 872 + else { 873 + entry->proc_fops = &acpi_battery_file[i].ops; 874 + entry->data = acpi_driver_data(device); 875 + entry->owner = THIS_MODULE; 876 + } 851 877 } 852 878 853 879 return 0; ··· 833 903 834 904 static int acpi_battery_remove_fs(struct acpi_device *device) 835 905 { 906 + int i; 836 907 if (acpi_device_dir(device)) { 837 - remove_proc_entry(ACPI_BATTERY_FILE_ALARM, 908 + for (i = 0; i < ACPI_BATTERY_NUMFILES; ++i) { 909 + remove_proc_entry(acpi_battery_file[i].name, 838 910 acpi_device_dir(device)); 839 - remove_proc_entry(ACPI_BATTERY_FILE_STATE, 840 - acpi_device_dir(device)); 841 - remove_proc_entry(ACPI_BATTERY_FILE_INFO, 842 - acpi_device_dir(device)); 843 - 911 + } 844 912 remove_proc_entry(acpi_device_bid(device), acpi_battery_dir); 845 913 acpi_device_dir(device) = NULL; 846 914 } ··· 894 966 895 967 mutex_init(&battery->mutex); 896 968 897 - acpi_battery_mutex_lock(battery); 969 + mutex_lock(&battery->mutex); 898 970 899 971 battery->device = device; 900 972 strcpy(acpi_device_name(device), ACPI_BATTERY_DEVICE_NAME); ··· 905 977 if (result) 906 978 goto end; 907 979 908 - acpi_battery_init_update_flag(battery) = 1; 980 + battery->flags.init_update = 1; 909 981 910 982 result = acpi_battery_add_fs(device); 911 983 if (result) ··· 931 1003 kfree(battery); 932 1004 } 933 1005 934 - acpi_battery_mutex_unlock(battery); 1006 + mutex_unlock(&battery->mutex); 935 1007 936 1008 return result; 937 1009 } ··· 946 1018 947 1019 battery = acpi_driver_data(device); 948 1020 949 - acpi_battery_mutex_lock(battery); 1021 + mutex_lock(&battery->mutex); 950 1022 951 1023 status = acpi_remove_notify_handler(device->handle, 952 1024 ACPI_ALL_NOTIFY, ··· 954 1026 955 1027 acpi_battery_remove_fs(device); 956 1028 957 - if (battery->bif_data.pointer) 958 - kfree(battery->bif_data.pointer); 1029 + kfree(battery->bif_data.pointer); 959 1030 960 - if (battery->bst_data.pointer) 961 - kfree(battery->bst_data.pointer); 1031 + kfree(battery->bst_data.pointer); 962 1032 963 - acpi_battery_mutex_unlock(battery); 1033 + mutex_unlock(&battery->mutex); 964 1034 965 1035 mutex_destroy(&battery->mutex); 966 1036 ··· 977 1051 978 1052 battery = device->driver_data; 979 1053 980 - acpi_battery_init_update_flag(battery) = 1; 1054 + battery->flags.init_update = 1; 981 1055 982 1056 return 0; 983 1057 }