aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/utilities
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/utilities')
-rw-r--r--drivers/acpi/utilities/utdelete.c36
-rw-r--r--drivers/acpi/utilities/utglobal.c1
-rw-r--r--drivers/acpi/utilities/utmutex.c39
3 files changed, 34 insertions, 42 deletions
diff --git a/drivers/acpi/utilities/utdelete.c b/drivers/acpi/utilities/utdelete.c
index 67b9f325c6fa..38ebe1c54330 100644
--- a/drivers/acpi/utilities/utdelete.c
+++ b/drivers/acpi/utilities/utdelete.c
@@ -155,21 +155,30 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object)
155 case ACPI_TYPE_MUTEX: 155 case ACPI_TYPE_MUTEX:
156 156
157 ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, 157 ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
158 "***** Mutex %p, Semaphore %p\n", 158 "***** Mutex %p, OS Mutex %p\n",
159 object, object->mutex.semaphore)); 159 object, object->mutex.os_mutex));
160 160
161 acpi_ex_unlink_mutex(object); 161 if (object->mutex.os_mutex != ACPI_GLOBAL_LOCK) {
162 (void)acpi_os_delete_semaphore(object->mutex.semaphore); 162 acpi_ex_unlink_mutex(object);
163 acpi_os_delete_mutex(object->mutex.os_mutex);
164 } else {
165 /* Global Lock "mutex" is actually a counting semaphore */
166
167 (void)
168 acpi_os_delete_semaphore
169 (acpi_gbl_global_lock_semaphore);
170 acpi_gbl_global_lock_semaphore = NULL;
171 }
163 break; 172 break;
164 173
165 case ACPI_TYPE_EVENT: 174 case ACPI_TYPE_EVENT:
166 175
167 ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, 176 ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
168 "***** Event %p, Semaphore %p\n", 177 "***** Event %p, OS Semaphore %p\n",
169 object, object->event.semaphore)); 178 object, object->event.os_semaphore));
170 179
171 (void)acpi_os_delete_semaphore(object->event.semaphore); 180 (void)acpi_os_delete_semaphore(object->event.os_semaphore);
172 object->event.semaphore = NULL; 181 object->event.os_semaphore = NULL;
173 break; 182 break;
174 183
175 case ACPI_TYPE_METHOD: 184 case ACPI_TYPE_METHOD:
@@ -177,12 +186,13 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object)
177 ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, 186 ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
178 "***** Method %p\n", object)); 187 "***** Method %p\n", object));
179 188
180 /* Delete the method semaphore if it exists */ 189 /* Delete the method mutex if it exists */
181 190
182 if (object->method.semaphore) { 191 if (object->method.mutex) {
183 (void)acpi_os_delete_semaphore(object->method. 192 acpi_os_delete_mutex(object->method.mutex->mutex.
184 semaphore); 193 os_mutex);
185 object->method.semaphore = NULL; 194 acpi_ut_delete_object_desc(object->method.mutex);
195 object->method.mutex = NULL;
186 } 196 }
187 break; 197 break;
188 198
diff --git a/drivers/acpi/utilities/utglobal.c b/drivers/acpi/utilities/utglobal.c
index e5999c65c0b8..014030af8b50 100644
--- a/drivers/acpi/utilities/utglobal.c
+++ b/drivers/acpi/utilities/utglobal.c
@@ -794,6 +794,7 @@ void acpi_ut_init_globals(void)
794 794
795 /* Global Lock support */ 795 /* Global Lock support */
796 796
797 acpi_gbl_global_lock_semaphore = NULL;
797 acpi_gbl_global_lock_acquired = FALSE; 798 acpi_gbl_global_lock_acquired = FALSE;
798 acpi_gbl_global_lock_thread_count = 0; 799 acpi_gbl_global_lock_thread_count = 0;
799 acpi_gbl_global_lock_handle = 0; 800 acpi_gbl_global_lock_handle = 0;
diff --git a/drivers/acpi/utilities/utmutex.c b/drivers/acpi/utilities/utmutex.c
index 25eb34369afa..dfc8f30ca892 100644
--- a/drivers/acpi/utilities/utmutex.c
+++ b/drivers/acpi/utilities/utmutex.c
@@ -82,12 +82,9 @@ acpi_status acpi_ut_mutex_initialize(void)
82 82
83 /* Create the spinlocks for use at interrupt level */ 83 /* Create the spinlocks for use at interrupt level */
84 84
85 status = acpi_os_create_lock(&acpi_gbl_gpe_lock); 85 spin_lock_init(acpi_gbl_gpe_lock);
86 if (ACPI_FAILURE(status)) { 86 spin_lock_init(acpi_gbl_hardware_lock);
87 return_ACPI_STATUS(status);
88 }
89 87
90 status = acpi_os_create_lock(&acpi_gbl_hardware_lock);
91 return_ACPI_STATUS(status); 88 return_ACPI_STATUS(status);
92} 89}
93 90
@@ -146,9 +143,8 @@ static acpi_status acpi_ut_create_mutex(acpi_mutex_handle mutex_id)
146 } 143 }
147 144
148 if (!acpi_gbl_mutex_info[mutex_id].mutex) { 145 if (!acpi_gbl_mutex_info[mutex_id].mutex) {
149 status = acpi_os_create_semaphore(1, 1, 146 status =
150 &acpi_gbl_mutex_info 147 acpi_os_create_mutex(&acpi_gbl_mutex_info[mutex_id].mutex);
151 [mutex_id].mutex);
152 acpi_gbl_mutex_info[mutex_id].thread_id = 148 acpi_gbl_mutex_info[mutex_id].thread_id =
153 ACPI_MUTEX_NOT_ACQUIRED; 149 ACPI_MUTEX_NOT_ACQUIRED;
154 acpi_gbl_mutex_info[mutex_id].use_count = 0; 150 acpi_gbl_mutex_info[mutex_id].use_count = 0;
@@ -171,7 +167,6 @@ static acpi_status acpi_ut_create_mutex(acpi_mutex_handle mutex_id)
171 167
172static acpi_status acpi_ut_delete_mutex(acpi_mutex_handle mutex_id) 168static acpi_status acpi_ut_delete_mutex(acpi_mutex_handle mutex_id)
173{ 169{
174 acpi_status status;
175 170
176 ACPI_FUNCTION_TRACE_U32(ut_delete_mutex, mutex_id); 171 ACPI_FUNCTION_TRACE_U32(ut_delete_mutex, mutex_id);
177 172
@@ -179,12 +174,12 @@ static acpi_status acpi_ut_delete_mutex(acpi_mutex_handle mutex_id)
179 return_ACPI_STATUS(AE_BAD_PARAMETER); 174 return_ACPI_STATUS(AE_BAD_PARAMETER);
180 } 175 }
181 176
182 status = acpi_os_delete_semaphore(acpi_gbl_mutex_info[mutex_id].mutex); 177 acpi_os_delete_mutex(acpi_gbl_mutex_info[mutex_id].mutex);
183 178
184 acpi_gbl_mutex_info[mutex_id].mutex = NULL; 179 acpi_gbl_mutex_info[mutex_id].mutex = NULL;
185 acpi_gbl_mutex_info[mutex_id].thread_id = ACPI_MUTEX_NOT_ACQUIRED; 180 acpi_gbl_mutex_info[mutex_id].thread_id = ACPI_MUTEX_NOT_ACQUIRED;
186 181
187 return_ACPI_STATUS(status); 182 return_ACPI_STATUS(AE_OK);
188} 183}
189 184
190/******************************************************************************* 185/*******************************************************************************
@@ -251,8 +246,8 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id)
251 "Thread %X attempting to acquire Mutex [%s]\n", 246 "Thread %X attempting to acquire Mutex [%s]\n",
252 this_thread_id, acpi_ut_get_mutex_name(mutex_id))); 247 this_thread_id, acpi_ut_get_mutex_name(mutex_id)));
253 248
254 status = acpi_os_wait_semaphore(acpi_gbl_mutex_info[mutex_id].mutex, 249 status = acpi_os_acquire_mutex(acpi_gbl_mutex_info[mutex_id].mutex,
255 1, ACPI_WAIT_FOREVER); 250 ACPI_WAIT_FOREVER);
256 if (ACPI_SUCCESS(status)) { 251 if (ACPI_SUCCESS(status)) {
257 ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, 252 ACPI_DEBUG_PRINT((ACPI_DB_MUTEX,
258 "Thread %X acquired Mutex [%s]\n", 253 "Thread %X acquired Mutex [%s]\n",
@@ -284,7 +279,6 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id)
284 279
285acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id) 280acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id)
286{ 281{
287 acpi_status status;
288 acpi_thread_id this_thread_id; 282 acpi_thread_id this_thread_id;
289 283
290 ACPI_FUNCTION_NAME(ut_release_mutex); 284 ACPI_FUNCTION_NAME(ut_release_mutex);
@@ -340,19 +334,6 @@ acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id)
340 334
341 acpi_gbl_mutex_info[mutex_id].thread_id = ACPI_MUTEX_NOT_ACQUIRED; 335 acpi_gbl_mutex_info[mutex_id].thread_id = ACPI_MUTEX_NOT_ACQUIRED;
342 336
343 status = 337 acpi_os_release_mutex(acpi_gbl_mutex_info[mutex_id].mutex);
344 acpi_os_signal_semaphore(acpi_gbl_mutex_info[mutex_id].mutex, 1); 338 return (AE_OK);
345
346 if (ACPI_FAILURE(status)) {
347 ACPI_EXCEPTION((AE_INFO, status,
348 "Thread %X could not release Mutex [%X]",
349 this_thread_id, mutex_id));
350 } else {
351 ACPI_DEBUG_PRINT((ACPI_DB_MUTEX,
352 "Thread %X released Mutex [%s]\n",
353 this_thread_id,
354 acpi_ut_get_mutex_name(mutex_id)));
355 }
356
357 return (status);
358} 339}