drivers/acpi/acpica/uttrack.c
Source file repositories/reference/linux-study-clean/drivers/acpi/acpica/uttrack.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/acpi/acpica/uttrack.c- Extension
.c- Size
- 19017 bytes
- Lines
- 706
- 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.h
Detected Declarations
function acpi_ut_create_listfunction acpi_ut_free_and_trackfunction acpi_ut_track_allocationfunction acpi_ut_remove_allocationfunction acpi_ut_dump_allocation_infofunction acpi_ut_dump_allocations
Annotated Snippet
if (!element->next) {
return (element);
}
element = element->next;
}
if (element == allocation) {
return (element);
}
return (element->previous);
}
/*******************************************************************************
*
* FUNCTION: acpi_ut_track_allocation
*
* PARAMETERS: allocation - Address of allocated memory
* size - Size of the allocation
* alloc_type - MEM_MALLOC or MEM_CALLOC
* component - Component type of caller
* module - Source file name of caller
* line - Line number of caller
*
* RETURN: Status
*
* DESCRIPTION: Inserts an element into the global allocation tracking list.
*
******************************************************************************/
static acpi_status
acpi_ut_track_allocation(struct acpi_debug_mem_block *allocation,
acpi_size size,
u8 alloc_type,
u32 component, const char *module, u32 line)
{
struct acpi_memory_list *mem_list;
struct acpi_debug_mem_block *element;
acpi_status status = AE_OK;
ACPI_FUNCTION_TRACE_PTR(ut_track_allocation, allocation);
if (acpi_gbl_disable_mem_tracking) {
return_ACPI_STATUS(AE_OK);
}
mem_list = acpi_gbl_global_list;
status = acpi_ut_acquire_mutex(ACPI_MTX_MEMORY);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
/*
* Search the global list for this address to make sure it is not
* already present. This will catch several kinds of problems.
*/
element = acpi_ut_find_allocation(allocation);
if (element == allocation) {
ACPI_ERROR((AE_INFO,
"UtTrackAllocation: Allocation (%p) already present in global list!",
allocation));
goto unlock_and_exit;
}
/* Fill in the instance data */
allocation->size = (u32)size;
allocation->alloc_type = alloc_type;
allocation->component = component;
allocation->line = line;
acpi_ut_safe_strncpy(allocation->module, (char *)module,
ACPI_MAX_MODULE_NAME);
if (!element) {
/* Insert at list head */
if (mem_list->list_head) {
((struct acpi_debug_mem_block *)(mem_list->list_head))->
previous = allocation;
}
allocation->next = mem_list->list_head;
allocation->previous = NULL;
mem_list->list_head = allocation;
} else {
/* Insert after element */
Annotation
- Immediate include surface: `acpi/acpi.h`, `accommon.h`.
- Detected declarations: `function acpi_ut_create_list`, `function acpi_ut_free_and_track`, `function acpi_ut_track_allocation`, `function acpi_ut_remove_allocation`, `function acpi_ut_dump_allocation_info`, `function acpi_ut_dump_allocations`.
- 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.