diff options
Diffstat (limited to 'drivers/acpi/namespace/nsutils.c')
-rw-r--r-- | drivers/acpi/namespace/nsutils.c | 63 |
1 files changed, 31 insertions, 32 deletions
diff --git a/drivers/acpi/namespace/nsutils.c b/drivers/acpi/namespace/nsutils.c index d1d55032b455..aa4e799d9a8c 100644 --- a/drivers/acpi/namespace/nsutils.c +++ b/drivers/acpi/namespace/nsutils.c | |||
@@ -142,8 +142,9 @@ acpi_ns_report_method_error(char *module_name, | |||
142 | acpi_os_printf("ACPI Error (%s-%04d): ", module_name, line_number); | 142 | acpi_os_printf("ACPI Error (%s-%04d): ", module_name, line_number); |
143 | 143 | ||
144 | if (path) { | 144 | if (path) { |
145 | status = acpi_ns_get_node_by_path(path, prefix_node, | 145 | status = |
146 | ACPI_NS_NO_UPSEARCH, &node); | 146 | acpi_ns_get_node(prefix_node, path, ACPI_NS_NO_UPSEARCH, |
147 | &node); | ||
147 | if (ACPI_FAILURE(status)) { | 148 | if (ACPI_FAILURE(status)) { |
148 | acpi_os_printf("[Could not get node by pathname]"); | 149 | acpi_os_printf("[Could not get node by pathname]"); |
149 | } | 150 | } |
@@ -685,13 +686,9 @@ struct acpi_namespace_node *acpi_ns_map_handle_to_node(acpi_handle handle) | |||
685 | ACPI_FUNCTION_ENTRY(); | 686 | ACPI_FUNCTION_ENTRY(); |
686 | 687 | ||
687 | /* | 688 | /* |
688 | * Simple implementation. | 689 | * Simple implementation |
689 | */ | 690 | */ |
690 | if (!handle) { | 691 | if ((!handle) || (handle == ACPI_ROOT_OBJECT)) { |
691 | return (NULL); | ||
692 | } | ||
693 | |||
694 | if (handle == ACPI_ROOT_OBJECT) { | ||
695 | return (acpi_gbl_root_node); | 692 | return (acpi_gbl_root_node); |
696 | } | 693 | } |
697 | 694 | ||
@@ -701,7 +698,7 @@ struct acpi_namespace_node *acpi_ns_map_handle_to_node(acpi_handle handle) | |||
701 | return (NULL); | 698 | return (NULL); |
702 | } | 699 | } |
703 | 700 | ||
704 | return ((struct acpi_namespace_node *)handle); | 701 | return (ACPI_CAST_PTR(struct acpi_namespace_node, handle)); |
705 | } | 702 | } |
706 | 703 | ||
707 | /******************************************************************************* | 704 | /******************************************************************************* |
@@ -811,12 +808,12 @@ u32 acpi_ns_opens_scope(acpi_object_type type) | |||
811 | 808 | ||
812 | /******************************************************************************* | 809 | /******************************************************************************* |
813 | * | 810 | * |
814 | * FUNCTION: acpi_ns_get_node_by_path | 811 | * FUNCTION: acpi_ns_get_node |
815 | * | 812 | * |
816 | * PARAMETERS: *Pathname - Name to be found, in external (ASL) format. The | 813 | * PARAMETERS: *Pathname - Name to be found, in external (ASL) format. The |
817 | * \ (backslash) and ^ (carat) prefixes, and the | 814 | * \ (backslash) and ^ (carat) prefixes, and the |
818 | * . (period) to separate segments are supported. | 815 | * . (period) to separate segments are supported. |
819 | * start_node - Root of subtree to be searched, or NS_ALL for the | 816 | * prefix_node - Root of subtree to be searched, or NS_ALL for the |
820 | * root of the name space. If Name is fully | 817 | * root of the name space. If Name is fully |
821 | * qualified (first s8 is '\'), the passed value | 818 | * qualified (first s8 is '\'), the passed value |
822 | * of Scope will not be accessed. | 819 | * of Scope will not be accessed. |
@@ -832,24 +829,29 @@ u32 acpi_ns_opens_scope(acpi_object_type type) | |||
832 | ******************************************************************************/ | 829 | ******************************************************************************/ |
833 | 830 | ||
834 | acpi_status | 831 | acpi_status |
835 | acpi_ns_get_node_by_path(char *pathname, | 832 | acpi_ns_get_node(struct acpi_namespace_node *prefix_node, |
836 | struct acpi_namespace_node *start_node, | 833 | char *pathname, |
837 | u32 flags, struct acpi_namespace_node **return_node) | 834 | u32 flags, struct acpi_namespace_node **return_node) |
838 | { | 835 | { |
839 | union acpi_generic_state scope_info; | 836 | union acpi_generic_state scope_info; |
840 | acpi_status status; | 837 | acpi_status status; |
841 | char *internal_path = NULL; | 838 | char *internal_path; |
842 | 839 | ||
843 | ACPI_FUNCTION_TRACE_PTR(ns_get_node_by_path, pathname); | 840 | ACPI_FUNCTION_TRACE_PTR(ns_get_node, pathname); |
844 | 841 | ||
845 | if (pathname) { | 842 | if (!pathname) { |
843 | *return_node = prefix_node; | ||
844 | if (!prefix_node) { | ||
845 | *return_node = acpi_gbl_root_node; | ||
846 | } | ||
847 | return_ACPI_STATUS(AE_OK); | ||
848 | } | ||
846 | 849 | ||
847 | /* Convert path to internal representation */ | 850 | /* Convert path to internal representation */ |
848 | 851 | ||
849 | status = acpi_ns_internalize_name(pathname, &internal_path); | 852 | status = acpi_ns_internalize_name(pathname, &internal_path); |
850 | if (ACPI_FAILURE(status)) { | 853 | if (ACPI_FAILURE(status)) { |
851 | return_ACPI_STATUS(status); | 854 | return_ACPI_STATUS(status); |
852 | } | ||
853 | } | 855 | } |
854 | 856 | ||
855 | /* Must lock namespace during lookup */ | 857 | /* Must lock namespace during lookup */ |
@@ -861,26 +863,23 @@ acpi_ns_get_node_by_path(char *pathname, | |||
861 | 863 | ||
862 | /* Setup lookup scope (search starting point) */ | 864 | /* Setup lookup scope (search starting point) */ |
863 | 865 | ||
864 | scope_info.scope.node = start_node; | 866 | scope_info.scope.node = prefix_node; |
865 | 867 | ||
866 | /* Lookup the name in the namespace */ | 868 | /* Lookup the name in the namespace */ |
867 | 869 | ||
868 | status = acpi_ns_lookup(&scope_info, internal_path, | 870 | status = acpi_ns_lookup(&scope_info, internal_path, ACPI_TYPE_ANY, |
869 | ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, | 871 | ACPI_IMODE_EXECUTE, |
870 | (flags | ACPI_NS_DONT_OPEN_SCOPE), | 872 | (flags | ACPI_NS_DONT_OPEN_SCOPE), NULL, |
871 | NULL, return_node); | 873 | return_node); |
872 | if (ACPI_FAILURE(status)) { | 874 | if (ACPI_FAILURE(status)) { |
873 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "%s, %s\n", | 875 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "%s, %s\n", |
874 | internal_path, | 876 | pathname, acpi_format_exception(status))); |
875 | acpi_format_exception(status))); | ||
876 | } | 877 | } |
877 | 878 | ||
878 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | 879 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); |
879 | 880 | ||
880 | cleanup: | 881 | cleanup: |
881 | if (internal_path) { | 882 | ACPI_FREE(internal_path); |
882 | ACPI_FREE(internal_path); | ||
883 | } | ||
884 | return_ACPI_STATUS(status); | 883 | return_ACPI_STATUS(status); |
885 | } | 884 | } |
886 | 885 | ||