diff options
author | Lv Zheng <lv.zheng@intel.com> | 2016-09-07 02:07:02 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2016-09-09 20:43:02 -0400 |
commit | c2d981aaed431c6af46f0a17907ed825946a5839 (patch) | |
tree | ccc56461c347eaaf7355ce37412b4e954a4168cc /drivers/acpi | |
parent | de56ba95e8d6d760910711744a548b50b3a4262d (diff) |
ACPICA: Namespace: Add acpi_ns_get_node_unlocked()
ACPICA commit 3ef1a1bf5612fe1a629424c09eaaeb6f299d313c
Add acpi_ns_get_node_unlocked() to be used when ACPI_MTX_NAMESPACE is
locked. Lv Zheng.
Link: https://github.com/acpica/acpica/commit/3ef1a1bf
Tested-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Tested-by: Greg White <gwhite@kupulau.com>
Tested-by: Dutch Guy <lucht_piloot@gmx.net>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/acpica/acnamesp.h | 5 | ||||
-rw-r--r-- | drivers/acpi/acpica/nsutils.c | 66 |
2 files changed, 55 insertions, 16 deletions
diff --git a/drivers/acpi/acpica/acnamesp.h b/drivers/acpi/acpica/acnamesp.h index 829672a288bd..bb7fca1c8ba3 100644 --- a/drivers/acpi/acpica/acnamesp.h +++ b/drivers/acpi/acpica/acnamesp.h | |||
@@ -299,6 +299,11 @@ u8 | |||
299 | acpi_ns_pattern_match(struct acpi_namespace_node *obj_node, char *search_for); | 299 | acpi_ns_pattern_match(struct acpi_namespace_node *obj_node, char *search_for); |
300 | 300 | ||
301 | acpi_status | 301 | acpi_status |
302 | acpi_ns_get_node_unlocked(struct acpi_namespace_node *prefix_node, | ||
303 | const char *external_pathname, | ||
304 | u32 flags, struct acpi_namespace_node **out_node); | ||
305 | |||
306 | acpi_status | ||
302 | acpi_ns_get_node(struct acpi_namespace_node *prefix_node, | 307 | acpi_ns_get_node(struct acpi_namespace_node *prefix_node, |
303 | const char *external_pathname, | 308 | const char *external_pathname, |
304 | u32 flags, struct acpi_namespace_node **out_node); | 309 | u32 flags, struct acpi_namespace_node **out_node); |
diff --git a/drivers/acpi/acpica/nsutils.c b/drivers/acpi/acpica/nsutils.c index 784a30b76e0f..691814dfed31 100644 --- a/drivers/acpi/acpica/nsutils.c +++ b/drivers/acpi/acpica/nsutils.c | |||
@@ -662,7 +662,7 @@ u32 acpi_ns_opens_scope(acpi_object_type type) | |||
662 | 662 | ||
663 | /******************************************************************************* | 663 | /******************************************************************************* |
664 | * | 664 | * |
665 | * FUNCTION: acpi_ns_get_node | 665 | * FUNCTION: acpi_ns_get_node_unlocked |
666 | * | 666 | * |
667 | * PARAMETERS: *pathname - Name to be found, in external (ASL) format. The | 667 | * PARAMETERS: *pathname - Name to be found, in external (ASL) format. The |
668 | * \ (backslash) and ^ (carat) prefixes, and the | 668 | * \ (backslash) and ^ (carat) prefixes, and the |
@@ -678,20 +678,21 @@ u32 acpi_ns_opens_scope(acpi_object_type type) | |||
678 | * DESCRIPTION: Look up a name relative to a given scope and return the | 678 | * DESCRIPTION: Look up a name relative to a given scope and return the |
679 | * corresponding Node. NOTE: Scope can be null. | 679 | * corresponding Node. NOTE: Scope can be null. |
680 | * | 680 | * |
681 | * MUTEX: Locks namespace | 681 | * MUTEX: Doesn't locks namespace |
682 | * | 682 | * |
683 | ******************************************************************************/ | 683 | ******************************************************************************/ |
684 | 684 | ||
685 | acpi_status | 685 | acpi_status |
686 | acpi_ns_get_node(struct acpi_namespace_node *prefix_node, | 686 | acpi_ns_get_node_unlocked(struct acpi_namespace_node *prefix_node, |
687 | const char *pathname, | 687 | const char *pathname, |
688 | u32 flags, struct acpi_namespace_node **return_node) | 688 | u32 flags, struct acpi_namespace_node **return_node) |
689 | { | 689 | { |
690 | union acpi_generic_state scope_info; | 690 | union acpi_generic_state scope_info; |
691 | acpi_status status; | 691 | acpi_status status; |
692 | char *internal_path; | 692 | char *internal_path; |
693 | 693 | ||
694 | ACPI_FUNCTION_TRACE_PTR(ns_get_node, ACPI_CAST_PTR(char, pathname)); | 694 | ACPI_FUNCTION_TRACE_PTR(ns_get_node_unlocked, |
695 | ACPI_CAST_PTR(char, pathname)); | ||
695 | 696 | ||
696 | /* Simplest case is a null pathname */ | 697 | /* Simplest case is a null pathname */ |
697 | 698 | ||
@@ -718,13 +719,6 @@ acpi_ns_get_node(struct acpi_namespace_node *prefix_node, | |||
718 | return_ACPI_STATUS(status); | 719 | return_ACPI_STATUS(status); |
719 | } | 720 | } |
720 | 721 | ||
721 | /* Must lock namespace during lookup */ | ||
722 | |||
723 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | ||
724 | if (ACPI_FAILURE(status)) { | ||
725 | goto cleanup; | ||
726 | } | ||
727 | |||
728 | /* Setup lookup scope (search starting point) */ | 722 | /* Setup lookup scope (search starting point) */ |
729 | 723 | ||
730 | scope_info.scope.node = prefix_node; | 724 | scope_info.scope.node = prefix_node; |
@@ -740,9 +734,49 @@ acpi_ns_get_node(struct acpi_namespace_node *prefix_node, | |||
740 | pathname, acpi_format_exception(status))); | 734 | pathname, acpi_format_exception(status))); |
741 | } | 735 | } |
742 | 736 | ||
743 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | ||
744 | |||
745 | cleanup: | ||
746 | ACPI_FREE(internal_path); | 737 | ACPI_FREE(internal_path); |
747 | return_ACPI_STATUS(status); | 738 | return_ACPI_STATUS(status); |
748 | } | 739 | } |
740 | |||
741 | /******************************************************************************* | ||
742 | * | ||
743 | * FUNCTION: acpi_ns_get_node | ||
744 | * | ||
745 | * PARAMETERS: *pathname - Name to be found, in external (ASL) format. The | ||
746 | * \ (backslash) and ^ (carat) prefixes, and the | ||
747 | * . (period) to separate segments are supported. | ||
748 | * prefix_node - Root of subtree to be searched, or NS_ALL for the | ||
749 | * root of the name space. If Name is fully | ||
750 | * qualified (first s8 is '\'), the passed value | ||
751 | * of Scope will not be accessed. | ||
752 | * flags - Used to indicate whether to perform upsearch or | ||
753 | * not. | ||
754 | * return_node - Where the Node is returned | ||
755 | * | ||
756 | * DESCRIPTION: Look up a name relative to a given scope and return the | ||
757 | * corresponding Node. NOTE: Scope can be null. | ||
758 | * | ||
759 | * MUTEX: Locks namespace | ||
760 | * | ||
761 | ******************************************************************************/ | ||
762 | |||
763 | acpi_status | ||
764 | acpi_ns_get_node(struct acpi_namespace_node *prefix_node, | ||
765 | const char *pathname, | ||
766 | u32 flags, struct acpi_namespace_node **return_node) | ||
767 | { | ||
768 | acpi_status status; | ||
769 | |||
770 | ACPI_FUNCTION_TRACE_PTR(ns_get_node, ACPI_CAST_PTR(char, pathname)); | ||
771 | |||
772 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | ||
773 | if (ACPI_FAILURE(status)) { | ||
774 | return_ACPI_STATUS(status); | ||
775 | } | ||
776 | |||
777 | status = acpi_ns_get_node_unlocked(prefix_node, pathname, | ||
778 | flags, return_node); | ||
779 | |||
780 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | ||
781 | return_ACPI_STATUS(status); | ||
782 | } | ||