diff options
| author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-07-03 13:49:45 -0400 |
|---|---|---|
| committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-07-03 13:49:45 -0400 |
| commit | 026477c1141b67e98e3bd8bdedb7d4b88a3ecd09 (patch) | |
| tree | 2624a44924c625c367f3cebf937853b9da2de282 /drivers/acpi/osl.c | |
| parent | 9f2fa466383ce100b90fe52cb4489d7a26bf72a9 (diff) | |
| parent | 29454dde27d8e340bb1987bad9aa504af7081eba (diff) | |
Merge branch 'master' of /home/trondmy/kernel/linux-2.6/
Diffstat (limited to 'drivers/acpi/osl.c')
| -rw-r--r-- | drivers/acpi/osl.c | 75 |
1 files changed, 27 insertions, 48 deletions
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index 1bb558adee66..5a468e2779ae 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c | |||
| @@ -25,7 +25,6 @@ | |||
| 25 | * | 25 | * |
| 26 | */ | 26 | */ |
| 27 | 27 | ||
| 28 | #include <linux/config.h> | ||
| 29 | #include <linux/module.h> | 28 | #include <linux/module.h> |
| 30 | #include <linux/kernel.h> | 29 | #include <linux/kernel.h> |
| 31 | #include <linux/slab.h> | 30 | #include <linux/slab.h> |
| @@ -137,6 +136,7 @@ void acpi_os_vprintf(const char *fmt, va_list args) | |||
| 137 | #endif | 136 | #endif |
| 138 | } | 137 | } |
| 139 | 138 | ||
| 139 | |||
| 140 | extern int acpi_in_resume; | 140 | extern int acpi_in_resume; |
| 141 | void *acpi_os_allocate(acpi_size size) | 141 | void *acpi_os_allocate(acpi_size size) |
| 142 | { | 142 | { |
| @@ -280,7 +280,7 @@ acpi_os_install_interrupt_handler(u32 gsi, acpi_osd_handler handler, | |||
| 280 | 280 | ||
| 281 | acpi_irq_handler = handler; | 281 | acpi_irq_handler = handler; |
| 282 | acpi_irq_context = context; | 282 | acpi_irq_context = context; |
| 283 | if (request_irq(irq, acpi_irq, SA_SHIRQ, "acpi", acpi_irq)) { | 283 | if (request_irq(irq, acpi_irq, IRQF_SHARED, "acpi", acpi_irq)) { |
| 284 | printk(KERN_ERR PREFIX "SCI (IRQ%d) allocation failed\n", irq); | 284 | printk(KERN_ERR PREFIX "SCI (IRQ%d) allocation failed\n", irq); |
| 285 | return AE_NOT_ACQUIRED; | 285 | return AE_NOT_ACQUIRED; |
| 286 | } | 286 | } |
| @@ -586,19 +586,18 @@ static void acpi_os_execute_deferred(void *context) | |||
| 586 | { | 586 | { |
| 587 | struct acpi_os_dpc *dpc = NULL; | 587 | struct acpi_os_dpc *dpc = NULL; |
| 588 | 588 | ||
| 589 | ACPI_FUNCTION_TRACE("os_execute_deferred"); | ||
| 590 | 589 | ||
| 591 | dpc = (struct acpi_os_dpc *)context; | 590 | dpc = (struct acpi_os_dpc *)context; |
| 592 | if (!dpc) { | 591 | if (!dpc) { |
| 593 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid (NULL) context.\n")); | 592 | printk(KERN_ERR PREFIX "Invalid (NULL) context\n"); |
| 594 | return_VOID; | 593 | return; |
| 595 | } | 594 | } |
| 596 | 595 | ||
| 597 | dpc->function(dpc->context); | 596 | dpc->function(dpc->context); |
| 598 | 597 | ||
| 599 | kfree(dpc); | 598 | kfree(dpc); |
| 600 | 599 | ||
| 601 | return_VOID; | 600 | return; |
| 602 | } | 601 | } |
| 603 | 602 | ||
| 604 | static int acpi_os_execute_thread(void *context) | 603 | static int acpi_os_execute_thread(void *context) |
| @@ -688,35 +687,19 @@ EXPORT_SYMBOL(acpi_os_wait_events_complete); | |||
| 688 | /* | 687 | /* |
| 689 | * Allocate the memory for a spinlock and initialize it. | 688 | * Allocate the memory for a spinlock and initialize it. |
| 690 | */ | 689 | */ |
| 691 | acpi_status acpi_os_create_lock(acpi_handle * out_handle) | 690 | acpi_status acpi_os_create_lock(acpi_spinlock * handle) |
| 692 | { | 691 | { |
| 693 | spinlock_t *lock_ptr; | 692 | 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 | 693 | ||
| 703 | *out_handle = lock_ptr; | 694 | return AE_OK; |
| 704 | |||
| 705 | return_ACPI_STATUS(AE_OK); | ||
| 706 | } | 695 | } |
| 707 | 696 | ||
| 708 | /* | 697 | /* |
| 709 | * Deallocate the memory for a spinlock. | 698 | * Deallocate the memory for a spinlock. |
| 710 | */ | 699 | */ |
| 711 | void acpi_os_delete_lock(acpi_handle handle) | 700 | void acpi_os_delete_lock(acpi_spinlock handle) |
| 712 | { | 701 | { |
| 713 | ACPI_FUNCTION_TRACE("os_create_lock"); | 702 | 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 | } | 703 | } |
| 721 | 704 | ||
| 722 | acpi_status | 705 | acpi_status |
| @@ -724,11 +707,10 @@ acpi_os_create_semaphore(u32 max_units, u32 initial_units, acpi_handle * handle) | |||
| 724 | { | 707 | { |
| 725 | struct semaphore *sem = NULL; | 708 | struct semaphore *sem = NULL; |
| 726 | 709 | ||
| 727 | ACPI_FUNCTION_TRACE("os_create_semaphore"); | ||
| 728 | 710 | ||
| 729 | sem = acpi_os_allocate(sizeof(struct semaphore)); | 711 | sem = acpi_os_allocate(sizeof(struct semaphore)); |
| 730 | if (!sem) | 712 | if (!sem) |
| 731 | return_ACPI_STATUS(AE_NO_MEMORY); | 713 | return AE_NO_MEMORY; |
| 732 | memset(sem, 0, sizeof(struct semaphore)); | 714 | memset(sem, 0, sizeof(struct semaphore)); |
| 733 | 715 | ||
| 734 | sema_init(sem, initial_units); | 716 | sema_init(sem, initial_units); |
| @@ -738,7 +720,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", | 720 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Creating semaphore[%p|%d].\n", |
| 739 | *handle, initial_units)); | 721 | *handle, initial_units)); |
| 740 | 722 | ||
| 741 | return_ACPI_STATUS(AE_OK); | 723 | return AE_OK; |
| 742 | } | 724 | } |
| 743 | 725 | ||
| 744 | EXPORT_SYMBOL(acpi_os_create_semaphore); | 726 | EXPORT_SYMBOL(acpi_os_create_semaphore); |
| @@ -754,17 +736,16 @@ acpi_status acpi_os_delete_semaphore(acpi_handle handle) | |||
| 754 | { | 736 | { |
| 755 | struct semaphore *sem = (struct semaphore *)handle; | 737 | struct semaphore *sem = (struct semaphore *)handle; |
| 756 | 738 | ||
| 757 | ACPI_FUNCTION_TRACE("os_delete_semaphore"); | ||
| 758 | 739 | ||
| 759 | if (!sem) | 740 | if (!sem) |
| 760 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 741 | return AE_BAD_PARAMETER; |
| 761 | 742 | ||
| 762 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Deleting semaphore[%p].\n", handle)); | 743 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Deleting semaphore[%p].\n", handle)); |
| 763 | 744 | ||
| 764 | acpi_os_free(sem); | 745 | acpi_os_free(sem); |
| 765 | sem = NULL; | 746 | sem = NULL; |
| 766 | 747 | ||
| 767 | return_ACPI_STATUS(AE_OK); | 748 | return AE_OK; |
| 768 | } | 749 | } |
| 769 | 750 | ||
| 770 | EXPORT_SYMBOL(acpi_os_delete_semaphore); | 751 | EXPORT_SYMBOL(acpi_os_delete_semaphore); |
| @@ -784,13 +765,12 @@ acpi_status acpi_os_wait_semaphore(acpi_handle handle, u32 units, u16 timeout) | |||
| 784 | struct semaphore *sem = (struct semaphore *)handle; | 765 | struct semaphore *sem = (struct semaphore *)handle; |
| 785 | int ret = 0; | 766 | int ret = 0; |
| 786 | 767 | ||
| 787 | ACPI_FUNCTION_TRACE("os_wait_semaphore"); | ||
| 788 | 768 | ||
| 789 | if (!sem || (units < 1)) | 769 | if (!sem || (units < 1)) |
| 790 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 770 | return AE_BAD_PARAMETER; |
| 791 | 771 | ||
| 792 | if (units > 1) | 772 | if (units > 1) |
| 793 | return_ACPI_STATUS(AE_SUPPORT); | 773 | return AE_SUPPORT; |
| 794 | 774 | ||
| 795 | 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", |
| 796 | handle, units, timeout)); | 776 | handle, units, timeout)); |
| @@ -839,17 +819,17 @@ acpi_status acpi_os_wait_semaphore(acpi_handle handle, u32 units, u16 timeout) | |||
| 839 | } | 819 | } |
| 840 | 820 | ||
| 841 | if (ACPI_FAILURE(status)) { | 821 | if (ACPI_FAILURE(status)) { |
| 842 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 822 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, |
| 843 | "Failed to acquire semaphore[%p|%d|%d], %s\n", | 823 | "Failed to acquire semaphore[%p|%d|%d], %s", |
| 844 | handle, units, timeout, | 824 | handle, units, timeout, |
| 845 | acpi_format_exception(status))); | 825 | acpi_format_exception(status))); |
| 846 | } else { | 826 | } else { |
| 847 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, | 827 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, |
| 848 | "Acquired semaphore[%p|%d|%d]\n", handle, | 828 | "Acquired semaphore[%p|%d|%d]", handle, |
| 849 | units, timeout)); | 829 | units, timeout)); |
| 850 | } | 830 | } |
| 851 | 831 | ||
| 852 | return_ACPI_STATUS(status); | 832 | return status; |
| 853 | } | 833 | } |
| 854 | 834 | ||
| 855 | EXPORT_SYMBOL(acpi_os_wait_semaphore); | 835 | EXPORT_SYMBOL(acpi_os_wait_semaphore); |
| @@ -861,20 +841,19 @@ acpi_status acpi_os_signal_semaphore(acpi_handle handle, u32 units) | |||
| 861 | { | 841 | { |
| 862 | struct semaphore *sem = (struct semaphore *)handle; | 842 | struct semaphore *sem = (struct semaphore *)handle; |
| 863 | 843 | ||
| 864 | ACPI_FUNCTION_TRACE("os_signal_semaphore"); | ||
| 865 | 844 | ||
| 866 | if (!sem || (units < 1)) | 845 | if (!sem || (units < 1)) |
| 867 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 846 | return AE_BAD_PARAMETER; |
| 868 | 847 | ||
| 869 | if (units > 1) | 848 | if (units > 1) |
| 870 | return_ACPI_STATUS(AE_SUPPORT); | 849 | return AE_SUPPORT; |
| 871 | 850 | ||
| 872 | 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, |
| 873 | units)); | 852 | units)); |
| 874 | 853 | ||
| 875 | up(sem); | 854 | up(sem); |
| 876 | 855 | ||
| 877 | return_ACPI_STATUS(AE_OK); | 856 | return AE_OK; |
| 878 | } | 857 | } |
| 879 | 858 | ||
| 880 | EXPORT_SYMBOL(acpi_os_signal_semaphore); | 859 | EXPORT_SYMBOL(acpi_os_signal_semaphore); |
| @@ -1043,10 +1022,10 @@ EXPORT_SYMBOL(max_cstate); | |||
| 1043 | * handle is a pointer to the spinlock_t. | 1022 | * handle is a pointer to the spinlock_t. |
| 1044 | */ | 1023 | */ |
| 1045 | 1024 | ||
| 1046 | acpi_cpu_flags acpi_os_acquire_lock(acpi_handle handle) | 1025 | acpi_cpu_flags acpi_os_acquire_lock(acpi_spinlock lockp) |
| 1047 | { | 1026 | { |
| 1048 | acpi_cpu_flags flags; | 1027 | acpi_cpu_flags flags; |
| 1049 | spin_lock_irqsave((spinlock_t *) handle, flags); | 1028 | spin_lock_irqsave(lockp, flags); |
| 1050 | return flags; | 1029 | return flags; |
| 1051 | } | 1030 | } |
| 1052 | 1031 | ||
| @@ -1054,9 +1033,9 @@ acpi_cpu_flags acpi_os_acquire_lock(acpi_handle handle) | |||
| 1054 | * Release a spinlock. See above. | 1033 | * Release a spinlock. See above. |
| 1055 | */ | 1034 | */ |
| 1056 | 1035 | ||
| 1057 | void acpi_os_release_lock(acpi_handle handle, acpi_cpu_flags flags) | 1036 | void acpi_os_release_lock(acpi_spinlock lockp, acpi_cpu_flags flags) |
| 1058 | { | 1037 | { |
| 1059 | spin_unlock_irqrestore((spinlock_t *) handle, flags); | 1038 | spin_unlock_irqrestore(lockp, flags); |
| 1060 | } | 1039 | } |
| 1061 | 1040 | ||
| 1062 | #ifndef ACPI_USE_LOCAL_CACHE | 1041 | #ifndef ACPI_USE_LOCAL_CACHE |
