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