FreeBSD/sys/contrib/dev/acpica/components/namespace/nsobject.c
/*******************************************************************************
 *
 * FUNCTION:    AcpiNsDetachObject
 *
 * PARAMETERS:  Node           - A Namespace node whose object will be detached
 *
 * RETURN:      None.
 *
 * DESCRIPTION: Detach/delete an object associated with a namespace node.
 *              if the object is an allocated object, it is freed.
 *              Otherwise, the field is simply cleared.
 *
 ******************************************************************************/
AcpiNsDetachObject
PARAMETERS:  Node           - A Namespace node whose object will be detached

None.

Detach/delete an object associated with a namespace node.
if the object is an allocated object, it is freed.
Otherwise, the field is simply cleared.
AcpiNsDetachObject PARAMETERS : Node - A Namespace node whose object will be detached None . Detach / delete an object associated with a namespace node . if the object is an allocated object it is freed . Otherwise the field is simply cleared .
void
AcpiNsDetachObject (
    ACPI_NAMESPACE_NODE     *Node)
{
    ACPI_OPERAND_OBJECT     *ObjDesc;
    ACPI_FUNCTION_TRACE (NsDetachObject);
    ObjDesc = Node->Object;
    if (!ObjDesc ||
        (ObjDesc->Common.Type == ACPI_TYPE_LOCAL_DATA))
    {
        return_VOID;
    }
    if (Node->Flags & ANOBJ_ALLOCATED_BUFFER)
    {
        if (ObjDesc->Common.Type == ACPI_TYPE_METHOD)
        {
            ACPI_FREE (ObjDesc->Method.AmlStart);
        }
    }
    Node->Object = NULL;
    if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_OPERAND)
    {
        Node->Object = ObjDesc->Common.NextObject;
        if (Node->Object &&
           (Node->Object->Common.Type != ACPI_TYPE_LOCAL_DATA))
        {
            Node->Object = Node->Object->Common.NextObject;
        }
        if (ObjDesc->Common.NextObject &&
           ((ObjDesc->Common.NextObject)->Common.Type == ACPI_TYPE_LOCAL_DATA))
        {
           ObjDesc->Common.NextObject = NULL;
        }
    }
    Node->Type = ACPI_TYPE_ANY;
    ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Node %p [%4.4s] Object %p\n",
        Node, AcpiUtGetNodeName (Node), ObjDesc));
    AcpiUtRemoveReference (ObjDesc);
    return_VOID;
}
void AcpiNsDetachObject ( ACPI_NAMESPACE_NODE * Node ) { ACPI_OPERAND_OBJECT * ObjDesc ; ACPI_FUNCTION_TRACE ( NsDetachObject ) ; ObjDesc = Node -> Object ; if ( ! ObjDesc || ( ObjDesc -> Common . Type == ACPI_TYPE_LOCAL_DATA ) ) { return_VOID ; } if ( Node -> Flags & ANOBJ_ALLOCATED_BUFFER ) { if ( ObjDesc -> Common . Type == ACPI_TYPE_METHOD ) { ACPI_FREE ( ObjDesc -> Method . AmlStart ) ; } } Node -> Object = NULL ; if ( ACPI_GET_DESCRIPTOR_TYPE ( ObjDesc ) == ACPI_DESC_TYPE_OPERAND ) { Node -> Object = ObjDesc -> Common . NextObject ; if ( Node -> Object && ( Node -> Object -> Common . Type != ACPI_TYPE_LOCAL_DATA ) ) { Node -> Object = Node -> Object -> Common . NextObject ; } if ( ObjDesc -> Common . NextObject && ( ( ObjDesc -> Common . NextObject ) -> Common . Type == ACPI_TYPE_LOCAL_DATA ) ) { ObjDesc -> Common . NextObject = NULL ; } } Node -> Type = ACPI_TYPE_ANY ; ACPI_DEBUG_PRINT ( ( ACPI_DB_NAMES , " \n " , Node , AcpiUtGetNodeName ( Node ) , ObjDesc ) ) ; AcpiUtRemoveReference ( ObjDesc ) ; return_VOID ; }
FUNCTION:    AcpiNsDetachObject
 PARAMETERS:  Node           - A Namespace node whose object will be detached
FUNCTION : AcpiNsDetachObject PARAMETERS : Node - A Namespace node whose object will be detached
/* Free the dynamic aml buffer */ /* Clear the Node entry in all cases */ /* Unlink object from front of possible object list */ /* Handle possible 2-descriptor object */ /*
         * Detach the object from any data objects (which are still held by
         * the namespace node)
         */ /* Reset the node type to untyped */ /* Remove one reference on the object (and all subobjects) */