aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/acpica/utmutex.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/acpica/utmutex.c')
-rw-r--r--drivers/acpi/acpica/utmutex.c37
1 files changed, 24 insertions, 13 deletions
diff --git a/drivers/acpi/acpica/utmutex.c b/drivers/acpi/acpica/utmutex.c
index f5cca3a1300c..d9efa495b433 100644
--- a/drivers/acpi/acpica/utmutex.c
+++ b/drivers/acpi/acpica/utmutex.c
@@ -86,6 +86,12 @@ acpi_status acpi_ut_mutex_initialize(void)
86 spin_lock_init(acpi_gbl_gpe_lock); 86 spin_lock_init(acpi_gbl_gpe_lock);
87 spin_lock_init(acpi_gbl_hardware_lock); 87 spin_lock_init(acpi_gbl_hardware_lock);
88 88
89 /* Mutex for _OSI support */
90 status = acpi_os_create_mutex(&acpi_gbl_osi_mutex);
91 if (ACPI_FAILURE(status)) {
92 return_ACPI_STATUS(status);
93 }
94
89 /* Create the reader/writer lock for namespace access */ 95 /* Create the reader/writer lock for namespace access */
90 96
91 status = acpi_ut_create_rw_lock(&acpi_gbl_namespace_rw_lock); 97 status = acpi_ut_create_rw_lock(&acpi_gbl_namespace_rw_lock);
@@ -117,6 +123,8 @@ void acpi_ut_mutex_terminate(void)
117 acpi_ut_delete_mutex(i); 123 acpi_ut_delete_mutex(i);
118 } 124 }
119 125
126 acpi_os_delete_mutex(acpi_gbl_osi_mutex);
127
120 /* Delete the spinlocks */ 128 /* Delete the spinlocks */
121 129
122 acpi_os_delete_lock(acpi_gbl_gpe_lock); 130 acpi_os_delete_lock(acpi_gbl_gpe_lock);
@@ -220,18 +228,17 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id)
220 if (acpi_gbl_mutex_info[i].thread_id == this_thread_id) { 228 if (acpi_gbl_mutex_info[i].thread_id == this_thread_id) {
221 if (i == mutex_id) { 229 if (i == mutex_id) {
222 ACPI_ERROR((AE_INFO, 230 ACPI_ERROR((AE_INFO,
223 "Mutex [%s] already acquired by this thread [%p]", 231 "Mutex [%s] already acquired by this thread [%u]",
224 acpi_ut_get_mutex_name 232 acpi_ut_get_mutex_name
225 (mutex_id), 233 (mutex_id),
226 ACPI_CAST_PTR(void, 234 (u32)this_thread_id));
227 this_thread_id)));
228 235
229 return (AE_ALREADY_ACQUIRED); 236 return (AE_ALREADY_ACQUIRED);
230 } 237 }
231 238
232 ACPI_ERROR((AE_INFO, 239 ACPI_ERROR((AE_INFO,
233 "Invalid acquire order: Thread %p owns [%s], wants [%s]", 240 "Invalid acquire order: Thread %u owns [%s], wants [%s]",
234 ACPI_CAST_PTR(void, this_thread_id), 241 (u32)this_thread_id,
235 acpi_ut_get_mutex_name(i), 242 acpi_ut_get_mutex_name(i),
236 acpi_ut_get_mutex_name(mutex_id))); 243 acpi_ut_get_mutex_name(mutex_id)));
237 244
@@ -242,24 +249,24 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id)
242#endif 249#endif
243 250
244 ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, 251 ACPI_DEBUG_PRINT((ACPI_DB_MUTEX,
245 "Thread %p attempting to acquire Mutex [%s]\n", 252 "Thread %u attempting to acquire Mutex [%s]\n",
246 ACPI_CAST_PTR(void, this_thread_id), 253 (u32)this_thread_id,
247 acpi_ut_get_mutex_name(mutex_id))); 254 acpi_ut_get_mutex_name(mutex_id)));
248 255
249 status = acpi_os_acquire_mutex(acpi_gbl_mutex_info[mutex_id].mutex, 256 status = acpi_os_acquire_mutex(acpi_gbl_mutex_info[mutex_id].mutex,
250 ACPI_WAIT_FOREVER); 257 ACPI_WAIT_FOREVER);
251 if (ACPI_SUCCESS(status)) { 258 if (ACPI_SUCCESS(status)) {
252 ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, 259 ACPI_DEBUG_PRINT((ACPI_DB_MUTEX,
253 "Thread %p acquired Mutex [%s]\n", 260 "Thread %u acquired Mutex [%s]\n",
254 ACPI_CAST_PTR(void, this_thread_id), 261 (u32)this_thread_id,
255 acpi_ut_get_mutex_name(mutex_id))); 262 acpi_ut_get_mutex_name(mutex_id)));
256 263
257 acpi_gbl_mutex_info[mutex_id].use_count++; 264 acpi_gbl_mutex_info[mutex_id].use_count++;
258 acpi_gbl_mutex_info[mutex_id].thread_id = this_thread_id; 265 acpi_gbl_mutex_info[mutex_id].thread_id = this_thread_id;
259 } else { 266 } else {
260 ACPI_EXCEPTION((AE_INFO, status, 267 ACPI_EXCEPTION((AE_INFO, status,
261 "Thread %p could not acquire Mutex [0x%X]", 268 "Thread %u could not acquire Mutex [0x%X]",
262 ACPI_CAST_PTR(void, this_thread_id), mutex_id)); 269 (u32)this_thread_id, mutex_id));
263 } 270 }
264 271
265 return (status); 272 return (status);
@@ -279,10 +286,14 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id)
279 286
280acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id) 287acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id)
281{ 288{
289 acpi_thread_id this_thread_id;
290
282 ACPI_FUNCTION_NAME(ut_release_mutex); 291 ACPI_FUNCTION_NAME(ut_release_mutex);
283 292
284 ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Thread %p releasing Mutex [%s]\n", 293 this_thread_id = acpi_os_get_thread_id();
285 ACPI_CAST_PTR(void, acpi_os_get_thread_id()), 294
295 ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Thread %u releasing Mutex [%s]\n",
296 (u32)this_thread_id,
286 acpi_ut_get_mutex_name(mutex_id))); 297 acpi_ut_get_mutex_name(mutex_id)));
287 298
288 if (mutex_id > ACPI_MAX_MUTEX) { 299 if (mutex_id > ACPI_MAX_MUTEX) {