diff options
Diffstat (limited to 'drivers/acpi/ec.c')
-rw-r--r-- | drivers/acpi/ec.c | 146 |
1 files changed, 62 insertions, 84 deletions
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index 0bba8783de55..874f912962c4 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
@@ -207,7 +207,6 @@ static int acpi_ec_intr_wait(union acpi_ec *ec, unsigned int event) | |||
207 | { | 207 | { |
208 | int result = 0; | 208 | int result = 0; |
209 | 209 | ||
210 | ACPI_FUNCTION_TRACE("acpi_ec_wait"); | ||
211 | 210 | ||
212 | ec->intr.expect_event = event; | 211 | ec->intr.expect_event = event; |
213 | smp_mb(); | 212 | smp_mb(); |
@@ -216,7 +215,7 @@ static int acpi_ec_intr_wait(union acpi_ec *ec, unsigned int event) | |||
216 | case ACPI_EC_EVENT_IBE: | 215 | case ACPI_EC_EVENT_IBE: |
217 | if (~acpi_ec_read_status(ec) & event) { | 216 | if (~acpi_ec_read_status(ec) & event) { |
218 | ec->intr.expect_event = 0; | 217 | ec->intr.expect_event = 0; |
219 | return_VALUE(0); | 218 | return 0; |
220 | } | 219 | } |
221 | break; | 220 | break; |
222 | default: | 221 | default: |
@@ -238,16 +237,16 @@ static int acpi_ec_intr_wait(union acpi_ec *ec, unsigned int event) | |||
238 | switch (event) { | 237 | switch (event) { |
239 | case ACPI_EC_EVENT_OBF: | 238 | case ACPI_EC_EVENT_OBF: |
240 | if (acpi_ec_read_status(ec) & ACPI_EC_FLAG_OBF) | 239 | if (acpi_ec_read_status(ec) & ACPI_EC_FLAG_OBF) |
241 | return_VALUE(0); | 240 | return 0; |
242 | break; | 241 | break; |
243 | 242 | ||
244 | case ACPI_EC_EVENT_IBE: | 243 | case ACPI_EC_EVENT_IBE: |
245 | if (~acpi_ec_read_status(ec) & ACPI_EC_FLAG_IBF) | 244 | if (~acpi_ec_read_status(ec) & ACPI_EC_FLAG_IBF) |
246 | return_VALUE(0); | 245 | return 0; |
247 | break; | 246 | break; |
248 | } | 247 | } |
249 | 248 | ||
250 | return_VALUE(-ETIME); | 249 | return -ETIME; |
251 | } | 250 | } |
252 | 251 | ||
253 | #ifdef ACPI_FUTURE_USAGE | 252 | #ifdef ACPI_FUTURE_USAGE |
@@ -260,7 +259,6 @@ int acpi_ec_enter_burst_mode(union acpi_ec *ec) | |||
260 | u32 tmp = 0; | 259 | u32 tmp = 0; |
261 | int status = 0; | 260 | int status = 0; |
262 | 261 | ||
263 | ACPI_FUNCTION_TRACE("acpi_ec_enter_burst_mode"); | ||
264 | 262 | ||
265 | status = acpi_ec_read_status(ec); | 263 | status = acpi_ec_read_status(ec); |
266 | if (status != -EINVAL && !(status & ACPI_EC_FLAG_BURST)) { | 264 | if (status != -EINVAL && !(status & ACPI_EC_FLAG_BURST)) { |
@@ -272,22 +270,21 @@ int acpi_ec_enter_burst_mode(union acpi_ec *ec) | |||
272 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); | 270 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); |
273 | acpi_hw_low_level_read(8, &tmp, &ec->common.data_addr); | 271 | acpi_hw_low_level_read(8, &tmp, &ec->common.data_addr); |
274 | if (tmp != 0x90) { /* Burst ACK byte */ | 272 | if (tmp != 0x90) { /* Burst ACK byte */ |
275 | return_VALUE(-EINVAL); | 273 | return -EINVAL; |
276 | } | 274 | } |
277 | } | 275 | } |
278 | 276 | ||
279 | atomic_set(&ec->intr.leaving_burst, 0); | 277 | atomic_set(&ec->intr.leaving_burst, 0); |
280 | return_VALUE(0); | 278 | return 0; |
281 | end: | 279 | end: |
282 | ACPI_EXCEPTION ((AE_INFO, status, "EC wait, burst mode"); | 280 | ACPI_EXCEPTION ((AE_INFO, status, "EC wait, burst mode"); |
283 | return_VALUE(-1); | 281 | return -1; |
284 | } | 282 | } |
285 | 283 | ||
286 | int acpi_ec_leave_burst_mode(union acpi_ec *ec) | 284 | int acpi_ec_leave_burst_mode(union acpi_ec *ec) |
287 | { | 285 | { |
288 | int status = 0; | 286 | int status = 0; |
289 | 287 | ||
290 | ACPI_FUNCTION_TRACE("acpi_ec_leave_burst_mode"); | ||
291 | 288 | ||
292 | status = acpi_ec_read_status(ec); | 289 | status = acpi_ec_read_status(ec); |
293 | if (status != -EINVAL && (status & ACPI_EC_FLAG_BURST)){ | 290 | if (status != -EINVAL && (status & ACPI_EC_FLAG_BURST)){ |
@@ -298,10 +295,10 @@ int acpi_ec_leave_burst_mode(union acpi_ec *ec) | |||
298 | acpi_ec_wait(ec, ACPI_EC_FLAG_IBF); | 295 | acpi_ec_wait(ec, ACPI_EC_FLAG_IBF); |
299 | } | 296 | } |
300 | atomic_set(&ec->intr.leaving_burst, 1); | 297 | atomic_set(&ec->intr.leaving_burst, 1); |
301 | return_VALUE(0); | 298 | return 0; |
302 | end: | 299 | end: |
303 | ACPI_EXCEPTION((AE_INFO, status, "EC leave burst mode"); | 300 | ACPI_EXCEPTION((AE_INFO, status, "EC leave burst mode"); |
304 | return_VALUE(-1); | 301 | return -1; |
305 | } | 302 | } |
306 | #endif /* ACPI_FUTURE_USAGE */ | 303 | #endif /* ACPI_FUTURE_USAGE */ |
307 | 304 | ||
@@ -325,17 +322,16 @@ static int acpi_ec_poll_read(union acpi_ec *ec, u8 address, u32 * data) | |||
325 | int result = 0; | 322 | int result = 0; |
326 | u32 glk = 0; | 323 | u32 glk = 0; |
327 | 324 | ||
328 | ACPI_FUNCTION_TRACE("acpi_ec_read"); | ||
329 | 325 | ||
330 | if (!ec || !data) | 326 | if (!ec || !data) |
331 | return_VALUE(-EINVAL); | 327 | return -EINVAL; |
332 | 328 | ||
333 | *data = 0; | 329 | *data = 0; |
334 | 330 | ||
335 | if (ec->common.global_lock) { | 331 | if (ec->common.global_lock) { |
336 | status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); | 332 | status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); |
337 | if (ACPI_FAILURE(status)) | 333 | if (ACPI_FAILURE(status)) |
338 | return_VALUE(-ENODEV); | 334 | return -ENODEV; |
339 | } | 335 | } |
340 | 336 | ||
341 | if (down_interruptible(&ec->poll.sem)) { | 337 | if (down_interruptible(&ec->poll.sem)) { |
@@ -365,7 +361,7 @@ end_nosem: | |||
365 | if (ec->common.global_lock) | 361 | if (ec->common.global_lock) |
366 | acpi_release_global_lock(glk); | 362 | acpi_release_global_lock(glk); |
367 | 363 | ||
368 | return_VALUE(result); | 364 | return result; |
369 | } | 365 | } |
370 | 366 | ||
371 | static int acpi_ec_poll_write(union acpi_ec *ec, u8 address, u8 data) | 367 | static int acpi_ec_poll_write(union acpi_ec *ec, u8 address, u8 data) |
@@ -374,15 +370,14 @@ static int acpi_ec_poll_write(union acpi_ec *ec, u8 address, u8 data) | |||
374 | acpi_status status = AE_OK; | 370 | acpi_status status = AE_OK; |
375 | u32 glk = 0; | 371 | u32 glk = 0; |
376 | 372 | ||
377 | ACPI_FUNCTION_TRACE("acpi_ec_write"); | ||
378 | 373 | ||
379 | if (!ec) | 374 | if (!ec) |
380 | return_VALUE(-EINVAL); | 375 | return -EINVAL; |
381 | 376 | ||
382 | if (ec->common.global_lock) { | 377 | if (ec->common.global_lock) { |
383 | status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); | 378 | status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); |
384 | if (ACPI_FAILURE(status)) | 379 | if (ACPI_FAILURE(status)) |
385 | return_VALUE(-ENODEV); | 380 | return -ENODEV; |
386 | } | 381 | } |
387 | 382 | ||
388 | if (down_interruptible(&ec->poll.sem)) { | 383 | if (down_interruptible(&ec->poll.sem)) { |
@@ -415,7 +410,7 @@ end_nosem: | |||
415 | if (ec->common.global_lock) | 410 | if (ec->common.global_lock) |
416 | acpi_release_global_lock(glk); | 411 | acpi_release_global_lock(glk); |
417 | 412 | ||
418 | return_VALUE(result); | 413 | return result; |
419 | } | 414 | } |
420 | 415 | ||
421 | static int acpi_ec_intr_read(union acpi_ec *ec, u8 address, u32 * data) | 416 | static int acpi_ec_intr_read(union acpi_ec *ec, u8 address, u32 * data) |
@@ -423,17 +418,16 @@ static int acpi_ec_intr_read(union acpi_ec *ec, u8 address, u32 * data) | |||
423 | int status = 0; | 418 | int status = 0; |
424 | u32 glk; | 419 | u32 glk; |
425 | 420 | ||
426 | ACPI_FUNCTION_TRACE("acpi_ec_read"); | ||
427 | 421 | ||
428 | if (!ec || !data) | 422 | if (!ec || !data) |
429 | return_VALUE(-EINVAL); | 423 | return -EINVAL; |
430 | 424 | ||
431 | *data = 0; | 425 | *data = 0; |
432 | 426 | ||
433 | if (ec->common.global_lock) { | 427 | if (ec->common.global_lock) { |
434 | status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); | 428 | status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); |
435 | if (ACPI_FAILURE(status)) | 429 | if (ACPI_FAILURE(status)) |
436 | return_VALUE(-ENODEV); | 430 | return -ENODEV; |
437 | } | 431 | } |
438 | 432 | ||
439 | WARN_ON(in_interrupt()); | 433 | WARN_ON(in_interrupt()); |
@@ -467,7 +461,7 @@ static int acpi_ec_intr_read(union acpi_ec *ec, u8 address, u32 * data) | |||
467 | if (ec->common.global_lock) | 461 | if (ec->common.global_lock) |
468 | acpi_release_global_lock(glk); | 462 | acpi_release_global_lock(glk); |
469 | 463 | ||
470 | return_VALUE(status); | 464 | return status; |
471 | } | 465 | } |
472 | 466 | ||
473 | static int acpi_ec_intr_write(union acpi_ec *ec, u8 address, u8 data) | 467 | static int acpi_ec_intr_write(union acpi_ec *ec, u8 address, u8 data) |
@@ -475,15 +469,14 @@ static int acpi_ec_intr_write(union acpi_ec *ec, u8 address, u8 data) | |||
475 | int status = 0; | 469 | int status = 0; |
476 | u32 glk; | 470 | u32 glk; |
477 | 471 | ||
478 | ACPI_FUNCTION_TRACE("acpi_ec_write"); | ||
479 | 472 | ||
480 | if (!ec) | 473 | if (!ec) |
481 | return_VALUE(-EINVAL); | 474 | return -EINVAL; |
482 | 475 | ||
483 | if (ec->common.global_lock) { | 476 | if (ec->common.global_lock) { |
484 | status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); | 477 | status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); |
485 | if (ACPI_FAILURE(status)) | 478 | if (ACPI_FAILURE(status)) |
486 | return_VALUE(-ENODEV); | 479 | return -ENODEV; |
487 | } | 480 | } |
488 | 481 | ||
489 | WARN_ON(in_interrupt()); | 482 | WARN_ON(in_interrupt()); |
@@ -516,7 +509,7 @@ static int acpi_ec_intr_write(union acpi_ec *ec, u8 address, u8 data) | |||
516 | if (ec->common.global_lock) | 509 | if (ec->common.global_lock) |
517 | acpi_release_global_lock(glk); | 510 | acpi_release_global_lock(glk); |
518 | 511 | ||
519 | return_VALUE(status); | 512 | return status; |
520 | } | 513 | } |
521 | 514 | ||
522 | /* | 515 | /* |
@@ -574,17 +567,16 @@ static int acpi_ec_poll_query(union acpi_ec *ec, u32 * data) | |||
574 | acpi_status status = AE_OK; | 567 | acpi_status status = AE_OK; |
575 | u32 glk = 0; | 568 | u32 glk = 0; |
576 | 569 | ||
577 | ACPI_FUNCTION_TRACE("acpi_ec_query"); | ||
578 | 570 | ||
579 | if (!ec || !data) | 571 | if (!ec || !data) |
580 | return_VALUE(-EINVAL); | 572 | return -EINVAL; |
581 | 573 | ||
582 | *data = 0; | 574 | *data = 0; |
583 | 575 | ||
584 | if (ec->common.global_lock) { | 576 | if (ec->common.global_lock) { |
585 | status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); | 577 | status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); |
586 | if (ACPI_FAILURE(status)) | 578 | if (ACPI_FAILURE(status)) |
587 | return_VALUE(-ENODEV); | 579 | return -ENODEV; |
588 | } | 580 | } |
589 | 581 | ||
590 | /* | 582 | /* |
@@ -613,23 +605,22 @@ end_nosem: | |||
613 | if (ec->common.global_lock) | 605 | if (ec->common.global_lock) |
614 | acpi_release_global_lock(glk); | 606 | acpi_release_global_lock(glk); |
615 | 607 | ||
616 | return_VALUE(result); | 608 | return result; |
617 | } | 609 | } |
618 | static int acpi_ec_intr_query(union acpi_ec *ec, u32 * data) | 610 | static int acpi_ec_intr_query(union acpi_ec *ec, u32 * data) |
619 | { | 611 | { |
620 | int status = 0; | 612 | int status = 0; |
621 | u32 glk; | 613 | u32 glk; |
622 | 614 | ||
623 | ACPI_FUNCTION_TRACE("acpi_ec_query"); | ||
624 | 615 | ||
625 | if (!ec || !data) | 616 | if (!ec || !data) |
626 | return_VALUE(-EINVAL); | 617 | return -EINVAL; |
627 | *data = 0; | 618 | *data = 0; |
628 | 619 | ||
629 | if (ec->common.global_lock) { | 620 | if (ec->common.global_lock) { |
630 | status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); | 621 | status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); |
631 | if (ACPI_FAILURE(status)) | 622 | if (ACPI_FAILURE(status)) |
632 | return_VALUE(-ENODEV); | 623 | return -ENODEV; |
633 | } | 624 | } |
634 | 625 | ||
635 | down(&ec->intr.sem); | 626 | down(&ec->intr.sem); |
@@ -662,7 +653,7 @@ static int acpi_ec_intr_query(union acpi_ec *ec, u32 * data) | |||
662 | if (ec->common.global_lock) | 653 | if (ec->common.global_lock) |
663 | acpi_release_global_lock(glk); | 654 | acpi_release_global_lock(glk); |
664 | 655 | ||
665 | return_VALUE(status); | 656 | return status; |
666 | } | 657 | } |
667 | 658 | ||
668 | /* -------------------------------------------------------------------------- | 659 | /* -------------------------------------------------------------------------- |
@@ -691,13 +682,12 @@ static void acpi_ec_gpe_poll_query(void *ec_cxt) | |||
691 | '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' | 682 | '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' |
692 | }; | 683 | }; |
693 | 684 | ||
694 | ACPI_FUNCTION_TRACE("acpi_ec_gpe_query"); | ||
695 | 685 | ||
696 | if (!ec_cxt) | 686 | if (!ec_cxt) |
697 | goto end; | 687 | goto end; |
698 | 688 | ||
699 | if (down_interruptible (&ec->poll.sem)) { | 689 | if (down_interruptible (&ec->poll.sem)) { |
700 | return_VOID; | 690 | return; |
701 | } | 691 | } |
702 | acpi_hw_low_level_read(8, &value, &ec->common.command_addr); | 692 | acpi_hw_low_level_read(8, &value, &ec->common.command_addr); |
703 | up(&ec->poll.sem); | 693 | up(&ec->poll.sem); |
@@ -734,7 +724,6 @@ static void acpi_ec_gpe_intr_query(void *ec_cxt) | |||
734 | '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' | 724 | '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' |
735 | }; | 725 | }; |
736 | 726 | ||
737 | ACPI_FUNCTION_TRACE("acpi_ec_gpe_query"); | ||
738 | 727 | ||
739 | if (acpi_ec_read_status(ec) & ACPI_EC_FLAG_SCI) | 728 | if (acpi_ec_read_status(ec) & ACPI_EC_FLAG_SCI) |
740 | result = acpi_ec_query(ec, &value); | 729 | result = acpi_ec_query(ec, &value); |
@@ -846,15 +835,14 @@ acpi_ec_space_handler(u32 function, | |||
846 | acpi_integer f_v = 0; | 835 | acpi_integer f_v = 0; |
847 | int i = 0; | 836 | int i = 0; |
848 | 837 | ||
849 | ACPI_FUNCTION_TRACE("acpi_ec_space_handler"); | ||
850 | 838 | ||
851 | if ((address > 0xFF) || !value || !handler_context) | 839 | if ((address > 0xFF) || !value || !handler_context) |
852 | return_VALUE(AE_BAD_PARAMETER); | 840 | return AE_BAD_PARAMETER; |
853 | 841 | ||
854 | if (bit_width != 8 && acpi_strict) { | 842 | if (bit_width != 8 && acpi_strict) { |
855 | printk(KERN_WARNING PREFIX | 843 | printk(KERN_WARNING PREFIX |
856 | "acpi_ec_space_handler: bit_width should be 8\n"); | 844 | "acpi_ec_space_handler: bit_width should be 8\n"); |
857 | return_VALUE(AE_BAD_PARAMETER); | 845 | return AE_BAD_PARAMETER; |
858 | } | 846 | } |
859 | 847 | ||
860 | ec = (union acpi_ec *)handler_context; | 848 | ec = (union acpi_ec *)handler_context; |
@@ -893,16 +881,16 @@ acpi_ec_space_handler(u32 function, | |||
893 | out: | 881 | out: |
894 | switch (result) { | 882 | switch (result) { |
895 | case -EINVAL: | 883 | case -EINVAL: |
896 | return_VALUE(AE_BAD_PARAMETER); | 884 | return AE_BAD_PARAMETER; |
897 | break; | 885 | break; |
898 | case -ENODEV: | 886 | case -ENODEV: |
899 | return_VALUE(AE_NOT_FOUND); | 887 | return AE_NOT_FOUND; |
900 | break; | 888 | break; |
901 | case -ETIME: | 889 | case -ETIME: |
902 | return_VALUE(AE_TIME); | 890 | return AE_TIME; |
903 | break; | 891 | break; |
904 | default: | 892 | default: |
905 | return_VALUE(AE_OK); | 893 | return AE_OK; |
906 | } | 894 | } |
907 | } | 895 | } |
908 | 896 | ||
@@ -916,7 +904,6 @@ static int acpi_ec_read_info(struct seq_file *seq, void *offset) | |||
916 | { | 904 | { |
917 | union acpi_ec *ec = (union acpi_ec *)seq->private; | 905 | union acpi_ec *ec = (union acpi_ec *)seq->private; |
918 | 906 | ||
919 | ACPI_FUNCTION_TRACE("acpi_ec_read_info"); | ||
920 | 907 | ||
921 | if (!ec) | 908 | if (!ec) |
922 | goto end; | 909 | goto end; |
@@ -931,7 +918,7 @@ static int acpi_ec_read_info(struct seq_file *seq, void *offset) | |||
931 | acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); | 918 | acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); |
932 | 919 | ||
933 | end: | 920 | end: |
934 | return_VALUE(0); | 921 | return 0; |
935 | } | 922 | } |
936 | 923 | ||
937 | static int acpi_ec_info_open_fs(struct inode *inode, struct file *file) | 924 | static int acpi_ec_info_open_fs(struct inode *inode, struct file *file) |
@@ -951,31 +938,29 @@ static int acpi_ec_add_fs(struct acpi_device *device) | |||
951 | { | 938 | { |
952 | struct proc_dir_entry *entry = NULL; | 939 | struct proc_dir_entry *entry = NULL; |
953 | 940 | ||
954 | ACPI_FUNCTION_TRACE("acpi_ec_add_fs"); | ||
955 | 941 | ||
956 | if (!acpi_device_dir(device)) { | 942 | if (!acpi_device_dir(device)) { |
957 | acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), | 943 | acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), |
958 | acpi_ec_dir); | 944 | acpi_ec_dir); |
959 | if (!acpi_device_dir(device)) | 945 | if (!acpi_device_dir(device)) |
960 | return_VALUE(-ENODEV); | 946 | return -ENODEV; |
961 | } | 947 | } |
962 | 948 | ||
963 | entry = create_proc_entry(ACPI_EC_FILE_INFO, S_IRUGO, | 949 | entry = create_proc_entry(ACPI_EC_FILE_INFO, S_IRUGO, |
964 | acpi_device_dir(device)); | 950 | acpi_device_dir(device)); |
965 | if (!entry) | 951 | if (!entry) |
966 | return_VALUE(-ENODEV); | 952 | return -ENODEV; |
967 | else { | 953 | else { |
968 | entry->proc_fops = &acpi_ec_info_ops; | 954 | entry->proc_fops = &acpi_ec_info_ops; |
969 | entry->data = acpi_driver_data(device); | 955 | entry->data = acpi_driver_data(device); |
970 | entry->owner = THIS_MODULE; | 956 | entry->owner = THIS_MODULE; |
971 | } | 957 | } |
972 | 958 | ||
973 | return_VALUE(0); | 959 | return 0; |
974 | } | 960 | } |
975 | 961 | ||
976 | static int acpi_ec_remove_fs(struct acpi_device *device) | 962 | static int acpi_ec_remove_fs(struct acpi_device *device) |
977 | { | 963 | { |
978 | ACPI_FUNCTION_TRACE("acpi_ec_remove_fs"); | ||
979 | 964 | ||
980 | if (acpi_device_dir(device)) { | 965 | if (acpi_device_dir(device)) { |
981 | remove_proc_entry(ACPI_EC_FILE_INFO, acpi_device_dir(device)); | 966 | remove_proc_entry(ACPI_EC_FILE_INFO, acpi_device_dir(device)); |
@@ -983,7 +968,7 @@ static int acpi_ec_remove_fs(struct acpi_device *device) | |||
983 | acpi_device_dir(device) = NULL; | 968 | acpi_device_dir(device) = NULL; |
984 | } | 969 | } |
985 | 970 | ||
986 | return_VALUE(0); | 971 | return 0; |
987 | } | 972 | } |
988 | 973 | ||
989 | /* -------------------------------------------------------------------------- | 974 | /* -------------------------------------------------------------------------- |
@@ -996,14 +981,13 @@ static int acpi_ec_poll_add(struct acpi_device *device) | |||
996 | acpi_status status = AE_OK; | 981 | acpi_status status = AE_OK; |
997 | union acpi_ec *ec = NULL; | 982 | union acpi_ec *ec = NULL; |
998 | 983 | ||
999 | ACPI_FUNCTION_TRACE("acpi_ec_add"); | ||
1000 | 984 | ||
1001 | if (!device) | 985 | if (!device) |
1002 | return_VALUE(-EINVAL); | 986 | return -EINVAL; |
1003 | 987 | ||
1004 | ec = kmalloc(sizeof(union acpi_ec), GFP_KERNEL); | 988 | ec = kmalloc(sizeof(union acpi_ec), GFP_KERNEL); |
1005 | if (!ec) | 989 | if (!ec) |
1006 | return_VALUE(-ENOMEM); | 990 | return -ENOMEM; |
1007 | memset(ec, 0, sizeof(union acpi_ec)); | 991 | memset(ec, 0, sizeof(union acpi_ec)); |
1008 | 992 | ||
1009 | ec->common.handle = device->handle; | 993 | ec->common.handle = device->handle; |
@@ -1056,7 +1040,7 @@ static int acpi_ec_poll_add(struct acpi_device *device) | |||
1056 | if (result) | 1040 | if (result) |
1057 | kfree(ec); | 1041 | kfree(ec); |
1058 | 1042 | ||
1059 | return_VALUE(result); | 1043 | return result; |
1060 | } | 1044 | } |
1061 | static int acpi_ec_intr_add(struct acpi_device *device) | 1045 | static int acpi_ec_intr_add(struct acpi_device *device) |
1062 | { | 1046 | { |
@@ -1064,14 +1048,13 @@ static int acpi_ec_intr_add(struct acpi_device *device) | |||
1064 | acpi_status status = AE_OK; | 1048 | acpi_status status = AE_OK; |
1065 | union acpi_ec *ec = NULL; | 1049 | union acpi_ec *ec = NULL; |
1066 | 1050 | ||
1067 | ACPI_FUNCTION_TRACE("acpi_ec_add"); | ||
1068 | 1051 | ||
1069 | if (!device) | 1052 | if (!device) |
1070 | return_VALUE(-EINVAL); | 1053 | return -EINVAL; |
1071 | 1054 | ||
1072 | ec = kmalloc(sizeof(union acpi_ec), GFP_KERNEL); | 1055 | ec = kmalloc(sizeof(union acpi_ec), GFP_KERNEL); |
1073 | if (!ec) | 1056 | if (!ec) |
1074 | return_VALUE(-ENOMEM); | 1057 | return -ENOMEM; |
1075 | memset(ec, 0, sizeof(union acpi_ec)); | 1058 | memset(ec, 0, sizeof(union acpi_ec)); |
1076 | 1059 | ||
1077 | ec->common.handle = device->handle; | 1060 | ec->common.handle = device->handle; |
@@ -1127,17 +1110,16 @@ static int acpi_ec_intr_add(struct acpi_device *device) | |||
1127 | if (result) | 1110 | if (result) |
1128 | kfree(ec); | 1111 | kfree(ec); |
1129 | 1112 | ||
1130 | return_VALUE(result); | 1113 | return result; |
1131 | } | 1114 | } |
1132 | 1115 | ||
1133 | static int acpi_ec_remove(struct acpi_device *device, int type) | 1116 | static int acpi_ec_remove(struct acpi_device *device, int type) |
1134 | { | 1117 | { |
1135 | union acpi_ec *ec = NULL; | 1118 | union acpi_ec *ec = NULL; |
1136 | 1119 | ||
1137 | ACPI_FUNCTION_TRACE("acpi_ec_remove"); | ||
1138 | 1120 | ||
1139 | if (!device) | 1121 | if (!device) |
1140 | return_VALUE(-EINVAL); | 1122 | return -EINVAL; |
1141 | 1123 | ||
1142 | ec = acpi_driver_data(device); | 1124 | ec = acpi_driver_data(device); |
1143 | 1125 | ||
@@ -1145,7 +1127,7 @@ static int acpi_ec_remove(struct acpi_device *device, int type) | |||
1145 | 1127 | ||
1146 | kfree(ec); | 1128 | kfree(ec); |
1147 | 1129 | ||
1148 | return_VALUE(0); | 1130 | return 0; |
1149 | } | 1131 | } |
1150 | 1132 | ||
1151 | static acpi_status | 1133 | static acpi_status |
@@ -1184,15 +1166,14 @@ static int acpi_ec_start(struct acpi_device *device) | |||
1184 | acpi_status status = AE_OK; | 1166 | acpi_status status = AE_OK; |
1185 | union acpi_ec *ec = NULL; | 1167 | union acpi_ec *ec = NULL; |
1186 | 1168 | ||
1187 | ACPI_FUNCTION_TRACE("acpi_ec_start"); | ||
1188 | 1169 | ||
1189 | if (!device) | 1170 | if (!device) |
1190 | return_VALUE(-EINVAL); | 1171 | return -EINVAL; |
1191 | 1172 | ||
1192 | ec = acpi_driver_data(device); | 1173 | ec = acpi_driver_data(device); |
1193 | 1174 | ||
1194 | if (!ec) | 1175 | if (!ec) |
1195 | return_VALUE(-EINVAL); | 1176 | return -EINVAL; |
1196 | 1177 | ||
1197 | /* | 1178 | /* |
1198 | * Get I/O port addresses. Convert to GAS format. | 1179 | * Get I/O port addresses. Convert to GAS format. |
@@ -1202,7 +1183,7 @@ static int acpi_ec_start(struct acpi_device *device) | |||
1202 | if (ACPI_FAILURE(status) | 1183 | if (ACPI_FAILURE(status) |
1203 | || ec->common.command_addr.register_bit_width == 0) { | 1184 | || ec->common.command_addr.register_bit_width == 0) { |
1204 | printk(KERN_ERR PREFIX "Error getting I/O port addresses\n"); | 1185 | printk(KERN_ERR PREFIX "Error getting I/O port addresses\n"); |
1205 | return_VALUE(-ENODEV); | 1186 | return -ENODEV; |
1206 | } | 1187 | } |
1207 | 1188 | ||
1208 | ec->common.status_addr = ec->common.command_addr; | 1189 | ec->common.status_addr = ec->common.command_addr; |
@@ -1219,7 +1200,7 @@ static int acpi_ec_start(struct acpi_device *device) | |||
1219 | ACPI_GPE_EDGE_TRIGGERED, | 1200 | ACPI_GPE_EDGE_TRIGGERED, |
1220 | &acpi_ec_gpe_handler, ec); | 1201 | &acpi_ec_gpe_handler, ec); |
1221 | if (ACPI_FAILURE(status)) { | 1202 | if (ACPI_FAILURE(status)) { |
1222 | return_VALUE(-ENODEV); | 1203 | return -ENODEV; |
1223 | } | 1204 | } |
1224 | acpi_set_gpe_type(NULL, ec->common.gpe_bit, ACPI_GPE_TYPE_RUNTIME); | 1205 | acpi_set_gpe_type(NULL, ec->common.gpe_bit, ACPI_GPE_TYPE_RUNTIME); |
1225 | acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); | 1206 | acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); |
@@ -1231,10 +1212,10 @@ static int acpi_ec_start(struct acpi_device *device) | |||
1231 | if (ACPI_FAILURE(status)) { | 1212 | if (ACPI_FAILURE(status)) { |
1232 | acpi_remove_gpe_handler(NULL, ec->common.gpe_bit, | 1213 | acpi_remove_gpe_handler(NULL, ec->common.gpe_bit, |
1233 | &acpi_ec_gpe_handler); | 1214 | &acpi_ec_gpe_handler); |
1234 | return_VALUE(-ENODEV); | 1215 | return -ENODEV; |
1235 | } | 1216 | } |
1236 | 1217 | ||
1237 | return_VALUE(AE_OK); | 1218 | return AE_OK; |
1238 | } | 1219 | } |
1239 | 1220 | ||
1240 | static int acpi_ec_stop(struct acpi_device *device, int type) | 1221 | static int acpi_ec_stop(struct acpi_device *device, int type) |
@@ -1242,10 +1223,9 @@ static int acpi_ec_stop(struct acpi_device *device, int type) | |||
1242 | acpi_status status = AE_OK; | 1223 | acpi_status status = AE_OK; |
1243 | union acpi_ec *ec = NULL; | 1224 | union acpi_ec *ec = NULL; |
1244 | 1225 | ||
1245 | ACPI_FUNCTION_TRACE("acpi_ec_stop"); | ||
1246 | 1226 | ||
1247 | if (!device) | 1227 | if (!device) |
1248 | return_VALUE(-EINVAL); | 1228 | return -EINVAL; |
1249 | 1229 | ||
1250 | ec = acpi_driver_data(device); | 1230 | ec = acpi_driver_data(device); |
1251 | 1231 | ||
@@ -1253,15 +1233,15 @@ static int acpi_ec_stop(struct acpi_device *device, int type) | |||
1253 | ACPI_ADR_SPACE_EC, | 1233 | ACPI_ADR_SPACE_EC, |
1254 | &acpi_ec_space_handler); | 1234 | &acpi_ec_space_handler); |
1255 | if (ACPI_FAILURE(status)) | 1235 | if (ACPI_FAILURE(status)) |
1256 | return_VALUE(-ENODEV); | 1236 | return -ENODEV; |
1257 | 1237 | ||
1258 | status = | 1238 | status = |
1259 | acpi_remove_gpe_handler(NULL, ec->common.gpe_bit, | 1239 | acpi_remove_gpe_handler(NULL, ec->common.gpe_bit, |
1260 | &acpi_ec_gpe_handler); | 1240 | &acpi_ec_gpe_handler); |
1261 | if (ACPI_FAILURE(status)) | 1241 | if (ACPI_FAILURE(status)) |
1262 | return_VALUE(-ENODEV); | 1242 | return -ENODEV; |
1263 | 1243 | ||
1264 | return_VALUE(0); | 1244 | return 0; |
1265 | } | 1245 | } |
1266 | 1246 | ||
1267 | static acpi_status __init | 1247 | static acpi_status __init |
@@ -1531,23 +1511,22 @@ static int __init acpi_ec_init(void) | |||
1531 | { | 1511 | { |
1532 | int result = 0; | 1512 | int result = 0; |
1533 | 1513 | ||
1534 | ACPI_FUNCTION_TRACE("acpi_ec_init"); | ||
1535 | 1514 | ||
1536 | if (acpi_disabled) | 1515 | if (acpi_disabled) |
1537 | return_VALUE(0); | 1516 | return 0; |
1538 | 1517 | ||
1539 | acpi_ec_dir = proc_mkdir(ACPI_EC_CLASS, acpi_root_dir); | 1518 | acpi_ec_dir = proc_mkdir(ACPI_EC_CLASS, acpi_root_dir); |
1540 | if (!acpi_ec_dir) | 1519 | if (!acpi_ec_dir) |
1541 | return_VALUE(-ENODEV); | 1520 | return -ENODEV; |
1542 | 1521 | ||
1543 | /* Now register the driver for the EC */ | 1522 | /* Now register the driver for the EC */ |
1544 | result = acpi_bus_register_driver(&acpi_ec_driver); | 1523 | result = acpi_bus_register_driver(&acpi_ec_driver); |
1545 | if (result < 0) { | 1524 | if (result < 0) { |
1546 | remove_proc_entry(ACPI_EC_CLASS, acpi_root_dir); | 1525 | remove_proc_entry(ACPI_EC_CLASS, acpi_root_dir); |
1547 | return_VALUE(-ENODEV); | 1526 | return -ENODEV; |
1548 | } | 1527 | } |
1549 | 1528 | ||
1550 | return_VALUE(result); | 1529 | return result; |
1551 | } | 1530 | } |
1552 | 1531 | ||
1553 | subsys_initcall(acpi_ec_init); | 1532 | subsys_initcall(acpi_ec_init); |
@@ -1556,13 +1535,12 @@ subsys_initcall(acpi_ec_init); | |||
1556 | #if 0 | 1535 | #if 0 |
1557 | static void __exit acpi_ec_exit(void) | 1536 | static void __exit acpi_ec_exit(void) |
1558 | { | 1537 | { |
1559 | ACPI_FUNCTION_TRACE("acpi_ec_exit"); | ||
1560 | 1538 | ||
1561 | acpi_bus_unregister_driver(&acpi_ec_driver); | 1539 | acpi_bus_unregister_driver(&acpi_ec_driver); |
1562 | 1540 | ||
1563 | remove_proc_entry(ACPI_EC_CLASS, acpi_root_dir); | 1541 | remove_proc_entry(ACPI_EC_CLASS, acpi_root_dir); |
1564 | 1542 | ||
1565 | return_VOID; | 1543 | return; |
1566 | } | 1544 | } |
1567 | #endif /* 0 */ | 1545 | #endif /* 0 */ |
1568 | 1546 | ||