Skip to content

Commit

Permalink
Namespace: Add AcpiNsGetNodeUnlocked()
Browse files Browse the repository at this point in the history
Add AcpiNsGetNodeUnlocked() to be used when ACPI_MTX_NAMESPACE is
locked. Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
  • Loading branch information
Lv Zheng committed Aug 26, 2016
1 parent 0e24fb6 commit 3ef1a1b
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 15 deletions.
68 changes: 53 additions & 15 deletions source/components/namespace/nsutils.c
Expand Up @@ -843,7 +843,7 @@ AcpiNsOpensScope (

/*******************************************************************************
*
* FUNCTION: AcpiNsGetNode
* FUNCTION: AcpiNsGetNodeUnlocked
*
* PARAMETERS: *Pathname - Name to be found, in external (ASL) format. The
* \ (backslash) and ^ (carat) prefixes, and the
Expand All @@ -859,12 +859,12 @@ AcpiNsOpensScope (
* DESCRIPTION: Look up a name relative to a given scope and return the
* corresponding Node. NOTE: Scope can be null.
*
* MUTEX: Locks namespace
* MUTEX: Doesn't locks namespace
*
******************************************************************************/

ACPI_STATUS
AcpiNsGetNode (
AcpiNsGetNodeUnlocked (
ACPI_NAMESPACE_NODE *PrefixNode,
const char *Pathname,
UINT32 Flags,
Expand All @@ -875,7 +875,7 @@ AcpiNsGetNode (
char *InternalPath;


ACPI_FUNCTION_TRACE_PTR (NsGetNode, ACPI_CAST_PTR (char, Pathname));
ACPI_FUNCTION_TRACE_PTR (NsGetNodeUnlocked, ACPI_CAST_PTR (char, Pathname));


/* Simplest case is a null pathname */
Expand Down Expand Up @@ -907,14 +907,6 @@ AcpiNsGetNode (
return_ACPI_STATUS (Status);
}

/* Must lock namespace during lookup */

Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE (Status))
{
goto Cleanup;
}

/* Setup lookup scope (search starting point) */

ScopeInfo.Scope.Node = PrefixNode;
Expand All @@ -930,9 +922,55 @@ AcpiNsGetNode (
Pathname, AcpiFormatException (Status)));
}

(void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);

Cleanup:
ACPI_FREE (InternalPath);
return_ACPI_STATUS (Status);
}


/*******************************************************************************
*
* FUNCTION: AcpiNsGetNode
*
* PARAMETERS: *Pathname - Name to be found, in external (ASL) format. The
* \ (backslash) and ^ (carat) prefixes, and the
* . (period) to separate segments are supported.
* PrefixNode - Root of subtree to be searched, or NS_ALL for the
* root of the name space. If Name is fully
* qualified (first INT8 is '\'), the passed value
* of Scope will not be accessed.
* Flags - Used to indicate whether to perform upsearch or
* not.
* ReturnNode - 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
AcpiNsGetNode (
ACPI_NAMESPACE_NODE *PrefixNode,
const char *Pathname,
UINT32 Flags,
ACPI_NAMESPACE_NODE **ReturnNode)
{
ACPI_STATUS Status;


ACPI_FUNCTION_TRACE_PTR (NsGetNode, ACPI_CAST_PTR (char, Pathname));


Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}

Status = AcpiNsGetNodeUnlocked (PrefixNode, Pathname,
Flags, ReturnNode);

(void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
return_ACPI_STATUS (Status);
}
7 changes: 7 additions & 0 deletions source/include/acnamesp.h
Expand Up @@ -467,6 +467,13 @@ AcpiNsPatternMatch (
ACPI_NAMESPACE_NODE *ObjNode,
char *SearchFor);

ACPI_STATUS
AcpiNsGetNodeUnlocked (
ACPI_NAMESPACE_NODE *PrefixNode,
const char *ExternalPathname,
UINT32 Flags,
ACPI_NAMESPACE_NODE **OutNode);

ACPI_STATUS
AcpiNsGetNode (
ACPI_NAMESPACE_NODE *PrefixNode,
Expand Down

0 comments on commit 3ef1a1b

Please sign in to comment.