drivers/acpi/acpica/nsalloc.c
Source file repositories/reference/linux-study-clean/drivers/acpi/acpica/nsalloc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/acpi/acpica/nsalloc.c- Extension
.c- Size
- 12715 bytes
- Lines
- 495
- Domain
- Driver Families
- Bucket
- drivers/acpi
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
acpi/acpi.haccommon.hacnamesp.h
Detected Declarations
function acpi_ns_delete_nodefunction acpi_ns_remove_nodefunction acpi_ns_install_nodefunction acpi_ns_delete_childrenfunction acpi_ns_delete_namespace_subtreefunction acpi_ns_delete_namespace_by_owner
Annotated Snippet
if (obj_desc->data.handler) {
obj_desc->data.handler(node, obj_desc->data.pointer);
}
next_desc = obj_desc->common.next_object;
acpi_ut_remove_reference(obj_desc);
obj_desc = next_desc;
}
/* Special case for the statically allocated root node */
if (node == acpi_gbl_root_node) {
return;
}
/* Now we can delete the node */
(void)acpi_os_release_object(acpi_gbl_namespace_cache, node);
ACPI_MEM_TRACKING(acpi_gbl_ns_node_list->total_freed++);
ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "Node %p, Remaining %X\n",
node, acpi_gbl_current_node_count));
}
/*******************************************************************************
*
* FUNCTION: acpi_ns_remove_node
*
* PARAMETERS: node - Node to be removed/deleted
*
* RETURN: None
*
* DESCRIPTION: Remove (unlink) and delete a namespace node
*
******************************************************************************/
void acpi_ns_remove_node(struct acpi_namespace_node *node)
{
struct acpi_namespace_node *parent_node;
struct acpi_namespace_node *prev_node;
struct acpi_namespace_node *next_node;
ACPI_FUNCTION_TRACE_PTR(ns_remove_node, node);
parent_node = node->parent;
prev_node = NULL;
next_node = parent_node->child;
/* Find the node that is the previous peer in the parent's child list */
while (next_node != node) {
prev_node = next_node;
next_node = next_node->peer;
}
if (prev_node) {
/* Node is not first child, unlink it */
prev_node->peer = node->peer;
} else {
/*
* Node is first child (has no previous peer).
* Link peer list to parent
*/
parent_node->child = node->peer;
}
/* Delete the node and any attached objects */
acpi_ns_delete_node(node);
return_VOID;
}
/*******************************************************************************
*
* FUNCTION: acpi_ns_install_node
*
* PARAMETERS: walk_state - Current state of the walk
* parent_node - The parent of the new Node
* node - The new Node to install
* type - ACPI object type of the new Node
*
* RETURN: None
*
* DESCRIPTION: Initialize a new namespace node and install it amongst
* its peers.
*
* Note: Current namespace lookup is linear search. This appears
Annotation
- Immediate include surface: `acpi/acpi.h`, `accommon.h`, `acnamesp.h`.
- Detected declarations: `function acpi_ns_delete_node`, `function acpi_ns_remove_node`, `function acpi_ns_install_node`, `function acpi_ns_delete_children`, `function acpi_ns_delete_namespace_subtree`, `function acpi_ns_delete_namespace_by_owner`.
- Atlas domain: Driver Families / drivers/acpi.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.