diff options
Diffstat (limited to 'drivers/acpi/executer/exmutex.c')
-rw-r--r-- | drivers/acpi/executer/exmutex.c | 45 |
1 files changed, 29 insertions, 16 deletions
diff --git a/drivers/acpi/executer/exmutex.c b/drivers/acpi/executer/exmutex.c index 68c4bb1970a5..c3cb714d2cba 100644 --- a/drivers/acpi/executer/exmutex.c +++ b/drivers/acpi/executer/exmutex.c | |||
@@ -49,6 +49,13 @@ | |||
49 | #define _COMPONENT ACPI_EXECUTER | 49 | #define _COMPONENT ACPI_EXECUTER |
50 | ACPI_MODULE_NAME ("exmutex") | 50 | ACPI_MODULE_NAME ("exmutex") |
51 | 51 | ||
52 | /* Local prototypes */ | ||
53 | |||
54 | static void | ||
55 | acpi_ex_link_mutex ( | ||
56 | union acpi_operand_object *obj_desc, | ||
57 | struct acpi_thread_state *thread); | ||
58 | |||
52 | 59 | ||
53 | /******************************************************************************* | 60 | /******************************************************************************* |
54 | * | 61 | * |
@@ -56,7 +63,7 @@ | |||
56 | * | 63 | * |
57 | * PARAMETERS: obj_desc - The mutex to be unlinked | 64 | * PARAMETERS: obj_desc - The mutex to be unlinked |
58 | * | 65 | * |
59 | * RETURN: Status | 66 | * RETURN: None |
60 | * | 67 | * |
61 | * DESCRIPTION: Remove a mutex from the "acquired_mutex" list | 68 | * DESCRIPTION: Remove a mutex from the "acquired_mutex" list |
62 | * | 69 | * |
@@ -92,16 +99,16 @@ acpi_ex_unlink_mutex ( | |||
92 | * | 99 | * |
93 | * FUNCTION: acpi_ex_link_mutex | 100 | * FUNCTION: acpi_ex_link_mutex |
94 | * | 101 | * |
95 | * PARAMETERS: obj_desc - The mutex to be linked | 102 | * PARAMETERS: obj_desc - The mutex to be linked |
96 | * list_head - head of the "acquired_mutex" list | 103 | * Thread - Current executing thread object |
97 | * | 104 | * |
98 | * RETURN: Status | 105 | * RETURN: None |
99 | * | 106 | * |
100 | * DESCRIPTION: Add a mutex to the "acquired_mutex" list for this walk | 107 | * DESCRIPTION: Add a mutex to the "acquired_mutex" list for this walk |
101 | * | 108 | * |
102 | ******************************************************************************/ | 109 | ******************************************************************************/ |
103 | 110 | ||
104 | void | 111 | static void |
105 | acpi_ex_link_mutex ( | 112 | acpi_ex_link_mutex ( |
106 | union acpi_operand_object *obj_desc, | 113 | union acpi_operand_object *obj_desc, |
107 | struct acpi_thread_state *thread) | 114 | struct acpi_thread_state *thread) |
@@ -132,8 +139,9 @@ acpi_ex_link_mutex ( | |||
132 | * | 139 | * |
133 | * FUNCTION: acpi_ex_acquire_mutex | 140 | * FUNCTION: acpi_ex_acquire_mutex |
134 | * | 141 | * |
135 | * PARAMETERS: time_desc - The 'time to delay' object descriptor | 142 | * PARAMETERS: time_desc - Timeout integer |
136 | * obj_desc - The object descriptor for this op | 143 | * obj_desc - Mutex object |
144 | * walk_state - Current method execution state | ||
137 | * | 145 | * |
138 | * RETURN: Status | 146 | * RETURN: Status |
139 | * | 147 | * |
@@ -161,7 +169,7 @@ acpi_ex_acquire_mutex ( | |||
161 | 169 | ||
162 | if (!walk_state->thread) { | 170 | if (!walk_state->thread) { |
163 | ACPI_REPORT_ERROR (("Cannot acquire Mutex [%4.4s], null thread info\n", | 171 | ACPI_REPORT_ERROR (("Cannot acquire Mutex [%4.4s], null thread info\n", |
164 | acpi_ut_get_node_name (obj_desc->mutex.node))); | 172 | acpi_ut_get_node_name (obj_desc->mutex.node))); |
165 | return_ACPI_STATUS (AE_AML_INTERNAL); | 173 | return_ACPI_STATUS (AE_AML_INTERNAL); |
166 | } | 174 | } |
167 | 175 | ||
@@ -170,8 +178,9 @@ acpi_ex_acquire_mutex ( | |||
170 | * mutex. This mechanism provides some deadlock prevention | 178 | * mutex. This mechanism provides some deadlock prevention |
171 | */ | 179 | */ |
172 | if (walk_state->thread->current_sync_level > obj_desc->mutex.sync_level) { | 180 | if (walk_state->thread->current_sync_level > obj_desc->mutex.sync_level) { |
173 | ACPI_REPORT_ERROR (("Cannot acquire Mutex [%4.4s], incorrect sync_level\n", | 181 | ACPI_REPORT_ERROR (( |
174 | acpi_ut_get_node_name (obj_desc->mutex.node))); | 182 | "Cannot acquire Mutex [%4.4s], incorrect sync_level\n", |
183 | acpi_ut_get_node_name (obj_desc->mutex.node))); | ||
175 | return_ACPI_STATUS (AE_AML_MUTEX_ORDER); | 184 | return_ACPI_STATUS (AE_AML_MUTEX_ORDER); |
176 | } | 185 | } |
177 | 186 | ||
@@ -180,8 +189,10 @@ acpi_ex_acquire_mutex ( | |||
180 | if (obj_desc->mutex.owner_thread) { | 189 | if (obj_desc->mutex.owner_thread) { |
181 | /* Special case for Global Lock, allow all threads */ | 190 | /* Special case for Global Lock, allow all threads */ |
182 | 191 | ||
183 | if ((obj_desc->mutex.owner_thread->thread_id == walk_state->thread->thread_id) || | 192 | if ((obj_desc->mutex.owner_thread->thread_id == |
184 | (obj_desc->mutex.semaphore == acpi_gbl_global_lock_semaphore)) { | 193 | walk_state->thread->thread_id) || |
194 | (obj_desc->mutex.semaphore == | ||
195 | acpi_gbl_global_lock_semaphore)) { | ||
185 | /* | 196 | /* |
186 | * The mutex is already owned by this thread, | 197 | * The mutex is already owned by this thread, |
187 | * just increment the acquisition depth | 198 | * just increment the acquisition depth |
@@ -221,6 +232,7 @@ acpi_ex_acquire_mutex ( | |||
221 | * FUNCTION: acpi_ex_release_mutex | 232 | * FUNCTION: acpi_ex_release_mutex |
222 | * | 233 | * |
223 | * PARAMETERS: obj_desc - The object descriptor for this op | 234 | * PARAMETERS: obj_desc - The object descriptor for this op |
235 | * walk_state - Current method execution state | ||
224 | * | 236 | * |
225 | * RETURN: Status | 237 | * RETURN: Status |
226 | * | 238 | * |
@@ -278,8 +290,9 @@ acpi_ex_release_mutex ( | |||
278 | * equal to the current sync level | 290 | * equal to the current sync level |
279 | */ | 291 | */ |
280 | if (obj_desc->mutex.sync_level > walk_state->thread->current_sync_level) { | 292 | if (obj_desc->mutex.sync_level > walk_state->thread->current_sync_level) { |
281 | ACPI_REPORT_ERROR (("Cannot release Mutex [%4.4s], incorrect sync_level\n", | 293 | ACPI_REPORT_ERROR (( |
282 | acpi_ut_get_node_name (obj_desc->mutex.node))); | 294 | "Cannot release Mutex [%4.4s], incorrect sync_level\n", |
295 | acpi_ut_get_node_name (obj_desc->mutex.node))); | ||
283 | return_ACPI_STATUS (AE_AML_MUTEX_ORDER); | 296 | return_ACPI_STATUS (AE_AML_MUTEX_ORDER); |
284 | } | 297 | } |
285 | 298 | ||
@@ -313,11 +326,11 @@ acpi_ex_release_mutex ( | |||
313 | * | 326 | * |
314 | * FUNCTION: acpi_ex_release_all_mutexes | 327 | * FUNCTION: acpi_ex_release_all_mutexes |
315 | * | 328 | * |
316 | * PARAMETERS: mutex_list - Head of the mutex list | 329 | * PARAMETERS: Thread - Current executing thread object |
317 | * | 330 | * |
318 | * RETURN: Status | 331 | * RETURN: Status |
319 | * | 332 | * |
320 | * DESCRIPTION: Release all mutexes in the list | 333 | * DESCRIPTION: Release all mutexes held by this thread |
321 | * | 334 | * |
322 | ******************************************************************************/ | 335 | ******************************************************************************/ |
323 | 336 | ||