1/*******************************************************************************
2 *
3 * Module Name: nsalloc - Namespace allocation and deletion utilities
4 * $Revision: 82 $
5 *
6 ******************************************************************************/
7
8/******************************************************************************
9 *
10 * 1. Copyright Notice
11 *
12 * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
--- 174 unchanged lines hidden (view full) ---
187 ACPI_FUNCTION_TRACE_PTR ("NsDeleteNode", Node);
188
189
190 ParentNode = AcpiNsGetParentNode (Node);
191
192 PrevNode = NULL;
193 NextNode = ParentNode->Child;
194
195 /* Find the node that is the previous peer in the parent's child list */
196
197 while (NextNode != Node)
198 {
199 PrevNode = NextNode;
200 NextNode = PrevNode->Peer;
201 }
202
203 if (PrevNode)
204 {
205 /* Node is not first child, unlink it */
206
207 PrevNode->Peer = NextNode->Peer;
208 if (NextNode->Flags & ANOBJ_END_OF_PEER_LIST)
209 {
210 PrevNode->Flags |= ANOBJ_END_OF_PEER_LIST;
211 }
212 }
213 else
214 {
215 /* Node is first child (has no previous peer) */
216
217 if (NextNode->Flags & ANOBJ_END_OF_PEER_LIST)
218 {
219 /* No peers at all */
220
221 ParentNode->Child = NULL;
222 }
223 else
224 { /* Link peer list to parent */
225
226 ParentNode->Child = NextNode->Peer;
227 }
228 }
229
230
231 ACPI_MEM_TRACKING (AcpiGbl_MemoryLists[ACPI_MEM_LIST_NSNODE].TotalFreed++);
232
233 /*
234 * Detach an object if there is one then delete the node
235 */
--- 80 unchanged lines hidden (view full) ---
316
317void
318AcpiNsInstallNode (
319 ACPI_WALK_STATE *WalkState,
320 ACPI_NAMESPACE_NODE *ParentNode, /* Parent */
321 ACPI_NAMESPACE_NODE *Node, /* New Child*/
322 ACPI_OBJECT_TYPE Type)
323{
324 UINT16 OwnerId = 0;
325 ACPI_NAMESPACE_NODE *ChildNode;
326#ifdef ACPI_ALPHABETIC_NAMESPACE
327
328 ACPI_NAMESPACE_NODE *PreviousChildNode;
329#endif
330
331
332 ACPI_FUNCTION_TRACE ("NsInstallNode");
--- 126 unchanged lines hidden (view full) ---
459 ******************************************************************************/
460
461void
462AcpiNsDeleteChildren (
463 ACPI_NAMESPACE_NODE *ParentNode)
464{
465 ACPI_NAMESPACE_NODE *ChildNode;
466 ACPI_NAMESPACE_NODE *NextNode;
467 ACPI_NAMESPACE_NODE *Node;
468 UINT8 Flags;
469
470
471 ACPI_FUNCTION_TRACE_PTR ("NsDeleteChildren", ParentNode);
472
473
474 if (!ParentNode)
475 {
--- 32 unchanged lines hidden (view full) ---
508
509 ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Object %p, Remaining %X\n",
510 ChildNode, AcpiGbl_CurrentNodeCount));
511
512 /*
513 * Detach an object if there is one, then free the child node
514 */
515 AcpiNsDetachObject (ChildNode);
516
517 /*
518 * Decrement the reference count(s) of all parents up to
519 * the root! (counts were incremented when the node was created)
520 */
521 Node = ChildNode;
522 while ((Node = AcpiNsGetParentNode (Node)) != NULL)
523 {
524 Node->ReferenceCount--;
525 }
526
527 /* There should be only one reference remaining on this node */
528
529 if (ChildNode->ReferenceCount != 1)
530 {
531 ACPI_REPORT_WARNING (("Existing references (%d) on node being deleted (%p)\n",
532 ChildNode->ReferenceCount, ChildNode));
533 }
534
535 /* Now we can delete the node */
536
537 ACPI_MEM_FREE (ChildNode);
538
539 /* And move on to the next child in the list */
540
541 ChildNode = NextNode;
542
543 } while (!(Flags & ANOBJ_END_OF_PEER_LIST));
544
--- 102 unchanged lines hidden (view full) ---
647 * RETURN: None.
648 *
649 * DESCRIPTION: Remove a Node reference. Decrements the reference count
650 * of all parent Nodes up to the root. Any node along
651 * the way that reaches zero references is freed.
652 *
653 ******************************************************************************/
654
655void
656AcpiNsRemoveReference (
657 ACPI_NAMESPACE_NODE *Node)
658{
659 ACPI_NAMESPACE_NODE *ParentNode;
660 ACPI_NAMESPACE_NODE *ThisNode;
661
662
663 ACPI_FUNCTION_ENTRY ();
--- 137 unchanged lines hidden ---
2 *
3 * Module Name: nsalloc - Namespace allocation and deletion utilities
4 * $Revision: 82 $
5 *
6 ******************************************************************************/
7
8/******************************************************************************
9 *
10 * 1. Copyright Notice
11 *
12 * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
--- 174 unchanged lines hidden (view full) ---
187 ACPI_FUNCTION_TRACE_PTR ("NsDeleteNode", Node);
188
189
190 ParentNode = AcpiNsGetParentNode (Node);
191
192 PrevNode = NULL;
193 NextNode = ParentNode->Child;
194
195 /* Find the node that is the previous peer in the parent's child list */
196
197 while (NextNode != Node)
198 {
199 PrevNode = NextNode;
200 NextNode = PrevNode->Peer;
201 }
202
203 if (PrevNode)
204 {
205 /* Node is not first child, unlink it */
206
207 PrevNode->Peer = NextNode->Peer;
208 if (NextNode->Flags & ANOBJ_END_OF_PEER_LIST)
209 {
210 PrevNode->Flags |= ANOBJ_END_OF_PEER_LIST;
211 }
212 }
213 else
214 {
215 /* Node is first child (has no previous peer) */
216
217 if (NextNode->Flags & ANOBJ_END_OF_PEER_LIST)
218 {
219 /* No peers at all */
220
221 ParentNode->Child = NULL;
222 }
223 else
224 { /* Link peer list to parent */
225
226 ParentNode->Child = NextNode->Peer;
227 }
228 }
229
230
231 ACPI_MEM_TRACKING (AcpiGbl_MemoryLists[ACPI_MEM_LIST_NSNODE].TotalFreed++);
232
233 /*
234 * Detach an object if there is one then delete the node
235 */
--- 80 unchanged lines hidden (view full) ---
316
317void
318AcpiNsInstallNode (
319 ACPI_WALK_STATE *WalkState,
320 ACPI_NAMESPACE_NODE *ParentNode, /* Parent */
321 ACPI_NAMESPACE_NODE *Node, /* New Child*/
322 ACPI_OBJECT_TYPE Type)
323{
324 UINT16 OwnerId = 0;
325 ACPI_NAMESPACE_NODE *ChildNode;
326#ifdef ACPI_ALPHABETIC_NAMESPACE
327
328 ACPI_NAMESPACE_NODE *PreviousChildNode;
329#endif
330
331
332 ACPI_FUNCTION_TRACE ("NsInstallNode");
--- 126 unchanged lines hidden (view full) ---
459 ******************************************************************************/
460
461void
462AcpiNsDeleteChildren (
463 ACPI_NAMESPACE_NODE *ParentNode)
464{
465 ACPI_NAMESPACE_NODE *ChildNode;
466 ACPI_NAMESPACE_NODE *NextNode;
467 ACPI_NAMESPACE_NODE *Node;
468 UINT8 Flags;
469
470
471 ACPI_FUNCTION_TRACE_PTR ("NsDeleteChildren", ParentNode);
472
473
474 if (!ParentNode)
475 {
--- 32 unchanged lines hidden (view full) ---
508
509 ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Object %p, Remaining %X\n",
510 ChildNode, AcpiGbl_CurrentNodeCount));
511
512 /*
513 * Detach an object if there is one, then free the child node
514 */
515 AcpiNsDetachObject (ChildNode);
516
517 /*
518 * Decrement the reference count(s) of all parents up to
519 * the root! (counts were incremented when the node was created)
520 */
521 Node = ChildNode;
522 while ((Node = AcpiNsGetParentNode (Node)) != NULL)
523 {
524 Node->ReferenceCount--;
525 }
526
527 /* There should be only one reference remaining on this node */
528
529 if (ChildNode->ReferenceCount != 1)
530 {
531 ACPI_REPORT_WARNING (("Existing references (%d) on node being deleted (%p)\n",
532 ChildNode->ReferenceCount, ChildNode));
533 }
534
535 /* Now we can delete the node */
536
537 ACPI_MEM_FREE (ChildNode);
538
539 /* And move on to the next child in the list */
540
541 ChildNode = NextNode;
542
543 } while (!(Flags & ANOBJ_END_OF_PEER_LIST));
544
--- 102 unchanged lines hidden (view full) ---
647 * RETURN: None.
648 *
649 * DESCRIPTION: Remove a Node reference. Decrements the reference count
650 * of all parent Nodes up to the root. Any node along
651 * the way that reaches zero references is freed.
652 *
653 ******************************************************************************/
654
655void
656AcpiNsRemoveReference (
657 ACPI_NAMESPACE_NODE *Node)
658{
659 ACPI_NAMESPACE_NODE *ParentNode;
660 ACPI_NAMESPACE_NODE *ThisNode;
661
662
663 ACPI_FUNCTION_ENTRY ();
--- 137 unchanged lines hidden ---