diff options
author | jkim <jkim@FreeBSD.org> | 2013-11-15 20:40:27 +0000 |
---|---|---|
committer | jkim <jkim@FreeBSD.org> | 2013-11-15 20:40:27 +0000 |
commit | a1672476f94b0c9ac84a682574aeb1eb481c484c (patch) | |
tree | 393e1854c22739c2db6213f80e859a02e4223818 /source/components/namespace | |
parent | f4a31baa14e08b26c3b63f02571280c872cabe90 (diff) | |
download | FreeBSD-src-a1672476f94b0c9ac84a682574aeb1eb481c484c.zip FreeBSD-src-a1672476f94b0c9ac84a682574aeb1eb481c484c.tar.gz |
Import ACPICA 20131115.
Diffstat (limited to 'source/components/namespace')
-rw-r--r-- | source/components/namespace/nsalloc.c | 19 | ||||
-rw-r--r-- | source/components/namespace/nsutils.c | 18 |
2 files changed, 25 insertions, 12 deletions
diff --git a/source/components/namespace/nsalloc.c b/source/components/namespace/nsalloc.c index 09b42f5..38ce8fc 100644 --- a/source/components/namespace/nsalloc.c +++ b/source/components/namespace/nsalloc.c @@ -121,6 +121,7 @@ AcpiNsDeleteNode ( ACPI_NAMESPACE_NODE *Node) { ACPI_OPERAND_OBJECT *ObjDesc; + ACPI_OPERAND_OBJECT *NextDesc; ACPI_FUNCTION_NAME (NsDeleteNode); @@ -131,12 +132,13 @@ AcpiNsDeleteNode ( AcpiNsDetachObject (Node); /* - * Delete an attached data object if present (an object that was created - * and attached via AcpiAttachData). Note: After any normal object is - * detached above, the only possible remaining object is a data object. + * Delete an attached data object list if present (objects that were + * attached via AcpiAttachData). Note: After any normal object is + * detached above, the only possible remaining object(s) are data + * objects, in a linked list. */ ObjDesc = Node->Object; - if (ObjDesc && + while (ObjDesc && (ObjDesc->Common.Type == ACPI_TYPE_LOCAL_DATA)) { /* Invoke the attached data deletion handler if present */ @@ -146,7 +148,16 @@ AcpiNsDeleteNode ( ObjDesc->Data.Handler (Node, ObjDesc->Data.Pointer); } + NextDesc = ObjDesc->Common.NextObject; AcpiUtRemoveReference (ObjDesc); + ObjDesc = NextDesc; + } + + /* Special case for the statically allocated root node */ + + if (Node == AcpiGbl_RootNode) + { + return; } /* Now we can delete the node */ diff --git a/source/components/namespace/nsutils.c b/source/components/namespace/nsutils.c index f2cf74f..ccecd6d 100644 --- a/source/components/namespace/nsutils.c +++ b/source/components/namespace/nsutils.c @@ -693,27 +693,29 @@ void AcpiNsTerminate ( void) { - ACPI_OPERAND_OBJECT *ObjDesc; + ACPI_STATUS Status; ACPI_FUNCTION_TRACE (NsTerminate); /* - * 1) Free the entire namespace -- all nodes and objects - * - * Delete all object descriptors attached to namepsace nodes + * Free the entire namespace -- all nodes and all objects + * attached to the nodes */ AcpiNsDeleteNamespaceSubtree (AcpiGbl_RootNode); - /* Detach any objects attached to the root */ + /* Delete any objects attached to the root node */ - ObjDesc = AcpiNsGetAttachedObject (AcpiGbl_RootNode); - if (ObjDesc) + Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE (Status)) { - AcpiNsDetachObject (AcpiGbl_RootNode); + return_VOID; } + AcpiNsDeleteNode (AcpiGbl_RootNode); + (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Namespace freed\n")); return_VOID; } |