aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/namespace/nsaccess.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/namespace/nsaccess.c')
-rw-r--r--drivers/acpi/namespace/nsaccess.c101
1 files changed, 62 insertions, 39 deletions
diff --git a/drivers/acpi/namespace/nsaccess.c b/drivers/acpi/namespace/nsaccess.c
index 57faf598bad8..c39a7f68b889 100644
--- a/drivers/acpi/namespace/nsaccess.c
+++ b/drivers/acpi/namespace/nsaccess.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2007, R. Byron Moore 8 * Copyright (C) 2000 - 2008, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -208,8 +208,7 @@ acpi_status acpi_ns_root_initialize(void)
208 /* Special case for ACPI Global Lock */ 208 /* Special case for ACPI Global Lock */
209 209
210 if (ACPI_STRCMP(init_val->name, "_GL_") == 0) { 210 if (ACPI_STRCMP(init_val->name, "_GL_") == 0) {
211 acpi_gbl_global_lock_mutex = 211 acpi_gbl_global_lock_mutex = obj_desc;
212 obj_desc->mutex.os_mutex;
213 212
214 /* Create additional counting semaphore for global lock */ 213 /* Create additional counting semaphore for global lock */
215 214
@@ -582,44 +581,68 @@ acpi_ns_lookup(union acpi_generic_state *scope_info,
582 return_ACPI_STATUS(status); 581 return_ACPI_STATUS(status);
583 } 582 }
584 583
585 /* 584 /* More segments to follow? */
586 * Sanity typecheck of the target object: 585
587 * 586 if (num_segments > 0) {
588 * If 1) This is the last segment (num_segments == 0) 587 /*
589 * 2) And we are looking for a specific type 588 * If we have an alias to an object that opens a scope (such as a
590 * (Not checking for TYPE_ANY) 589 * device or processor), we need to dereference the alias here so that
591 * 3) Which is not an alias 590 * we can access any children of the original node (via the remaining
592 * 4) Which is not a local type (TYPE_SCOPE) 591 * segments).
593 * 5) And the type of target object is known (not TYPE_ANY) 592 */
594 * 6) And target object does not match what we are looking for 593 if (this_node->type == ACPI_TYPE_LOCAL_ALIAS) {
595 * 594 if (acpi_ns_opens_scope
596 * Then we have a type mismatch. Just warn and ignore it. 595 (((struct acpi_namespace_node *)this_node->
597 */ 596 object)->type)) {
598 if ((num_segments == 0) && 597 this_node =
599 (type_to_check_for != ACPI_TYPE_ANY) && 598 (struct acpi_namespace_node *)
600 (type_to_check_for != ACPI_TYPE_LOCAL_ALIAS) && 599 this_node->object;
601 (type_to_check_for != ACPI_TYPE_LOCAL_METHOD_ALIAS) && 600 }
602 (type_to_check_for != ACPI_TYPE_LOCAL_SCOPE) && 601 }
603 (this_node->type != ACPI_TYPE_ANY) &&
604 (this_node->type != type_to_check_for)) {
605
606 /* Complain about a type mismatch */
607
608 ACPI_WARNING((AE_INFO,
609 "NsLookup: Type mismatch on %4.4s (%s), searching for (%s)",
610 ACPI_CAST_PTR(char, &simple_name),
611 acpi_ut_get_type_name(this_node->type),
612 acpi_ut_get_type_name
613 (type_to_check_for)));
614 } 602 }
615 603
616 /* 604 /* Special handling for the last segment (num_segments == 0) */
617 * If this is the last name segment and we are not looking for a 605
618 * specific type, but the type of found object is known, use that type 606 else {
619 * to see if it opens a scope. 607 /*
620 */ 608 * Sanity typecheck of the target object:
621 if ((num_segments == 0) && (type == ACPI_TYPE_ANY)) { 609 *
622 type = this_node->type; 610 * If 1) This is the last segment (num_segments == 0)
611 * 2) And we are looking for a specific type
612 * (Not checking for TYPE_ANY)
613 * 3) Which is not an alias
614 * 4) Which is not a local type (TYPE_SCOPE)
615 * 5) And the type of target object is known (not TYPE_ANY)
616 * 6) And target object does not match what we are looking for
617 *
618 * Then we have a type mismatch. Just warn and ignore it.
619 */
620 if ((type_to_check_for != ACPI_TYPE_ANY) &&
621 (type_to_check_for != ACPI_TYPE_LOCAL_ALIAS) &&
622 (type_to_check_for != ACPI_TYPE_LOCAL_METHOD_ALIAS)
623 && (type_to_check_for != ACPI_TYPE_LOCAL_SCOPE)
624 && (this_node->type != ACPI_TYPE_ANY)
625 && (this_node->type != type_to_check_for)) {
626
627 /* Complain about a type mismatch */
628
629 ACPI_WARNING((AE_INFO,
630 "NsLookup: Type mismatch on %4.4s (%s), searching for (%s)",
631 ACPI_CAST_PTR(char, &simple_name),
632 acpi_ut_get_type_name(this_node->
633 type),
634 acpi_ut_get_type_name
635 (type_to_check_for)));
636 }
637
638 /*
639 * If this is the last name segment and we are not looking for a
640 * specific type, but the type of found object is known, use that type
641 * to (later) see if it opens a scope.
642 */
643 if (type == ACPI_TYPE_ANY) {
644 type = this_node->type;
645 }
623 } 646 }
624 647
625 /* Point to next name segment and make this node current */ 648 /* Point to next name segment and make this node current */