drivers/acpi/scan.c
Source file repositories/reference/linux-study-clean/drivers/acpi/scan.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/acpi/scan.c- Extension
.c- Size
- 76352 bytes
- Lines
- 2967
- Domain
- Driver Families
- Bucket
- drivers/acpi
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/async.hlinux/auxiliary_bus.hlinux/module.hlinux/init.hlinux/slab.hlinux/kernel.hlinux/acpi.hlinux/acpi_iort.hlinux/acpi_rimt.hlinux/acpi_viot.hlinux/iommu.hlinux/signal.hlinux/kthread.hlinux/dmi.hlinux/dma-map-ops.hlinux/platform_data/x86/apple.hlinux/pgtable.hlinux/crc32.hlinux/dma-direct.hinternal.hsleep.h
Detected Declarations
struct acpi_scan_system_devfunction acpi_scan_lock_acquirefunction acpi_scan_lock_releasefunction acpi_lock_hp_contextfunction acpi_unlock_hp_contextfunction acpi_initialize_hp_contextfunction acpi_scan_add_handlerfunction acpi_scan_add_handler_with_hotplugfunction acpi_scan_is_offlinefunction list_for_each_entryfunction acpi_bus_offlinefunction list_for_each_entryfunction acpi_bus_onlinefunction list_for_each_entryfunction acpi_scan_try_to_offlinefunction acpi_scan_check_and_detachfunction acpi_bus_post_ejectfunction acpi_scan_check_subtreefunction acpi_scan_hot_removefunction acpi_scan_rescan_busfunction acpi_scan_device_checkfunction appearedfunction acpi_scan_bus_checkfunction acpi_generic_hotplug_eventfunction acpi_device_hotplugfunction acpi_free_power_resources_listsfunction acpi_device_releasefunction acpi_device_delfunction list_for_each_entryfunction acpi_device_del_work_fnfunction acpi_ns_delete_nodefunction voidfunction get_acpi_devicefunction acpi_dev_putfunction acpi_device_set_namefunction acpi_tie_acpi_devfunction acpi_store_pld_crcfunction acpi_device_addfunction acpi_info_matches_idsfunction acpi_bus_get_ejdfunction acpi_bus_extract_wakeup_device_power_packagefunction acpi_wakeup_gpe_initfunction acpi_bus_get_wakeup_device_flagsfunction acpi_bus_init_power_statefunction acpi_bus_get_power_flagsfunction acpi_bus_get_flagsfunction acpi_device_get_busidfunction acpi_ata_match
Annotated Snippet
result = device_add(&device->dev);
if (result) {
dev_err(&device->dev, "Error registering device\n");
goto err;
}
acpi_device_setup_files(device);
return 0;
err:
mutex_lock(&acpi_device_lock);
list_del(&device->wakeup_list);
err_unlock:
mutex_unlock(&acpi_device_lock);
acpi_detach_data(device->handle, acpi_scan_drop_device);
return result;
}
/* --------------------------------------------------------------------------
Device Enumeration
-------------------------------------------------------------------------- */
static bool acpi_info_matches_ids(struct acpi_device_info *info,
const char * const ids[])
{
struct acpi_pnp_device_id_list *cid_list = NULL;
int i, index;
if (!(info->valid & ACPI_VALID_HID))
return false;
index = match_string(ids, -1, info->hardware_id.string);
if (index >= 0)
return true;
if (info->valid & ACPI_VALID_CID)
cid_list = &info->compatible_id_list;
if (!cid_list)
return false;
for (i = 0; i < cid_list->count; i++) {
index = match_string(ids, -1, cid_list->ids[i].string);
if (index >= 0)
return true;
}
return false;
}
/* List of HIDs for which we ignore matching ACPI devices, when checking _DEP lists. */
static const char * const acpi_ignore_dep_ids[] = {
"PNP0D80", /* Windows-compatible System Power Management Controller */
"INT33BD", /* Intel Baytrail Mailbox Device */
"LATT2021", /* Lattice FW Update Client Driver */
NULL
};
/* List of HIDs for which we honor deps of matching ACPI devs, when checking _DEP lists. */
static const char * const acpi_honor_dep_ids[] = {
"INT3472", /* Camera sensor PMIC / clk and regulator info */
"INTC1059", /* IVSC (TGL) driver must be loaded to allow i2c access to camera sensors */
"INTC1095", /* IVSC (ADL) driver must be loaded to allow i2c access to camera sensors */
"INTC100A", /* IVSC (RPL) driver must be loaded to allow i2c access to camera sensors */
"INTC10CF", /* IVSC (MTL) driver must be loaded to allow i2c access to camera sensors */
"INTC10DE", /* CVS (LNL) driver must be loaded to allow camera streaming */
"INTC10E0", /* CVS (ARL) driver must be loaded to allow camera streaming */
"INTC10E1", /* CVS (PTL) driver must be loaded to allow camera streaming */
"RSCV0001", /* RISC-V PLIC */
"RSCV0002", /* RISC-V APLIC */
"RSCV0005", /* RISC-V SBI MPXY MBOX */
"RSCV0006", /* RISC-V RPMI SYSMSI */
"PNP0C0F", /* PCI Link Device */
"ACPI0016", /* CXL/PCIe host bridge: CXL root (ACPI0017) depends on PCI root attach */
NULL
};
static struct acpi_device *acpi_find_parent_acpi_dev(acpi_handle handle)
{
struct acpi_device *adev;
/*
* Fixed hardware devices do not appear in the namespace and do not
* have handles, but we fabricate acpi_devices for them, so we have
* to deal with them specially.
*/
Annotation
- Immediate include surface: `linux/async.h`, `linux/auxiliary_bus.h`, `linux/module.h`, `linux/init.h`, `linux/slab.h`, `linux/kernel.h`, `linux/acpi.h`, `linux/acpi_iort.h`.
- Detected declarations: `struct acpi_scan_system_dev`, `function acpi_scan_lock_acquire`, `function acpi_scan_lock_release`, `function acpi_lock_hp_context`, `function acpi_unlock_hp_context`, `function acpi_initialize_hp_context`, `function acpi_scan_add_handler`, `function acpi_scan_add_handler_with_hotplug`, `function acpi_scan_is_offline`, `function list_for_each_entry`.
- Atlas domain: Driver Families / drivers/acpi.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.