aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorBob Moore <robert.moore@intel.com>2008-04-10 11:06:37 -0400
committerLen Brown <len.brown@intel.com>2008-04-22 14:29:22 -0400
commitf02e9fa1ceee045f7d5c53d475032815752a2510 (patch)
tree52da78bd3ef6442418ad2dae6fa55aab964dc6b4 /drivers
parenta4df451a1055d97726ab890249bc3f941906fa75 (diff)
ACPICA: Misc fixes for recent global lock code update
Fixes as a result of running full validation test suite. Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acpi/events/evxface.c2
-rw-r--r--drivers/acpi/executer/exfield.c8
-rw-r--r--drivers/acpi/executer/exmutex.c23
-rw-r--r--drivers/acpi/executer/exutils.c11
4 files changed, 32 insertions, 12 deletions
diff --git a/drivers/acpi/events/evxface.c b/drivers/acpi/events/evxface.c
index dbf34a5fc1e0..e210aa2d76da 100644
--- a/drivers/acpi/events/evxface.c
+++ b/drivers/acpi/events/evxface.c
@@ -816,7 +816,7 @@ acpi_status acpi_release_global_lock(u32 handle)
816{ 816{
817 acpi_status status; 817 acpi_status status;
818 818
819 if (handle != acpi_gbl_global_lock_handle) { 819 if (!handle || (handle != acpi_gbl_global_lock_handle)) {
820 return (AE_NOT_ACQUIRED); 820 return (AE_NOT_ACQUIRED);
821 } 821 }
822 822
diff --git a/drivers/acpi/executer/exfield.c b/drivers/acpi/executer/exfield.c
index e66b367c4fb6..da772cb91d7f 100644
--- a/drivers/acpi/executer/exfield.c
+++ b/drivers/acpi/executer/exfield.c
@@ -122,7 +122,7 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state,
122 buffer.pointer), 122 buffer.pointer),
123 ACPI_READ | (obj_desc->field. 123 ACPI_READ | (obj_desc->field.
124 attribute << 16)); 124 attribute << 16));
125 acpi_ex_release_global_lock(); 125 acpi_ex_release_global_lock(obj_desc->common_field.field_flags);
126 goto exit; 126 goto exit;
127 } 127 }
128 128
@@ -177,7 +177,7 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state,
177 /* Read from the field */ 177 /* Read from the field */
178 178
179 status = acpi_ex_extract_from_field(obj_desc, buffer, (u32) length); 179 status = acpi_ex_extract_from_field(obj_desc, buffer, (u32) length);
180 acpi_ex_release_global_lock(); 180 acpi_ex_release_global_lock(obj_desc->common_field.field_flags);
181 181
182 exit: 182 exit:
183 if (ACPI_FAILURE(status)) { 183 if (ACPI_FAILURE(status)) {
@@ -284,7 +284,7 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc,
284 (acpi_integer *) buffer, 284 (acpi_integer *) buffer,
285 ACPI_WRITE | (obj_desc->field. 285 ACPI_WRITE | (obj_desc->field.
286 attribute << 16)); 286 attribute << 16));
287 acpi_ex_release_global_lock(); 287 acpi_ex_release_global_lock(obj_desc->common_field.field_flags);
288 288
289 *result_desc = buffer_desc; 289 *result_desc = buffer_desc;
290 return_ACPI_STATUS(status); 290 return_ACPI_STATUS(status);
@@ -364,7 +364,7 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc,
364 /* Write to the field */ 364 /* Write to the field */
365 365
366 status = acpi_ex_insert_into_field(obj_desc, buffer, length); 366 status = acpi_ex_insert_into_field(obj_desc, buffer, length);
367 acpi_ex_release_global_lock(); 367 acpi_ex_release_global_lock(obj_desc->common_field.field_flags);
368 368
369 /* Free temporary buffer if we used one */ 369 /* Free temporary buffer if we used one */
370 370
diff --git a/drivers/acpi/executer/exmutex.c b/drivers/acpi/executer/exmutex.c
index 32f24a8fba57..b8d035c00b61 100644
--- a/drivers/acpi/executer/exmutex.c
+++ b/drivers/acpi/executer/exmutex.c
@@ -156,6 +156,10 @@ acpi_ex_acquire_mutex_object(u16 timeout,
156 156
157 ACPI_FUNCTION_TRACE_PTR(ex_acquire_mutex_object, obj_desc); 157 ACPI_FUNCTION_TRACE_PTR(ex_acquire_mutex_object, obj_desc);
158 158
159 if (!obj_desc) {
160 return_ACPI_STATUS(AE_BAD_PARAMETER);
161 }
162
159 /* Support for multiple acquires by the owning thread */ 163 /* Support for multiple acquires by the owning thread */
160 164
161 if (obj_desc->mutex.thread_id == thread_id) { 165 if (obj_desc->mutex.thread_id == thread_id) {
@@ -290,6 +294,10 @@ acpi_status acpi_ex_release_mutex_object(union acpi_operand_object *obj_desc)
290 294
291 ACPI_FUNCTION_TRACE(ex_release_mutex_object); 295 ACPI_FUNCTION_TRACE(ex_release_mutex_object);
292 296
297 if (obj_desc->mutex.acquisition_depth == 0) {
298 return (AE_NOT_ACQUIRED);
299 }
300
293 /* Match multiple Acquires with multiple Releases */ 301 /* Match multiple Acquires with multiple Releases */
294 302
295 obj_desc->mutex.acquisition_depth--; 303 obj_desc->mutex.acquisition_depth--;
@@ -387,17 +395,22 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc,
387 */ 395 */
388 if (obj_desc->mutex.sync_level > walk_state->thread->current_sync_level) { 396 if (obj_desc->mutex.sync_level > walk_state->thread->current_sync_level) {
389 ACPI_ERROR((AE_INFO, 397 ACPI_ERROR((AE_INFO,
390 "Cannot release Mutex [%4.4s], incorrect SyncLevel", 398 "Cannot release Mutex [%4.4s], SyncLevel mismatch: mutex %d current %d",
391 acpi_ut_get_node_name(obj_desc->mutex.node))); 399 acpi_ut_get_node_name(obj_desc->mutex.node),
400 obj_desc->mutex.sync_level,
401 walk_state->thread->current_sync_level));
392 return_ACPI_STATUS(AE_AML_MUTEX_ORDER); 402 return_ACPI_STATUS(AE_AML_MUTEX_ORDER);
393 } 403 }
394 404
395 status = acpi_ex_release_mutex_object(obj_desc); 405 status = acpi_ex_release_mutex_object(obj_desc);
396 406
397 /* Restore the original sync_level */ 407 if (obj_desc->mutex.acquisition_depth == 0) {
408
409 /* Restore the original sync_level */
398 410
399 walk_state->thread->current_sync_level = 411 walk_state->thread->current_sync_level =
400 obj_desc->mutex.original_sync_level; 412 obj_desc->mutex.original_sync_level;
413 }
401 return_ACPI_STATUS(status); 414 return_ACPI_STATUS(status);
402} 415}
403 416
diff --git a/drivers/acpi/executer/exutils.c b/drivers/acpi/executer/exutils.c
index c40b191f70b5..fd543ee547ae 100644
--- a/drivers/acpi/executer/exutils.c
+++ b/drivers/acpi/executer/exutils.c
@@ -278,7 +278,8 @@ void acpi_ex_acquire_global_lock(u32 field_flags)
278 * 278 *
279 * FUNCTION: acpi_ex_release_global_lock 279 * FUNCTION: acpi_ex_release_global_lock
280 * 280 *
281 * PARAMETERS: None 281 * PARAMETERS: field_flags - Flags with Lock rule:
282 * always_lock or never_lock
282 * 283 *
283 * RETURN: None 284 * RETURN: None
284 * 285 *
@@ -286,12 +287,18 @@ void acpi_ex_acquire_global_lock(u32 field_flags)
286 * 287 *
287 ******************************************************************************/ 288 ******************************************************************************/
288 289
289void acpi_ex_release_global_lock(void) 290void acpi_ex_release_global_lock(u32 field_flags)
290{ 291{
291 acpi_status status; 292 acpi_status status;
292 293
293 ACPI_FUNCTION_TRACE(ex_release_global_lock); 294 ACPI_FUNCTION_TRACE(ex_release_global_lock);
294 295
296 /* Only use the lock if the always_lock bit is set */
297
298 if (!(field_flags & AML_FIELD_LOCK_RULE_MASK)) {
299 return_VOID;
300 }
301
295 /* Release the global lock */ 302 /* Release the global lock */
296 303
297 status = acpi_ex_release_mutex_object(acpi_gbl_global_lock_mutex); 304 status = acpi_ex_release_mutex_object(acpi_gbl_global_lock_mutex);