aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/acpica/nsxfeval.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/acpica/nsxfeval.c')
-rw-r--r--drivers/acpi/acpica/nsxfeval.c36
1 files changed, 27 insertions, 9 deletions
diff --git a/drivers/acpi/acpica/nsxfeval.c b/drivers/acpi/acpica/nsxfeval.c
index 22a7171ac1ed..045054037c2d 100644
--- a/drivers/acpi/acpica/nsxfeval.c
+++ b/drivers/acpi/acpica/nsxfeval.c
@@ -387,8 +387,7 @@ static void acpi_ns_resolve_references(struct acpi_evaluate_info *info)
387 387
388 /* We are interested in reference objects only */ 388 /* We are interested in reference objects only */
389 389
390 if (ACPI_GET_OBJECT_TYPE(info->return_object) != 390 if ((info->return_object)->common.type != ACPI_TYPE_LOCAL_REFERENCE) {
391 ACPI_TYPE_LOCAL_REFERENCE) {
392 return; 391 return;
393 } 392 }
394 393
@@ -476,21 +475,40 @@ acpi_walk_namespace(acpi_object_type type,
476 } 475 }
477 476
478 /* 477 /*
479 * Lock the namespace around the walk. 478 * Need to acquire the namespace reader lock to prevent interference
480 * The namespace will be unlocked/locked around each call 479 * with any concurrent table unloads (which causes the deletion of
481 * to the user function - since this function 480 * namespace objects). We cannot allow the deletion of a namespace node
482 * must be allowed to make Acpi calls itself. 481 * while the user function is using it. The exception to this are the
482 * nodes created and deleted during control method execution -- these
483 * nodes are marked as temporary nodes and are ignored by the namespace
484 * walk. Thus, control methods can be executed while holding the
485 * namespace deletion lock (and the user function can execute control
486 * methods.)
487 */
488 status = acpi_ut_acquire_read_lock(&acpi_gbl_namespace_rw_lock);
489 if (ACPI_FAILURE(status)) {
490 return status;
491 }
492
493 /*
494 * Lock the namespace around the walk. The namespace will be
495 * unlocked/locked around each call to the user function - since the user
496 * function must be allowed to make ACPICA calls itself (for example, it
497 * will typically execute control methods during device enumeration.)
483 */ 498 */
484 status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); 499 status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
485 if (ACPI_FAILURE(status)) { 500 if (ACPI_FAILURE(status)) {
486 return_ACPI_STATUS(status); 501 goto unlock_and_exit;
487 } 502 }
488 503
489 status = acpi_ns_walk_namespace(type, start_object, max_depth, 504 status = acpi_ns_walk_namespace(type, start_object, max_depth,
490 ACPI_NS_WALK_UNLOCK, 505 ACPI_NS_WALK_UNLOCK, user_function,
491 user_function, context, return_value); 506 context, return_value);
492 507
493 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); 508 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
509
510 unlock_and_exit:
511 (void)acpi_ut_release_read_lock(&acpi_gbl_namespace_rw_lock);
494 return_ACPI_STATUS(status); 512 return_ACPI_STATUS(status);
495} 513}
496 514