*
* FUNCTION: acpi_ex_unlink_mutex
*
- * PARAMETERS: *obj_desc - The mutex to be unlinked
+ * PARAMETERS: obj_desc - The mutex to be unlinked
*
* RETURN: Status
*
return;
}
+ /* Doubly linked list */
+
if (obj_desc->mutex.next) {
(obj_desc->mutex.next)->mutex.prev = obj_desc->mutex.prev;
}
*
* FUNCTION: acpi_ex_link_mutex
*
- * PARAMETERS: *obj_desc - The mutex to be linked
- * *list_head - head of the "acquired_mutex" list
+ * PARAMETERS: obj_desc - The mutex to be linked
+ * list_head - head of the "acquired_mutex" list
*
* RETURN: Status
*
*
* FUNCTION: acpi_ex_acquire_mutex
*
- * PARAMETERS: *time_desc - The 'time to delay' object descriptor
- * *obj_desc - The object descriptor for this op
+ * PARAMETERS: time_desc - The 'time to delay' object descriptor
+ * obj_desc - The object descriptor for this op
*
* RETURN: Status
*
return_ACPI_STATUS (AE_AML_MUTEX_ORDER);
}
- /*
- * Support for multiple acquires by the owning thread
- */
+ /* Support for multiple acquires by the owning thread */
+
if (obj_desc->mutex.owner_thread) {
/* Special case for Global Lock, allow all threads */
return_ACPI_STATUS (status);
}
- /* Have the mutex, update mutex and walk info */
+ /* Have the mutex: update mutex and walk info and save the sync_level */
- obj_desc->mutex.owner_thread = walk_state->thread;
+ obj_desc->mutex.owner_thread = walk_state->thread;
obj_desc->mutex.acquisition_depth = 1;
+ obj_desc->mutex.original_sync_level = walk_state->thread->current_sync_level;
walk_state->thread->current_sync_level = obj_desc->mutex.sync_level;
*
* FUNCTION: acpi_ex_release_mutex
*
- * PARAMETERS: *obj_desc - The object descriptor for this op
+ * PARAMETERS: obj_desc - The object descriptor for this op
*
* RETURN: Status
*
return_ACPI_STATUS (AE_AML_MUTEX_ORDER);
}
- /*
- * Match multiple Acquires with multiple Releases
- */
+ /* Match multiple Acquires with multiple Releases */
+
obj_desc->mutex.acquisition_depth--;
if (obj_desc->mutex.acquisition_depth != 0) {
/* Just decrement the depth and return */
status = acpi_ex_system_release_mutex (obj_desc);
- /* Update the mutex and walk state */
+ /* Update the mutex and walk state, restore sync_level before acquire */
obj_desc->mutex.owner_thread = NULL;
- walk_state->thread->current_sync_level = obj_desc->mutex.sync_level;
+ walk_state->thread->current_sync_level = obj_desc->mutex.original_sync_level;
return_ACPI_STATUS (status);
}
*
* FUNCTION: acpi_ex_release_all_mutexes
*
- * PARAMETERS: *mutex_list - Head of the mutex list
+ * PARAMETERS: mutex_list - Head of the mutex list
*
* RETURN: Status
*
ACPI_FUNCTION_ENTRY ();
- /*
- * Traverse the list of owned mutexes, releasing each one.
- */
+ /* Traverse the list of owned mutexes, releasing each one */
+
while (next) {
this = next;
next = this->mutex.next;
/* Mark mutex unowned */
- this->mutex.owner_thread = NULL;
+ this->mutex.owner_thread = NULL;
+
+ /* Update Thread sync_level (Last mutex is the important one) */
+
+ thread->current_sync_level = this->mutex.original_sync_level;
}
}