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.c42
1 files changed, 26 insertions, 16 deletions
diff --git a/drivers/acpi/utilities/utmutex.c b/drivers/acpi/utilities/utmutex.c
index 45a7244df924..25eb34369afa 100644
--- a/drivers/acpi/utilities/utmutex.c
+++ b/drivers/acpi/utilities/utmutex.c
@@ -68,19 +68,26 @@ acpi_status acpi_ut_mutex_initialize(void)
68 u32 i; 68 u32 i;
69 acpi_status status; 69 acpi_status status;
70 70
71 ACPI_FUNCTION_TRACE("ut_mutex_initialize"); 71 ACPI_FUNCTION_TRACE(ut_mutex_initialize);
72 72
73 /* 73 /*
74 * Create each of the predefined mutex objects 74 * Create each of the predefined mutex objects
75 */ 75 */
76 for (i = 0; i < NUM_MUTEX; i++) { 76 for (i = 0; i < ACPI_NUM_MUTEX; i++) {
77 status = acpi_ut_create_mutex(i); 77 status = acpi_ut_create_mutex(i);
78 if (ACPI_FAILURE(status)) { 78 if (ACPI_FAILURE(status)) {
79 return_ACPI_STATUS(status); 79 return_ACPI_STATUS(status);
80 } 80 }
81 } 81 }
82 82
83 /* Create the spinlocks for use at interrupt level */
84
83 status = acpi_os_create_lock(&acpi_gbl_gpe_lock); 85 status = acpi_os_create_lock(&acpi_gbl_gpe_lock);
86 if (ACPI_FAILURE(status)) {
87 return_ACPI_STATUS(status);
88 }
89
90 status = acpi_os_create_lock(&acpi_gbl_hardware_lock);
84 return_ACPI_STATUS(status); 91 return_ACPI_STATUS(status);
85} 92}
86 93
@@ -100,16 +107,19 @@ void acpi_ut_mutex_terminate(void)
100{ 107{
101 u32 i; 108 u32 i;
102 109
103 ACPI_FUNCTION_TRACE("ut_mutex_terminate"); 110 ACPI_FUNCTION_TRACE(ut_mutex_terminate);
104 111
105 /* 112 /*
106 * Delete each predefined mutex object 113 * Delete each predefined mutex object
107 */ 114 */
108 for (i = 0; i < NUM_MUTEX; i++) { 115 for (i = 0; i < ACPI_NUM_MUTEX; i++) {
109 (void)acpi_ut_delete_mutex(i); 116 (void)acpi_ut_delete_mutex(i);
110 } 117 }
111 118
119 /* Delete the spinlocks */
120
112 acpi_os_delete_lock(acpi_gbl_gpe_lock); 121 acpi_os_delete_lock(acpi_gbl_gpe_lock);
122 acpi_os_delete_lock(acpi_gbl_hardware_lock);
113 return_VOID; 123 return_VOID;
114} 124}
115 125
@@ -129,9 +139,9 @@ static acpi_status acpi_ut_create_mutex(acpi_mutex_handle mutex_id)
129{ 139{
130 acpi_status status = AE_OK; 140 acpi_status status = AE_OK;
131 141
132 ACPI_FUNCTION_TRACE_U32("ut_create_mutex", mutex_id); 142 ACPI_FUNCTION_TRACE_U32(ut_create_mutex, mutex_id);
133 143
134 if (mutex_id > MAX_MUTEX) { 144 if (mutex_id > ACPI_MAX_MUTEX) {
135 return_ACPI_STATUS(AE_BAD_PARAMETER); 145 return_ACPI_STATUS(AE_BAD_PARAMETER);
136 } 146 }
137 147
@@ -163,9 +173,9 @@ static acpi_status acpi_ut_delete_mutex(acpi_mutex_handle mutex_id)
163{ 173{
164 acpi_status status; 174 acpi_status status;
165 175
166 ACPI_FUNCTION_TRACE_U32("ut_delete_mutex", mutex_id); 176 ACPI_FUNCTION_TRACE_U32(ut_delete_mutex, mutex_id);
167 177
168 if (mutex_id > MAX_MUTEX) { 178 if (mutex_id > ACPI_MAX_MUTEX) {
169 return_ACPI_STATUS(AE_BAD_PARAMETER); 179 return_ACPI_STATUS(AE_BAD_PARAMETER);
170 } 180 }
171 181
@@ -192,11 +202,11 @@ static acpi_status acpi_ut_delete_mutex(acpi_mutex_handle mutex_id)
192acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id) 202acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id)
193{ 203{
194 acpi_status status; 204 acpi_status status;
195 u32 this_thread_id; 205 acpi_thread_id this_thread_id;
196 206
197 ACPI_FUNCTION_NAME("ut_acquire_mutex"); 207 ACPI_FUNCTION_NAME(ut_acquire_mutex);
198 208
199 if (mutex_id > MAX_MUTEX) { 209 if (mutex_id > ACPI_MAX_MUTEX) {
200 return (AE_BAD_PARAMETER); 210 return (AE_BAD_PARAMETER);
201 } 211 }
202 212
@@ -213,7 +223,7 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id)
213 * the mutex ordering rule. This indicates a coding error somewhere in 223 * the mutex ordering rule. This indicates a coding error somewhere in
214 * the ACPI subsystem code. 224 * the ACPI subsystem code.
215 */ 225 */
216 for (i = mutex_id; i < MAX_MUTEX; i++) { 226 for (i = mutex_id; i < ACPI_MAX_MUTEX; i++) {
217 if (acpi_gbl_mutex_info[i].thread_id == this_thread_id) { 227 if (acpi_gbl_mutex_info[i].thread_id == this_thread_id) {
218 if (i == mutex_id) { 228 if (i == mutex_id) {
219 ACPI_ERROR((AE_INFO, 229 ACPI_ERROR((AE_INFO,
@@ -275,16 +285,16 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id)
275acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id) 285acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id)
276{ 286{
277 acpi_status status; 287 acpi_status status;
278 u32 this_thread_id; 288 acpi_thread_id this_thread_id;
279 289
280 ACPI_FUNCTION_NAME("ut_release_mutex"); 290 ACPI_FUNCTION_NAME(ut_release_mutex);
281 291
282 this_thread_id = acpi_os_get_thread_id(); 292 this_thread_id = acpi_os_get_thread_id();
283 ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, 293 ACPI_DEBUG_PRINT((ACPI_DB_MUTEX,
284 "Thread %X releasing Mutex [%s]\n", this_thread_id, 294 "Thread %X releasing Mutex [%s]\n", this_thread_id,
285 acpi_ut_get_mutex_name(mutex_id))); 295 acpi_ut_get_mutex_name(mutex_id)));
286 296
287 if (mutex_id > MAX_MUTEX) { 297 if (mutex_id > ACPI_MAX_MUTEX) {
288 return (AE_BAD_PARAMETER); 298 return (AE_BAD_PARAMETER);
289 } 299 }
290 300
@@ -309,7 +319,7 @@ acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id)
309 * ordering rule. This indicates a coding error somewhere in 319 * ordering rule. This indicates a coding error somewhere in
310 * the ACPI subsystem code. 320 * the ACPI subsystem code.
311 */ 321 */
312 for (i = mutex_id; i < MAX_MUTEX; i++) { 322 for (i = mutex_id; i < ACPI_MAX_MUTEX; i++) {
313 if (acpi_gbl_mutex_info[i].thread_id == this_thread_id) { 323 if (acpi_gbl_mutex_info[i].thread_id == this_thread_id) {
314 if (i == mutex_id) { 324 if (i == mutex_id) {
315 continue; 325 continue;