ACPI: ec: Lindent once again

Signed-off-by: Len Brown <len.brown@intel.com>

authored by Alexey Starikovskiy and committed by Len Brown 6ccedb10 3261ff4d

+76 -95
+76 -95
drivers/acpi/ec.c
··· 45 45 #define ACPI_EC_DRIVER_NAME "ACPI Embedded Controller Driver" 46 46 #define ACPI_EC_DEVICE_NAME "Embedded Controller" 47 47 #define ACPI_EC_FILE_INFO "info" 48 - 49 48 #undef PREFIX 50 49 #define PREFIX "ACPI: EC: " 51 - 52 50 /* EC status register */ 53 51 #define ACPI_EC_FLAG_OBF 0x01 /* Output buffer full */ 54 52 #define ACPI_EC_FLAG_IBF 0x02 /* Input buffer full */ 55 53 #define ACPI_EC_FLAG_BURST 0x10 /* burst mode */ 56 54 #define ACPI_EC_FLAG_SCI 0x20 /* EC-SCI occurred */ 57 - 58 55 /* EC commands */ 59 56 enum ec_command { 60 - ACPI_EC_COMMAND_READ = 0x80, 61 - ACPI_EC_COMMAND_WRITE = 0x81, 62 - ACPI_EC_BURST_ENABLE = 0x82, 63 - ACPI_EC_BURST_DISABLE = 0x83, 64 - ACPI_EC_COMMAND_QUERY = 0x84, 57 + ACPI_EC_COMMAND_READ = 0x80, 58 + ACPI_EC_COMMAND_WRITE = 0x81, 59 + ACPI_EC_BURST_ENABLE = 0x82, 60 + ACPI_EC_BURST_DISABLE = 0x83, 61 + ACPI_EC_COMMAND_QUERY = 0x84, 65 62 }; 66 63 /* EC events */ 67 64 enum ec_event { 68 65 ACPI_EC_EVENT_OBF_1 = 1, /* Output buffer full */ 69 - ACPI_EC_EVENT_IBF_0, /* Input buffer empty */ 66 + ACPI_EC_EVENT_IBF_0, /* Input buffer empty */ 70 67 }; 71 68 72 69 #define ACPI_EC_DELAY 500 /* Wait 500ms max. during EC ops */ 73 70 #define ACPI_EC_UDELAY_GLK 1000 /* Wait 1ms max. to get global lock */ 74 71 75 72 static enum ec_mode { 76 - EC_INTR = 1, /* Output buffer full */ 77 - EC_POLL, /* Input buffer empty */ 73 + EC_INTR = 1, /* Output buffer full */ 74 + EC_POLL, /* Input buffer empty */ 78 75 } acpi_ec_mode = EC_INTR; 79 76 80 77 static int acpi_ec_remove(struct acpi_device *device, int type); ··· 164 167 } else { 165 168 printk(KERN_ERR PREFIX "acpi_ec_wait timeout," 166 169 " status = %d, expect_event = %d\n", 167 - acpi_ec_read_status(ec), event); 170 + acpi_ec_read_status(ec), event); 168 171 } 169 172 } 170 173 ··· 181 184 u8 tmp = 0; 182 185 u8 status = 0; 183 186 184 - 185 187 status = acpi_ec_read_status(ec); 186 188 if (status != -EINVAL && !(status & ACPI_EC_FLAG_BURST)) { 187 189 status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0); ··· 196 200 197 201 atomic_set(&ec->leaving_burst, 0); 198 202 return 0; 199 - end: 203 + end: 200 204 ACPI_EXCEPTION((AE_INFO, status, "EC wait, burst mode")); 201 205 return -1; 202 206 } ··· 205 209 { 206 210 u8 status = 0; 207 211 208 - 209 212 status = acpi_ec_read_status(ec); 210 - if (status != -EINVAL && (status & ACPI_EC_FLAG_BURST)){ 213 + if (status != -EINVAL && (status & ACPI_EC_FLAG_BURST)) { 211 214 status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0); 212 - if(status) 215 + if (status) 213 216 goto end; 214 217 acpi_ec_write_cmd(ec, ACPI_EC_BURST_DISABLE); 215 218 acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0); 216 219 } 217 220 atomic_set(&ec->leaving_burst, 1); 218 221 return 0; 219 - end: 222 + end: 220 223 ACPI_EXCEPTION((AE_INFO, status, "EC leave burst mode")); 221 224 return -1; 222 225 } 223 - #endif /* ACPI_FUTURE_USAGE */ 226 + #endif /* ACPI_FUTURE_USAGE */ 224 227 225 228 static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command, 226 - const u8 *wdata, unsigned wdata_len, 227 - u8 *rdata, unsigned rdata_len) 229 + const u8 * wdata, unsigned wdata_len, 230 + u8 * rdata, unsigned rdata_len) 228 231 { 229 232 int result = 0; 230 233 ··· 232 237 for (; wdata_len > 0; --wdata_len) { 233 238 result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0); 234 239 if (result) { 235 - printk(KERN_ERR PREFIX "write_cmd timeout, command = %d\n", 236 - command); 240 + printk(KERN_ERR PREFIX 241 + "write_cmd timeout, command = %d\n", command); 237 242 goto end; 238 243 } 239 244 acpi_ec_write_data(ec, *(wdata++)); ··· 242 247 if (!rdata_len) { 243 248 result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0); 244 249 if (result) { 245 - printk(KERN_ERR PREFIX "finish-write timeout, command = %d\n", 246 - command); 250 + printk(KERN_ERR PREFIX 251 + "finish-write timeout, command = %d\n", command); 247 252 goto end; 248 253 } 249 254 } else if (command == ACPI_EC_COMMAND_QUERY) { ··· 254 259 result = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF_1); 255 260 if (result) { 256 261 printk(KERN_ERR PREFIX "read timeout, command = %d\n", 257 - command); 262 + command); 258 263 goto end; 259 264 } 260 265 ··· 265 270 } 266 271 267 272 static int acpi_ec_transaction(struct acpi_ec *ec, u8 command, 268 - const u8 *wdata, unsigned wdata_len, 269 - u8 *rdata, unsigned rdata_len) 273 + const u8 * wdata, unsigned wdata_len, 274 + u8 * rdata, unsigned rdata_len) 270 275 { 271 276 int status; 272 277 u32 glk; ··· 274 279 if (!ec || (wdata_len && !wdata) || (rdata_len && !rdata)) 275 280 return -EINVAL; 276 281 277 - if (rdata) 278 - memset(rdata, 0, rdata_len); 282 + if (rdata) 283 + memset(rdata, 0, rdata_len); 279 284 280 285 mutex_lock(&ec->lock); 281 286 if (ec->global_lock) { ··· 289 294 290 295 status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0); 291 296 if (status) { 292 - printk(KERN_DEBUG PREFIX "read EC, IB not empty\n"); 297 + printk(KERN_DEBUG PREFIX 298 + "input buffer is not empty, aborting transaction\n"); 293 299 goto end; 294 300 } 295 301 296 - status = acpi_ec_transaction_unlocked(ec, command, 297 - wdata, wdata_len, 298 - rdata, rdata_len); 302 + status = acpi_ec_transaction_unlocked(ec, command, 303 + wdata, wdata_len, 304 + rdata, rdata_len); 299 305 300 - end: 306 + end: 301 307 302 308 if (ec->global_lock) 303 309 acpi_release_global_lock(glk); ··· 307 311 return status; 308 312 } 309 313 310 - static int acpi_ec_read(struct acpi_ec *ec, u8 address, u8 *data) 314 + static int acpi_ec_read(struct acpi_ec *ec, u8 address, u8 * data) 311 315 { 312 316 int result; 313 317 u8 d; ··· 320 324 321 325 static int acpi_ec_write(struct acpi_ec *ec, u8 address, u8 data) 322 326 { 323 - u8 wdata[2] = { address, data }; 324 - return acpi_ec_transaction(ec, ACPI_EC_COMMAND_WRITE, 327 + u8 wdata[2] = { address, data }; 328 + return acpi_ec_transaction(ec, ACPI_EC_COMMAND_WRITE, 325 329 wdata, 2, NULL, 0); 326 330 } 327 331 328 332 /* 329 333 * Externally callable EC access functions. For now, assume 1 EC only 330 334 */ 331 - int ec_read(u8 addr, u8 *val) 335 + int ec_read(u8 addr, u8 * val) 332 336 { 333 337 struct acpi_ec *ec; 334 338 int err; ··· 368 372 EXPORT_SYMBOL(ec_write); 369 373 370 374 extern int ec_transaction(u8 command, 371 - const u8 *wdata, unsigned wdata_len, 372 - u8 *rdata, unsigned rdata_len) 375 + const u8 * wdata, unsigned wdata_len, 376 + u8 * rdata, unsigned rdata_len) 373 377 { 374 378 struct acpi_ec *ec; 375 379 ··· 384 388 385 389 EXPORT_SYMBOL(ec_transaction); 386 390 387 - static int acpi_ec_query(struct acpi_ec *ec, u8 *data) 391 + static int acpi_ec_query(struct acpi_ec *ec, u8 * data) 388 392 { 389 393 int result; 390 - u8 d; 394 + u8 d; 391 395 392 - if (!ec || !data) 393 - return -EINVAL; 396 + if (!ec || !data) 397 + return -EINVAL; 394 398 395 - /* 396 - * Query the EC to find out which _Qxx method we need to evaluate. 397 - * Note that successful completion of the query causes the ACPI_EC_SCI 398 - * bit to be cleared (and thus clearing the interrupt source). 399 - */ 399 + /* 400 + * Query the EC to find out which _Qxx method we need to evaluate. 401 + * Note that successful completion of the query causes the ACPI_EC_SCI 402 + * bit to be cleared (and thus clearing the interrupt source). 403 + */ 400 404 401 - result = acpi_ec_transaction(ec, ACPI_EC_COMMAND_QUERY, NULL, 0, &d, 1); 402 - if (result) 403 - return result; 405 + result = acpi_ec_transaction(ec, ACPI_EC_COMMAND_QUERY, NULL, 0, &d, 1); 406 + if (result) 407 + return result; 404 408 405 - if (!d) 406 - return -ENODATA; 409 + if (!d) 410 + return -ENODATA; 407 411 408 - *data = d; 409 - return 0; 412 + *data = d; 413 + return 0; 410 414 } 411 415 412 416 /* -------------------------------------------------------------------------- ··· 435 439 u8 value; 436 440 struct acpi_ec *ec = (struct acpi_ec *)data; 437 441 438 - 439 442 if (acpi_ec_mode == EC_INTR) { 440 443 wake_up(&ec->wait); 441 444 } ··· 442 447 value = acpi_ec_read_status(ec); 443 448 if ((value & ACPI_EC_FLAG_SCI) && !atomic_read(&ec->query_pending)) { 444 449 atomic_set(&ec->query_pending, 1); 445 - status = acpi_os_execute(OSL_EC_BURST_HANDLER, acpi_ec_gpe_query, ec); 450 + status = 451 + acpi_os_execute(OSL_EC_BURST_HANDLER, acpi_ec_gpe_query, 452 + ec); 446 453 } 447 454 448 455 return status == AE_OK ? ··· 482 485 acpi_integer f_v = 0; 483 486 int i = 0; 484 487 485 - 486 488 if ((address > 0xFF) || !value || !handler_context) 487 489 return AE_BAD_PARAMETER; 488 490 ··· 495 499 switch (function) { 496 500 case ACPI_READ: 497 501 temp = 0; 498 - result = acpi_ec_read(ec, (u8) address, (u8 *) &temp); 502 + result = acpi_ec_read(ec, (u8) address, (u8 *) & temp); 499 503 break; 500 504 case ACPI_WRITE: 501 505 result = acpi_ec_write(ec, (u8) address, (u8) temp); ··· 548 552 { 549 553 struct acpi_ec *ec = (struct acpi_ec *)seq->private; 550 554 551 - 552 555 if (!ec) 553 556 goto end; 554 557 555 - seq_printf(seq, "gpe: 0x%02x\n", 556 - (u32) ec->gpe); 558 + seq_printf(seq, "gpe: 0x%02x\n", (u32) ec->gpe); 557 559 seq_printf(seq, "ports: 0x%02x, 0x%02x\n", 558 - (u32) ec->command_addr, 559 - (u32) ec->data_addr); 560 + (u32) ec->command_addr, (u32) ec->data_addr); 560 561 seq_printf(seq, "use global lock: %s\n", 561 562 ec->global_lock ? "yes" : "no"); 562 563 acpi_enable_gpe(NULL, ec->gpe, ACPI_NOT_ISR); ··· 578 585 static int acpi_ec_add_fs(struct acpi_device *device) 579 586 { 580 587 struct proc_dir_entry *entry = NULL; 581 - 582 588 583 589 if (!acpi_device_dir(device)) { 584 590 acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), ··· 621 629 acpi_status status = AE_OK; 622 630 struct acpi_ec *ec = NULL; 623 631 624 - 625 632 if (!device) 626 633 return -EINVAL; 627 634 ··· 642 651 acpi_driver_data(device) = ec; 643 652 644 653 /* Use the global lock for all EC transactions? */ 645 - acpi_evaluate_integer(ec->handle, "_GLK", NULL, 646 - &ec->global_lock); 654 + acpi_evaluate_integer(ec->handle, "_GLK", NULL, &ec->global_lock); 647 655 648 656 /* XXX we don't test uids, because on some boxes ecdt uid = 0, see: 649 657 http://bugzilla.kernel.org/show_bug.cgi?id=6111 */ ··· 659 669 660 670 /* Get GPE bit assignment (EC events). */ 661 671 /* TODO: Add support for _GPE returning a package */ 662 - status = 663 - acpi_evaluate_integer(ec->handle, "_GPE", NULL, 664 - &ec->gpe); 672 + status = acpi_evaluate_integer(ec->handle, "_GPE", NULL, &ec->gpe); 665 673 if (ACPI_FAILURE(status)) { 666 - ACPI_EXCEPTION((AE_INFO, status, "Obtaining GPE bit assignment")); 674 + ACPI_EXCEPTION((AE_INFO, status, 675 + "Obtaining GPE bit assignment")); 667 676 result = -ENODEV; 668 677 goto end; 669 678 } ··· 672 683 goto end; 673 684 674 685 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "%s [%s] (gpe %d) interrupt mode.", 675 - acpi_device_name(device), acpi_device_bid(device), 676 - (u32) ec->gpe)); 686 + acpi_device_name(device), acpi_device_bid(device), 687 + (u32) ec->gpe)); 677 688 678 689 if (!first_ec) 679 690 first_ec = device; 680 691 681 - end: 692 + end: 682 693 if (result) 683 694 kfree(ec); 684 695 ··· 688 699 static int acpi_ec_remove(struct acpi_device *device, int type) 689 700 { 690 701 struct acpi_ec *ec = NULL; 691 - 692 702 693 703 if (!device) 694 704 return -EINVAL; ··· 731 743 acpi_status status = AE_OK; 732 744 struct acpi_ec *ec = NULL; 733 745 734 - 735 746 if (!device) 736 747 return -EINVAL; 737 748 ··· 770 783 &acpi_ec_space_handler, 771 784 &acpi_ec_space_setup, ec); 772 785 if (ACPI_FAILURE(status)) { 773 - acpi_remove_gpe_handler(NULL, ec->gpe, 774 - &acpi_ec_gpe_handler); 786 + acpi_remove_gpe_handler(NULL, ec->gpe, &acpi_ec_gpe_handler); 775 787 return -ENODEV; 776 788 } 777 789 ··· 781 795 { 782 796 acpi_status status = AE_OK; 783 797 struct acpi_ec *ec = NULL; 784 - 785 798 786 799 if (!device) 787 800 return -EINVAL; ··· 793 808 if (ACPI_FAILURE(status)) 794 809 return -ENODEV; 795 810 796 - status = 797 - acpi_remove_gpe_handler(NULL, ec->gpe, 798 - &acpi_ec_gpe_handler); 811 + status = acpi_remove_gpe_handler(NULL, ec->gpe, &acpi_ec_gpe_handler); 799 812 if (ACPI_FAILURE(status)) 800 813 return -ENODEV; 801 814 ··· 818 835 ec_ecdt->uid = -1; 819 836 acpi_evaluate_integer(handle, "_UID", NULL, &ec_ecdt->uid); 820 837 821 - status = 822 - acpi_evaluate_integer(handle, "_GPE", NULL, 823 - &ec_ecdt->gpe); 838 + status = acpi_evaluate_integer(handle, "_GPE", NULL, &ec_ecdt->gpe); 824 839 if (ACPI_FAILURE(status)) 825 840 return status; 826 841 ec_ecdt->global_lock = TRUE; 827 842 ec_ecdt->handle = handle; 828 843 829 844 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "GPE=0x%02lx, ports=0x%2lx, 0x%2lx", 830 - ec_ecdt->gpe, ec_ecdt->command_addr, ec_ecdt->data_addr)); 845 + ec_ecdt->gpe, ec_ecdt->command_addr, 846 + ec_ecdt->data_addr)); 831 847 832 848 return AE_CTRL_TERMINATE; 833 849 } ··· 865 883 goto error; 866 884 } 867 885 return 0; 868 - error: 886 + error: 869 887 return ret; 870 888 } 871 889 ··· 901 919 ec_ecdt->global_lock = TRUE; 902 920 ec_ecdt->uid = ecdt_ptr->uid; 903 921 904 - status = 905 - acpi_get_handle(NULL, ecdt_ptr->ec_id, &ec_ecdt->handle); 922 + status = acpi_get_handle(NULL, ecdt_ptr->ec_id, &ec_ecdt->handle); 906 923 if (ACPI_FAILURE(status)) { 907 924 goto error; 908 925 } 909 926 910 927 return 0; 911 - error: 928 + error: 912 929 ACPI_EXCEPTION((AE_INFO, status, "Could not use ECDT")); 913 930 kfree(ec_ecdt); 914 931 ec_ecdt = NULL; ··· 967 986 { 968 987 int result = 0; 969 988 970 - 971 989 if (acpi_disabled) 972 990 return 0; 973 991 ··· 1019 1039 acpi_ec_mode = EC_POLL; 1020 1040 } 1021 1041 acpi_ec_driver.ops.add = acpi_ec_add; 1022 - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "EC %s mode.\n", intr ? "interrupt" : "polling")); 1042 + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "EC %s mode.\n", 1043 + intr ? "interrupt" : "polling")); 1023 1044 1024 1045 return 1; 1025 1046 }