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