diff options
Diffstat (limited to 'drivers/acpi/osl.c')
-rw-r--r-- | drivers/acpi/osl.c | 72 |
1 files changed, 26 insertions, 46 deletions
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index 1bb558adee66..afd937b158b3 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c | |||
@@ -137,6 +137,7 @@ void acpi_os_vprintf(const char *fmt, va_list args) | |||
137 | #endif | 137 | #endif |
138 | } | 138 | } |
139 | 139 | ||
140 | |||
140 | extern int acpi_in_resume; | 141 | extern int acpi_in_resume; |
141 | void *acpi_os_allocate(acpi_size size) | 142 | void *acpi_os_allocate(acpi_size size) |
142 | { | 143 | { |
@@ -586,19 +587,18 @@ static void acpi_os_execute_deferred(void *context) | |||
586 | { | 587 | { |
587 | struct acpi_os_dpc *dpc = NULL; | 588 | struct acpi_os_dpc *dpc = NULL; |
588 | 589 | ||
589 | ACPI_FUNCTION_TRACE("os_execute_deferred"); | ||
590 | 590 | ||
591 | dpc = (struct acpi_os_dpc *)context; | 591 | dpc = (struct acpi_os_dpc *)context; |
592 | if (!dpc) { | 592 | if (!dpc) { |
593 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid (NULL) context.\n")); | 593 | printk(KERN_ERR PREFIX "Invalid (NULL) context\n"); |
594 | return_VOID; | 594 | return; |
595 | } | 595 | } |
596 | 596 | ||
597 | dpc->function(dpc->context); | 597 | dpc->function(dpc->context); |
598 | 598 | ||
599 | kfree(dpc); | 599 | kfree(dpc); |
600 | 600 | ||
601 | return_VOID; | 601 | return; |
602 | } | 602 | } |
603 | 603 | ||
604 | static int acpi_os_execute_thread(void *context) | 604 | static int acpi_os_execute_thread(void *context) |
@@ -688,35 +688,19 @@ EXPORT_SYMBOL(acpi_os_wait_events_complete); | |||
688 | /* | 688 | /* |
689 | * Allocate the memory for a spinlock and initialize it. | 689 | * Allocate the memory for a spinlock and initialize it. |
690 | */ | 690 | */ |
691 | acpi_status acpi_os_create_lock(acpi_handle * out_handle) | 691 | acpi_status acpi_os_create_lock(acpi_spinlock * handle) |
692 | { | 692 | { |
693 | spinlock_t *lock_ptr; | 693 | spin_lock_init(*handle); |
694 | |||
695 | ACPI_FUNCTION_TRACE("os_create_lock"); | ||
696 | |||
697 | lock_ptr = acpi_os_allocate(sizeof(spinlock_t)); | ||
698 | |||
699 | spin_lock_init(lock_ptr); | ||
700 | |||
701 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Creating spinlock[%p].\n", lock_ptr)); | ||
702 | 694 | ||
703 | *out_handle = lock_ptr; | 695 | return AE_OK; |
704 | |||
705 | return_ACPI_STATUS(AE_OK); | ||
706 | } | 696 | } |
707 | 697 | ||
708 | /* | 698 | /* |
709 | * Deallocate the memory for a spinlock. | 699 | * Deallocate the memory for a spinlock. |
710 | */ | 700 | */ |
711 | void acpi_os_delete_lock(acpi_handle handle) | 701 | void acpi_os_delete_lock(acpi_spinlock handle) |
712 | { | 702 | { |
713 | ACPI_FUNCTION_TRACE("os_create_lock"); | 703 | return; |
714 | |||
715 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Deleting spinlock[%p].\n", handle)); | ||
716 | |||
717 | acpi_os_free(handle); | ||
718 | |||
719 | return_VOID; | ||
720 | } | 704 | } |
721 | 705 | ||
722 | acpi_status | 706 | acpi_status |
@@ -724,11 +708,10 @@ acpi_os_create_semaphore(u32 max_units, u32 initial_units, acpi_handle * handle) | |||
724 | { | 708 | { |
725 | struct semaphore *sem = NULL; | 709 | struct semaphore *sem = NULL; |
726 | 710 | ||
727 | ACPI_FUNCTION_TRACE("os_create_semaphore"); | ||
728 | 711 | ||
729 | sem = acpi_os_allocate(sizeof(struct semaphore)); | 712 | sem = acpi_os_allocate(sizeof(struct semaphore)); |
730 | if (!sem) | 713 | if (!sem) |
731 | return_ACPI_STATUS(AE_NO_MEMORY); | 714 | return AE_NO_MEMORY; |
732 | memset(sem, 0, sizeof(struct semaphore)); | 715 | memset(sem, 0, sizeof(struct semaphore)); |
733 | 716 | ||
734 | sema_init(sem, initial_units); | 717 | sema_init(sem, initial_units); |
@@ -738,7 +721,7 @@ acpi_os_create_semaphore(u32 max_units, u32 initial_units, acpi_handle * handle) | |||
738 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Creating semaphore[%p|%d].\n", | 721 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Creating semaphore[%p|%d].\n", |
739 | *handle, initial_units)); | 722 | *handle, initial_units)); |
740 | 723 | ||
741 | return_ACPI_STATUS(AE_OK); | 724 | return AE_OK; |
742 | } | 725 | } |
743 | 726 | ||
744 | EXPORT_SYMBOL(acpi_os_create_semaphore); | 727 | EXPORT_SYMBOL(acpi_os_create_semaphore); |
@@ -754,17 +737,16 @@ acpi_status acpi_os_delete_semaphore(acpi_handle handle) | |||
754 | { | 737 | { |
755 | struct semaphore *sem = (struct semaphore *)handle; | 738 | struct semaphore *sem = (struct semaphore *)handle; |
756 | 739 | ||
757 | ACPI_FUNCTION_TRACE("os_delete_semaphore"); | ||
758 | 740 | ||
759 | if (!sem) | 741 | if (!sem) |
760 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 742 | return AE_BAD_PARAMETER; |
761 | 743 | ||
762 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Deleting semaphore[%p].\n", handle)); | 744 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Deleting semaphore[%p].\n", handle)); |
763 | 745 | ||
764 | acpi_os_free(sem); | 746 | acpi_os_free(sem); |
765 | sem = NULL; | 747 | sem = NULL; |
766 | 748 | ||
767 | return_ACPI_STATUS(AE_OK); | 749 | return AE_OK; |
768 | } | 750 | } |
769 | 751 | ||
770 | EXPORT_SYMBOL(acpi_os_delete_semaphore); | 752 | EXPORT_SYMBOL(acpi_os_delete_semaphore); |
@@ -784,13 +766,12 @@ acpi_status acpi_os_wait_semaphore(acpi_handle handle, u32 units, u16 timeout) | |||
784 | struct semaphore *sem = (struct semaphore *)handle; | 766 | struct semaphore *sem = (struct semaphore *)handle; |
785 | int ret = 0; | 767 | int ret = 0; |
786 | 768 | ||
787 | ACPI_FUNCTION_TRACE("os_wait_semaphore"); | ||
788 | 769 | ||
789 | if (!sem || (units < 1)) | 770 | if (!sem || (units < 1)) |
790 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 771 | return AE_BAD_PARAMETER; |
791 | 772 | ||
792 | if (units > 1) | 773 | if (units > 1) |
793 | return_ACPI_STATUS(AE_SUPPORT); | 774 | return AE_SUPPORT; |
794 | 775 | ||
795 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Waiting for semaphore[%p|%d|%d]\n", | 776 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Waiting for semaphore[%p|%d|%d]\n", |
796 | handle, units, timeout)); | 777 | handle, units, timeout)); |
@@ -839,17 +820,17 @@ acpi_status acpi_os_wait_semaphore(acpi_handle handle, u32 units, u16 timeout) | |||
839 | } | 820 | } |
840 | 821 | ||
841 | if (ACPI_FAILURE(status)) { | 822 | if (ACPI_FAILURE(status)) { |
842 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 823 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, |
843 | "Failed to acquire semaphore[%p|%d|%d], %s\n", | 824 | "Failed to acquire semaphore[%p|%d|%d], %s", |
844 | handle, units, timeout, | 825 | handle, units, timeout, |
845 | acpi_format_exception(status))); | 826 | acpi_format_exception(status))); |
846 | } else { | 827 | } else { |
847 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, | 828 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, |
848 | "Acquired semaphore[%p|%d|%d]\n", handle, | 829 | "Acquired semaphore[%p|%d|%d]", handle, |
849 | units, timeout)); | 830 | units, timeout)); |
850 | } | 831 | } |
851 | 832 | ||
852 | return_ACPI_STATUS(status); | 833 | return status; |
853 | } | 834 | } |
854 | 835 | ||
855 | EXPORT_SYMBOL(acpi_os_wait_semaphore); | 836 | EXPORT_SYMBOL(acpi_os_wait_semaphore); |
@@ -861,20 +842,19 @@ acpi_status acpi_os_signal_semaphore(acpi_handle handle, u32 units) | |||
861 | { | 842 | { |
862 | struct semaphore *sem = (struct semaphore *)handle; | 843 | struct semaphore *sem = (struct semaphore *)handle; |
863 | 844 | ||
864 | ACPI_FUNCTION_TRACE("os_signal_semaphore"); | ||
865 | 845 | ||
866 | if (!sem || (units < 1)) | 846 | if (!sem || (units < 1)) |
867 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 847 | return AE_BAD_PARAMETER; |
868 | 848 | ||
869 | if (units > 1) | 849 | if (units > 1) |
870 | return_ACPI_STATUS(AE_SUPPORT); | 850 | return AE_SUPPORT; |
871 | 851 | ||
872 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Signaling semaphore[%p|%d]\n", handle, | 852 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Signaling semaphore[%p|%d]\n", handle, |
873 | units)); | 853 | units)); |
874 | 854 | ||
875 | up(sem); | 855 | up(sem); |
876 | 856 | ||
877 | return_ACPI_STATUS(AE_OK); | 857 | return AE_OK; |
878 | } | 858 | } |
879 | 859 | ||
880 | EXPORT_SYMBOL(acpi_os_signal_semaphore); | 860 | EXPORT_SYMBOL(acpi_os_signal_semaphore); |
@@ -1043,10 +1023,10 @@ EXPORT_SYMBOL(max_cstate); | |||
1043 | * handle is a pointer to the spinlock_t. | 1023 | * handle is a pointer to the spinlock_t. |
1044 | */ | 1024 | */ |
1045 | 1025 | ||
1046 | acpi_cpu_flags acpi_os_acquire_lock(acpi_handle handle) | 1026 | acpi_cpu_flags acpi_os_acquire_lock(acpi_spinlock lockp) |
1047 | { | 1027 | { |
1048 | acpi_cpu_flags flags; | 1028 | acpi_cpu_flags flags; |
1049 | spin_lock_irqsave((spinlock_t *) handle, flags); | 1029 | spin_lock_irqsave(lockp, flags); |
1050 | return flags; | 1030 | return flags; |
1051 | } | 1031 | } |
1052 | 1032 | ||
@@ -1054,9 +1034,9 @@ acpi_cpu_flags acpi_os_acquire_lock(acpi_handle handle) | |||
1054 | * Release a spinlock. See above. | 1034 | * Release a spinlock. See above. |
1055 | */ | 1035 | */ |
1056 | 1036 | ||
1057 | void acpi_os_release_lock(acpi_handle handle, acpi_cpu_flags flags) | 1037 | void acpi_os_release_lock(acpi_spinlock lockp, acpi_cpu_flags flags) |
1058 | { | 1038 | { |
1059 | spin_unlock_irqrestore((spinlock_t *) handle, flags); | 1039 | spin_unlock_irqrestore(lockp, flags); |
1060 | } | 1040 | } |
1061 | 1041 | ||
1062 | #ifndef ACPI_USE_LOCAL_CACHE | 1042 | #ifndef ACPI_USE_LOCAL_CACHE |