Commit c2d981aa authored by Lv Zheng's avatar Lv Zheng Committed by Rafael J. Wysocki

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/3ef1a1bfTested-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
Tested-by: default avatarGreg White <gwhite@kupulau.com>
Tested-by: default avatarDutch Guy <lucht_piloot@gmx.net>
Signed-off-by: default avatarLv Zheng <lv.zheng@intel.com>
Signed-off-by: default avatarBob Moore <robert.moore@intel.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent de56ba95
...@@ -298,6 +298,11 @@ acpi_ns_handle_to_pathname(acpi_handle target_handle, ...@@ -298,6 +298,11 @@ acpi_ns_handle_to_pathname(acpi_handle target_handle,
u8 u8
acpi_ns_pattern_match(struct acpi_namespace_node *obj_node, char *search_for); acpi_ns_pattern_match(struct acpi_namespace_node *obj_node, char *search_for);
acpi_status
acpi_ns_get_node_unlocked(struct acpi_namespace_node *prefix_node,
const char *external_pathname,
u32 flags, struct acpi_namespace_node **out_node);
acpi_status acpi_status
acpi_ns_get_node(struct acpi_namespace_node *prefix_node, acpi_ns_get_node(struct acpi_namespace_node *prefix_node,
const char *external_pathname, const char *external_pathname,
......
...@@ -662,7 +662,7 @@ u32 acpi_ns_opens_scope(acpi_object_type type) ...@@ -662,7 +662,7 @@ u32 acpi_ns_opens_scope(acpi_object_type type)
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: acpi_ns_get_node * FUNCTION: acpi_ns_get_node_unlocked
* *
* PARAMETERS: *pathname - Name to be found, in external (ASL) format. The * PARAMETERS: *pathname - Name to be found, in external (ASL) format. The
* \ (backslash) and ^ (carat) prefixes, and the * \ (backslash) and ^ (carat) prefixes, and the
...@@ -678,12 +678,12 @@ u32 acpi_ns_opens_scope(acpi_object_type type) ...@@ -678,12 +678,12 @@ u32 acpi_ns_opens_scope(acpi_object_type type)
* DESCRIPTION: Look up a name relative to a given scope and return the * DESCRIPTION: Look up a name relative to a given scope and return the
* corresponding Node. NOTE: Scope can be null. * corresponding Node. NOTE: Scope can be null.
* *
* MUTEX: Locks namespace * MUTEX: Doesn't locks namespace
* *
******************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_ns_get_node(struct acpi_namespace_node *prefix_node, acpi_ns_get_node_unlocked(struct acpi_namespace_node *prefix_node,
const char *pathname, const char *pathname,
u32 flags, struct acpi_namespace_node **return_node) u32 flags, struct acpi_namespace_node **return_node)
{ {
...@@ -691,7 +691,8 @@ acpi_ns_get_node(struct acpi_namespace_node *prefix_node, ...@@ -691,7 +691,8 @@ acpi_ns_get_node(struct acpi_namespace_node *prefix_node,
acpi_status status; acpi_status status;
char *internal_path; char *internal_path;
ACPI_FUNCTION_TRACE_PTR(ns_get_node, ACPI_CAST_PTR(char, pathname)); ACPI_FUNCTION_TRACE_PTR(ns_get_node_unlocked,
ACPI_CAST_PTR(char, pathname));
/* Simplest case is a null pathname */ /* Simplest case is a null pathname */
...@@ -718,13 +719,6 @@ acpi_ns_get_node(struct acpi_namespace_node *prefix_node, ...@@ -718,13 +719,6 @@ acpi_ns_get_node(struct acpi_namespace_node *prefix_node,
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
/* Must lock namespace during lookup */
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE(status)) {
goto cleanup;
}
/* Setup lookup scope (search starting point) */ /* Setup lookup scope (search starting point) */
scope_info.scope.node = prefix_node; scope_info.scope.node = prefix_node;
...@@ -740,9 +734,49 @@ acpi_ns_get_node(struct acpi_namespace_node *prefix_node, ...@@ -740,9 +734,49 @@ acpi_ns_get_node(struct acpi_namespace_node *prefix_node,
pathname, acpi_format_exception(status))); pathname, acpi_format_exception(status)));
} }
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
cleanup:
ACPI_FREE(internal_path); ACPI_FREE(internal_path);
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
/*******************************************************************************
*
* FUNCTION: acpi_ns_get_node
*
* PARAMETERS: *pathname - Name to be found, in external (ASL) format. The
* \ (backslash) and ^ (carat) prefixes, and the
* . (period) to separate segments are supported.
* prefix_node - Root of subtree to be searched, or NS_ALL for the
* root of the name space. If Name is fully
* qualified (first s8 is '\'), the passed value
* of Scope will not be accessed.
* flags - Used to indicate whether to perform upsearch or
* not.
* return_node - Where the Node is returned
*
* DESCRIPTION: Look up a name relative to a given scope and return the
* corresponding Node. NOTE: Scope can be null.
*
* MUTEX: Locks namespace
*
******************************************************************************/
acpi_status
acpi_ns_get_node(struct acpi_namespace_node *prefix_node,
const char *pathname,
u32 flags, struct acpi_namespace_node **return_node)
{
acpi_status status;
ACPI_FUNCTION_TRACE_PTR(ns_get_node, ACPI_CAST_PTR(char, pathname));
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
status = acpi_ns_get_node_unlocked(prefix_node, pathname,
flags, return_node);
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
return_ACPI_STATUS(status);
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment