FreeBSD/sys/contrib/dev/acpica/components/namespace/nsalloc.c
/*******************************************************************************
 *
 * FUNCTION:    AcpiNsDeleteNamespaceSubtree
 *
 * PARAMETERS:  ParentNode      - Root of the subtree to be deleted
 *
 * RETURN:      None.
 *
 * DESCRIPTION: Delete a subtree of the namespace. This includes all objects
 *              stored within the subtree.
 *
 ******************************************************************************/
AcpiNsDeleteNamespaceSubtree
PARAMETERS:  ParentNode      - Root of the subtree to be deleted

None.

Delete a subtree of the namespace. This includes all objects
stored within the subtree.
AcpiNsDeleteNamespaceSubtree PARAMETERS : ParentNode - Root of the subtree to be deleted None . Delete a subtree of the namespace . This includes all objects stored within the subtree .
void
AcpiNsDeleteNamespaceSubtree (
    ACPI_NAMESPACE_NODE     *ParentNode)
{
    ACPI_NAMESPACE_NODE     *ChildNode = NULL;
    UINT32                  Level = 1;
    ACPI_STATUS             Status;
    ACPI_FUNCTION_TRACE (NsDeleteNamespaceSubtree);
    if (!ParentNode)
    {
        return_VOID;
    }
    Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
    if (ACPI_FAILURE (Status))
    {
        return_VOID;
    }
    while (Level > 0)
    {
        ChildNode = AcpiNsGetNextNode (ParentNode, ChildNode);
        if (ChildNode)
        {
            AcpiNsDetachObject (ChildNode);
            if (ChildNode->Child)
            {
                Level++;
                ParentNode = ChildNode;
                ChildNode  = NULL;
            }
        }
        else
        {
            Level--;
            AcpiNsDeleteChildren (ParentNode);
            ChildNode = ParentNode;
            ParentNode = ParentNode->Parent;
        }
    }
    (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
    return_VOID;
}
void AcpiNsDeleteNamespaceSubtree ( ACPI_NAMESPACE_NODE * ParentNode ) { ACPI_NAMESPACE_NODE * ChildNode = NULL ; UINT32 Level = 1 ; ACPI_STATUS Status ; ACPI_FUNCTION_TRACE ( NsDeleteNamespaceSubtree ) ; if ( ! ParentNode ) { return_VOID ; } Status = AcpiUtAcquireMutex ( ACPI_MTX_NAMESPACE ) ; if ( ACPI_FAILURE ( Status ) ) { return_VOID ; } while ( Level > 0 ) { ChildNode = AcpiNsGetNextNode ( ParentNode , ChildNode ) ; if ( ChildNode ) { AcpiNsDetachObject ( ChildNode ) ; if ( ChildNode -> Child ) { Level ++ ; ParentNode = ChildNode ; ChildNode = NULL ; } } else { Level -- ; AcpiNsDeleteChildren ( ParentNode ) ; ChildNode = ParentNode ; ParentNode = ParentNode -> Parent ; } } ( void ) AcpiUtReleaseMutex ( ACPI_MTX_NAMESPACE ) ; return_VOID ; }
FUNCTION:    AcpiNsDeleteNamespaceSubtree
 PARAMETERS:  ParentNode      - Root of the subtree to be deleted
FUNCTION : AcpiNsDeleteNamespaceSubtree PARAMETERS : ParentNode - Root of the subtree to be deleted
/* Lock namespace for possible update */ /*
     * Traverse the tree of objects until we bubble back up
     * to where we started.
     */ /* Get the next node in this scope (NULL if none) */ /* Found a child node - detach any attached object */ /* Check if this node has any children */ /*
                 * There is at least one child of this node,
                 * visit the node
                 */ /*
             * No more children of this parent node.
             * Move up to the grandparent.
             */ /*
             * Now delete all of the children of this parent
             * all at the same time.
             */ /* New "last child" is this parent node */ /* Move up the tree to the grandparent */