aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/utilities/utmutex.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/utilities/utmutex.c')
-rw-r--r--drivers/acpi/utilities/utmutex.c39
1 files changed, 10 insertions, 29 deletions
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}