diff options
Diffstat (limited to 'drivers/acpi/ec.c')
-rw-r--r-- | drivers/acpi/ec.c | 168 |
1 files changed, 72 insertions, 96 deletions
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index 18b3ea9dace2..8c5d7df7d343 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
@@ -207,16 +207,15 @@ 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(); |
214 | 213 | ||
215 | switch (event) { | 214 | switch (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) & ACPI_EC_FLAG_IBF) { |
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 | printk(KERN_WARNING PREFIX "Error in acpi_ec_wait\n"); | 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 | printk(KERN_WARNING PREFIX "leave burst_mode:error\n"); | 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); |
@@ -793,12 +782,15 @@ static u32 acpi_ec_gpe_intr_handler(void *data) | |||
793 | case ACPI_EC_EVENT_OBF: | 782 | case ACPI_EC_EVENT_OBF: |
794 | if (!(value & ACPI_EC_FLAG_OBF)) | 783 | if (!(value & ACPI_EC_FLAG_OBF)) |
795 | break; | 784 | break; |
785 | ec->intr.expect_event = 0; | ||
786 | wake_up(&ec->intr.wait); | ||
787 | break; | ||
796 | case ACPI_EC_EVENT_IBE: | 788 | case ACPI_EC_EVENT_IBE: |
797 | if ((value & ACPI_EC_FLAG_IBF)) | 789 | if ((value & ACPI_EC_FLAG_IBF)) |
798 | break; | 790 | break; |
799 | ec->intr.expect_event = 0; | 791 | ec->intr.expect_event = 0; |
800 | wake_up(&ec->intr.wait); | 792 | wake_up(&ec->intr.wait); |
801 | return ACPI_INTERRUPT_HANDLED; | 793 | break; |
802 | default: | 794 | default: |
803 | break; | 795 | break; |
804 | } | 796 | } |
@@ -846,15 +838,14 @@ acpi_ec_space_handler(u32 function, | |||
846 | acpi_integer f_v = 0; | 838 | acpi_integer f_v = 0; |
847 | int i = 0; | 839 | int i = 0; |
848 | 840 | ||
849 | ACPI_FUNCTION_TRACE("acpi_ec_space_handler"); | ||
850 | 841 | ||
851 | if ((address > 0xFF) || !value || !handler_context) | 842 | if ((address > 0xFF) || !value || !handler_context) |
852 | return_VALUE(AE_BAD_PARAMETER); | 843 | return AE_BAD_PARAMETER; |
853 | 844 | ||
854 | if (bit_width != 8 && acpi_strict) { | 845 | if (bit_width != 8 && acpi_strict) { |
855 | printk(KERN_WARNING PREFIX | 846 | printk(KERN_WARNING PREFIX |
856 | "acpi_ec_space_handler: bit_width should be 8\n"); | 847 | "acpi_ec_space_handler: bit_width should be 8\n"); |
857 | return_VALUE(AE_BAD_PARAMETER); | 848 | return AE_BAD_PARAMETER; |
858 | } | 849 | } |
859 | 850 | ||
860 | ec = (union acpi_ec *)handler_context; | 851 | ec = (union acpi_ec *)handler_context; |
@@ -893,16 +884,16 @@ acpi_ec_space_handler(u32 function, | |||
893 | out: | 884 | out: |
894 | switch (result) { | 885 | switch (result) { |
895 | case -EINVAL: | 886 | case -EINVAL: |
896 | return_VALUE(AE_BAD_PARAMETER); | 887 | return AE_BAD_PARAMETER; |
897 | break; | 888 | break; |
898 | case -ENODEV: | 889 | case -ENODEV: |
899 | return_VALUE(AE_NOT_FOUND); | 890 | return AE_NOT_FOUND; |
900 | break; | 891 | break; |
901 | case -ETIME: | 892 | case -ETIME: |
902 | return_VALUE(AE_TIME); | 893 | return AE_TIME; |
903 | break; | 894 | break; |
904 | default: | 895 | default: |
905 | return_VALUE(AE_OK); | 896 | return AE_OK; |
906 | } | 897 | } |
907 | } | 898 | } |
908 | 899 | ||
@@ -916,7 +907,6 @@ static int acpi_ec_read_info(struct seq_file *seq, void *offset) | |||
916 | { | 907 | { |
917 | union acpi_ec *ec = (union acpi_ec *)seq->private; | 908 | union acpi_ec *ec = (union acpi_ec *)seq->private; |
918 | 909 | ||
919 | ACPI_FUNCTION_TRACE("acpi_ec_read_info"); | ||
920 | 910 | ||
921 | if (!ec) | 911 | if (!ec) |
922 | goto end; | 912 | goto end; |
@@ -931,7 +921,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); | 921 | acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); |
932 | 922 | ||
933 | end: | 923 | end: |
934 | return_VALUE(0); | 924 | return 0; |
935 | } | 925 | } |
936 | 926 | ||
937 | static int acpi_ec_info_open_fs(struct inode *inode, struct file *file) | 927 | static int acpi_ec_info_open_fs(struct inode *inode, struct file *file) |
@@ -951,33 +941,29 @@ static int acpi_ec_add_fs(struct acpi_device *device) | |||
951 | { | 941 | { |
952 | struct proc_dir_entry *entry = NULL; | 942 | struct proc_dir_entry *entry = NULL; |
953 | 943 | ||
954 | ACPI_FUNCTION_TRACE("acpi_ec_add_fs"); | ||
955 | 944 | ||
956 | if (!acpi_device_dir(device)) { | 945 | if (!acpi_device_dir(device)) { |
957 | acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), | 946 | acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), |
958 | acpi_ec_dir); | 947 | acpi_ec_dir); |
959 | if (!acpi_device_dir(device)) | 948 | if (!acpi_device_dir(device)) |
960 | return_VALUE(-ENODEV); | 949 | return -ENODEV; |
961 | } | 950 | } |
962 | 951 | ||
963 | entry = create_proc_entry(ACPI_EC_FILE_INFO, S_IRUGO, | 952 | entry = create_proc_entry(ACPI_EC_FILE_INFO, S_IRUGO, |
964 | acpi_device_dir(device)); | 953 | acpi_device_dir(device)); |
965 | if (!entry) | 954 | if (!entry) |
966 | ACPI_DEBUG_PRINT((ACPI_DB_WARN, | 955 | return -ENODEV; |
967 | "Unable to create '%s' fs entry\n", | ||
968 | ACPI_EC_FILE_INFO)); | ||
969 | else { | 956 | else { |
970 | entry->proc_fops = &acpi_ec_info_ops; | 957 | entry->proc_fops = &acpi_ec_info_ops; |
971 | entry->data = acpi_driver_data(device); | 958 | entry->data = acpi_driver_data(device); |
972 | entry->owner = THIS_MODULE; | 959 | entry->owner = THIS_MODULE; |
973 | } | 960 | } |
974 | 961 | ||
975 | return_VALUE(0); | 962 | return 0; |
976 | } | 963 | } |
977 | 964 | ||
978 | static int acpi_ec_remove_fs(struct acpi_device *device) | 965 | static int acpi_ec_remove_fs(struct acpi_device *device) |
979 | { | 966 | { |
980 | ACPI_FUNCTION_TRACE("acpi_ec_remove_fs"); | ||
981 | 967 | ||
982 | if (acpi_device_dir(device)) { | 968 | if (acpi_device_dir(device)) { |
983 | remove_proc_entry(ACPI_EC_FILE_INFO, acpi_device_dir(device)); | 969 | remove_proc_entry(ACPI_EC_FILE_INFO, acpi_device_dir(device)); |
@@ -985,7 +971,7 @@ static int acpi_ec_remove_fs(struct acpi_device *device) | |||
985 | acpi_device_dir(device) = NULL; | 971 | acpi_device_dir(device) = NULL; |
986 | } | 972 | } |
987 | 973 | ||
988 | return_VALUE(0); | 974 | return 0; |
989 | } | 975 | } |
990 | 976 | ||
991 | /* -------------------------------------------------------------------------- | 977 | /* -------------------------------------------------------------------------- |
@@ -998,14 +984,13 @@ static int acpi_ec_poll_add(struct acpi_device *device) | |||
998 | acpi_status status = AE_OK; | 984 | acpi_status status = AE_OK; |
999 | union acpi_ec *ec = NULL; | 985 | union acpi_ec *ec = NULL; |
1000 | 986 | ||
1001 | ACPI_FUNCTION_TRACE("acpi_ec_add"); | ||
1002 | 987 | ||
1003 | if (!device) | 988 | if (!device) |
1004 | return_VALUE(-EINVAL); | 989 | return -EINVAL; |
1005 | 990 | ||
1006 | ec = kmalloc(sizeof(union acpi_ec), GFP_KERNEL); | 991 | ec = kmalloc(sizeof(union acpi_ec), GFP_KERNEL); |
1007 | if (!ec) | 992 | if (!ec) |
1008 | return_VALUE(-ENOMEM); | 993 | return -ENOMEM; |
1009 | memset(ec, 0, sizeof(union acpi_ec)); | 994 | memset(ec, 0, sizeof(union acpi_ec)); |
1010 | 995 | ||
1011 | ec->common.handle = device->handle; | 996 | ec->common.handle = device->handle; |
@@ -1038,8 +1023,7 @@ static int acpi_ec_poll_add(struct acpi_device *device) | |||
1038 | acpi_evaluate_integer(ec->common.handle, "_GPE", NULL, | 1023 | acpi_evaluate_integer(ec->common.handle, "_GPE", NULL, |
1039 | &ec->common.gpe_bit); | 1024 | &ec->common.gpe_bit); |
1040 | if (ACPI_FAILURE(status)) { | 1025 | if (ACPI_FAILURE(status)) { |
1041 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 1026 | ACPI_EXCEPTION((AE_INFO, status, "Obtaining GPE bit")); |
1042 | "Error obtaining GPE bit assignment\n")); | ||
1043 | result = -ENODEV; | 1027 | result = -ENODEV; |
1044 | goto end; | 1028 | goto end; |
1045 | } | 1029 | } |
@@ -1059,7 +1043,7 @@ static int acpi_ec_poll_add(struct acpi_device *device) | |||
1059 | if (result) | 1043 | if (result) |
1060 | kfree(ec); | 1044 | kfree(ec); |
1061 | 1045 | ||
1062 | return_VALUE(result); | 1046 | return result; |
1063 | } | 1047 | } |
1064 | static int acpi_ec_intr_add(struct acpi_device *device) | 1048 | static int acpi_ec_intr_add(struct acpi_device *device) |
1065 | { | 1049 | { |
@@ -1067,14 +1051,13 @@ static int acpi_ec_intr_add(struct acpi_device *device) | |||
1067 | acpi_status status = AE_OK; | 1051 | acpi_status status = AE_OK; |
1068 | union acpi_ec *ec = NULL; | 1052 | union acpi_ec *ec = NULL; |
1069 | 1053 | ||
1070 | ACPI_FUNCTION_TRACE("acpi_ec_add"); | ||
1071 | 1054 | ||
1072 | if (!device) | 1055 | if (!device) |
1073 | return_VALUE(-EINVAL); | 1056 | return -EINVAL; |
1074 | 1057 | ||
1075 | ec = kmalloc(sizeof(union acpi_ec), GFP_KERNEL); | 1058 | ec = kmalloc(sizeof(union acpi_ec), GFP_KERNEL); |
1076 | if (!ec) | 1059 | if (!ec) |
1077 | return_VALUE(-ENOMEM); | 1060 | return -ENOMEM; |
1078 | memset(ec, 0, sizeof(union acpi_ec)); | 1061 | memset(ec, 0, sizeof(union acpi_ec)); |
1079 | 1062 | ||
1080 | ec->common.handle = device->handle; | 1063 | ec->common.handle = device->handle; |
@@ -1110,8 +1093,7 @@ static int acpi_ec_intr_add(struct acpi_device *device) | |||
1110 | acpi_evaluate_integer(ec->common.handle, "_GPE", NULL, | 1093 | acpi_evaluate_integer(ec->common.handle, "_GPE", NULL, |
1111 | &ec->common.gpe_bit); | 1094 | &ec->common.gpe_bit); |
1112 | if (ACPI_FAILURE(status)) { | 1095 | if (ACPI_FAILURE(status)) { |
1113 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 1096 | printk(KERN_ERR PREFIX "Obtaining GPE bit assignment\n"); |
1114 | "Error obtaining GPE bit assignment\n")); | ||
1115 | result = -ENODEV; | 1097 | result = -ENODEV; |
1116 | goto end; | 1098 | goto end; |
1117 | } | 1099 | } |
@@ -1131,17 +1113,16 @@ static int acpi_ec_intr_add(struct acpi_device *device) | |||
1131 | if (result) | 1113 | if (result) |
1132 | kfree(ec); | 1114 | kfree(ec); |
1133 | 1115 | ||
1134 | return_VALUE(result); | 1116 | return result; |
1135 | } | 1117 | } |
1136 | 1118 | ||
1137 | static int acpi_ec_remove(struct acpi_device *device, int type) | 1119 | static int acpi_ec_remove(struct acpi_device *device, int type) |
1138 | { | 1120 | { |
1139 | union acpi_ec *ec = NULL; | 1121 | union acpi_ec *ec = NULL; |
1140 | 1122 | ||
1141 | ACPI_FUNCTION_TRACE("acpi_ec_remove"); | ||
1142 | 1123 | ||
1143 | if (!device) | 1124 | if (!device) |
1144 | return_VALUE(-EINVAL); | 1125 | return -EINVAL; |
1145 | 1126 | ||
1146 | ec = acpi_driver_data(device); | 1127 | ec = acpi_driver_data(device); |
1147 | 1128 | ||
@@ -1149,7 +1130,7 @@ static int acpi_ec_remove(struct acpi_device *device, int type) | |||
1149 | 1130 | ||
1150 | kfree(ec); | 1131 | kfree(ec); |
1151 | 1132 | ||
1152 | return_VALUE(0); | 1133 | return 0; |
1153 | } | 1134 | } |
1154 | 1135 | ||
1155 | static acpi_status | 1136 | static acpi_status |
@@ -1188,15 +1169,14 @@ static int acpi_ec_start(struct acpi_device *device) | |||
1188 | acpi_status status = AE_OK; | 1169 | acpi_status status = AE_OK; |
1189 | union acpi_ec *ec = NULL; | 1170 | union acpi_ec *ec = NULL; |
1190 | 1171 | ||
1191 | ACPI_FUNCTION_TRACE("acpi_ec_start"); | ||
1192 | 1172 | ||
1193 | if (!device) | 1173 | if (!device) |
1194 | return_VALUE(-EINVAL); | 1174 | return -EINVAL; |
1195 | 1175 | ||
1196 | ec = acpi_driver_data(device); | 1176 | ec = acpi_driver_data(device); |
1197 | 1177 | ||
1198 | if (!ec) | 1178 | if (!ec) |
1199 | return_VALUE(-EINVAL); | 1179 | return -EINVAL; |
1200 | 1180 | ||
1201 | /* | 1181 | /* |
1202 | * Get I/O port addresses. Convert to GAS format. | 1182 | * Get I/O port addresses. Convert to GAS format. |
@@ -1205,9 +1185,8 @@ static int acpi_ec_start(struct acpi_device *device) | |||
1205 | acpi_ec_io_ports, ec); | 1185 | acpi_ec_io_ports, ec); |
1206 | if (ACPI_FAILURE(status) | 1186 | if (ACPI_FAILURE(status) |
1207 | || ec->common.command_addr.register_bit_width == 0) { | 1187 | || ec->common.command_addr.register_bit_width == 0) { |
1208 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 1188 | printk(KERN_ERR PREFIX "Error getting I/O port addresses\n"); |
1209 | "Error getting I/O port addresses")); | 1189 | return -ENODEV; |
1210 | return_VALUE(-ENODEV); | ||
1211 | } | 1190 | } |
1212 | 1191 | ||
1213 | ec->common.status_addr = ec->common.command_addr; | 1192 | ec->common.status_addr = ec->common.command_addr; |
@@ -1224,7 +1203,7 @@ static int acpi_ec_start(struct acpi_device *device) | |||
1224 | ACPI_GPE_EDGE_TRIGGERED, | 1203 | ACPI_GPE_EDGE_TRIGGERED, |
1225 | &acpi_ec_gpe_handler, ec); | 1204 | &acpi_ec_gpe_handler, ec); |
1226 | if (ACPI_FAILURE(status)) { | 1205 | if (ACPI_FAILURE(status)) { |
1227 | return_VALUE(-ENODEV); | 1206 | return -ENODEV; |
1228 | } | 1207 | } |
1229 | acpi_set_gpe_type(NULL, ec->common.gpe_bit, ACPI_GPE_TYPE_RUNTIME); | 1208 | acpi_set_gpe_type(NULL, ec->common.gpe_bit, ACPI_GPE_TYPE_RUNTIME); |
1230 | acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); | 1209 | acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); |
@@ -1236,10 +1215,10 @@ static int acpi_ec_start(struct acpi_device *device) | |||
1236 | if (ACPI_FAILURE(status)) { | 1215 | if (ACPI_FAILURE(status)) { |
1237 | acpi_remove_gpe_handler(NULL, ec->common.gpe_bit, | 1216 | acpi_remove_gpe_handler(NULL, ec->common.gpe_bit, |
1238 | &acpi_ec_gpe_handler); | 1217 | &acpi_ec_gpe_handler); |
1239 | return_VALUE(-ENODEV); | 1218 | return -ENODEV; |
1240 | } | 1219 | } |
1241 | 1220 | ||
1242 | return_VALUE(AE_OK); | 1221 | return AE_OK; |
1243 | } | 1222 | } |
1244 | 1223 | ||
1245 | static int acpi_ec_stop(struct acpi_device *device, int type) | 1224 | static int acpi_ec_stop(struct acpi_device *device, int type) |
@@ -1247,10 +1226,9 @@ static int acpi_ec_stop(struct acpi_device *device, int type) | |||
1247 | acpi_status status = AE_OK; | 1226 | acpi_status status = AE_OK; |
1248 | union acpi_ec *ec = NULL; | 1227 | union acpi_ec *ec = NULL; |
1249 | 1228 | ||
1250 | ACPI_FUNCTION_TRACE("acpi_ec_stop"); | ||
1251 | 1229 | ||
1252 | if (!device) | 1230 | if (!device) |
1253 | return_VALUE(-EINVAL); | 1231 | return -EINVAL; |
1254 | 1232 | ||
1255 | ec = acpi_driver_data(device); | 1233 | ec = acpi_driver_data(device); |
1256 | 1234 | ||
@@ -1258,15 +1236,15 @@ static int acpi_ec_stop(struct acpi_device *device, int type) | |||
1258 | ACPI_ADR_SPACE_EC, | 1236 | ACPI_ADR_SPACE_EC, |
1259 | &acpi_ec_space_handler); | 1237 | &acpi_ec_space_handler); |
1260 | if (ACPI_FAILURE(status)) | 1238 | if (ACPI_FAILURE(status)) |
1261 | return_VALUE(-ENODEV); | 1239 | return -ENODEV; |
1262 | 1240 | ||
1263 | status = | 1241 | status = |
1264 | acpi_remove_gpe_handler(NULL, ec->common.gpe_bit, | 1242 | acpi_remove_gpe_handler(NULL, ec->common.gpe_bit, |
1265 | &acpi_ec_gpe_handler); | 1243 | &acpi_ec_gpe_handler); |
1266 | if (ACPI_FAILURE(status)) | 1244 | if (ACPI_FAILURE(status)) |
1267 | return_VALUE(-ENODEV); | 1245 | return -ENODEV; |
1268 | 1246 | ||
1269 | return_VALUE(0); | 1247 | return 0; |
1270 | } | 1248 | } |
1271 | 1249 | ||
1272 | static acpi_status __init | 1250 | static acpi_status __init |
@@ -1536,23 +1514,22 @@ static int __init acpi_ec_init(void) | |||
1536 | { | 1514 | { |
1537 | int result = 0; | 1515 | int result = 0; |
1538 | 1516 | ||
1539 | ACPI_FUNCTION_TRACE("acpi_ec_init"); | ||
1540 | 1517 | ||
1541 | if (acpi_disabled) | 1518 | if (acpi_disabled) |
1542 | return_VALUE(0); | 1519 | return 0; |
1543 | 1520 | ||
1544 | acpi_ec_dir = proc_mkdir(ACPI_EC_CLASS, acpi_root_dir); | 1521 | acpi_ec_dir = proc_mkdir(ACPI_EC_CLASS, acpi_root_dir); |
1545 | if (!acpi_ec_dir) | 1522 | if (!acpi_ec_dir) |
1546 | return_VALUE(-ENODEV); | 1523 | return -ENODEV; |
1547 | 1524 | ||
1548 | /* Now register the driver for the EC */ | 1525 | /* Now register the driver for the EC */ |
1549 | result = acpi_bus_register_driver(&acpi_ec_driver); | 1526 | result = acpi_bus_register_driver(&acpi_ec_driver); |
1550 | if (result < 0) { | 1527 | if (result < 0) { |
1551 | remove_proc_entry(ACPI_EC_CLASS, acpi_root_dir); | 1528 | remove_proc_entry(ACPI_EC_CLASS, acpi_root_dir); |
1552 | return_VALUE(-ENODEV); | 1529 | return -ENODEV; |
1553 | } | 1530 | } |
1554 | 1531 | ||
1555 | return_VALUE(result); | 1532 | return result; |
1556 | } | 1533 | } |
1557 | 1534 | ||
1558 | subsys_initcall(acpi_ec_init); | 1535 | subsys_initcall(acpi_ec_init); |
@@ -1561,13 +1538,12 @@ subsys_initcall(acpi_ec_init); | |||
1561 | #if 0 | 1538 | #if 0 |
1562 | static void __exit acpi_ec_exit(void) | 1539 | static void __exit acpi_ec_exit(void) |
1563 | { | 1540 | { |
1564 | ACPI_FUNCTION_TRACE("acpi_ec_exit"); | ||
1565 | 1541 | ||
1566 | acpi_bus_unregister_driver(&acpi_ec_driver); | 1542 | acpi_bus_unregister_driver(&acpi_ec_driver); |
1567 | 1543 | ||
1568 | remove_proc_entry(ACPI_EC_CLASS, acpi_root_dir); | 1544 | remove_proc_entry(ACPI_EC_CLASS, acpi_root_dir); |
1569 | 1545 | ||
1570 | return_VOID; | 1546 | return; |
1571 | } | 1547 | } |
1572 | #endif /* 0 */ | 1548 | #endif /* 0 */ |
1573 | 1549 | ||