drivers/acpi/bus.c
Source file repositories/reference/linux-study-clean/drivers/acpi/bus.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/acpi/bus.c- Extension
.c- Size
- 44280 bytes
- Lines
- 1602
- Domain
- Driver Families
- Bucket
- drivers/acpi
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern 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 an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/module.hlinux/init.hlinux/ioport.hlinux/kernel.hlinux/list.hlinux/sched.hlinux/pm.hlinux/device.hlinux/proc_fs.hlinux/acpi.hlinux/slab.hlinux/regulator/machine.hlinux/workqueue.hlinux/reboot.hlinux/delay.hasm/mpspec.hlinux/dmi.hlinux/acpi_viot.hlinux/pci.hacpi/apei.hlinux/suspend.hlinux/prmt.hinternal.h
Detected Declarations
struct acpi_notify_handler_devresstruct acpi_dev_walk_contextfunction set_copy_dsdtfunction set_copy_dsdtfunction acpi_bus_get_status_handlefunction acpi_bus_get_statusfunction acpi_bus_private_data_handlerfunction acpi_bus_attach_private_datafunction acpi_bus_get_private_datafunction acpi_bus_detach_private_datafunction acpi_dump_osc_datafunction acpi_eval_oscfunction acpi_osc_error_checkfunction acpi_run_oscfunction acpi_osc_handshakefunction acpi_bus_osc_negotiate_platform_controlfunction acpi_bus_decode_usb_oscfunction acpi_bus_osc_negotiate_usb_controlfunction acpi_bus_notifyfunction acpi_notify_devicefunction acpi_device_install_notify_handlerfunction acpi_device_remove_notify_handlerfunction acpi_dev_install_notify_handlerfunction acpi_dev_remove_notify_handlerfunction devm_acpi_notify_handler_releasefunction acpi_dev_install_notify_handlerfunction sb_notify_workfunction acpi_sb_notifyfunction acpi_setup_sb_notify_handlerfunction acpi_device_is_first_physical_nodefunction acpi_companion_matchfunction acpi_of_match_devicefunction acpi_of_modaliasfunction acpi_set_modaliasfunction __acpi_match_device_clsfunction __acpi_match_devicefunction list_for_each_entryfunction acpi_match_device_idsfunction acpi_driver_match_devicefunction __acpi_bus_register_driverfunction acpi_bus_unregister_driverfunction acpi_bus_matchfunction acpi_device_ueventfunction acpi_device_probefunction acpi_device_removefunction acpi_bus_for_each_devfunction acpi_dev_for_one_checkfunction acpi_dev_for_each_child
Annotated Snippet
const struct device_driver *drv)
{
const struct acpi_device_id *acpi_ids = drv->acpi_match_table;
const struct of_device_id *of_ids = drv->of_match_table;
if (!acpi_ids)
return acpi_of_match_device(ACPI_COMPANION(dev), of_ids, NULL);
return __acpi_match_device(acpi_companion_match(dev), acpi_ids, of_ids, NULL, NULL);
}
EXPORT_SYMBOL_GPL(acpi_driver_match_device);
/* --------------------------------------------------------------------------
ACPI Driver Management
-------------------------------------------------------------------------- */
/**
* __acpi_bus_register_driver - register a driver with the ACPI bus
* @driver: driver being registered
* @owner: owning module/driver
*
* Registers a driver with the ACPI bus. Searches the namespace for all
* devices that match the driver's criteria and binds. Returns zero for
* success or a negative error status for failure.
*/
int __acpi_bus_register_driver(struct acpi_driver *driver, struct module *owner)
{
if (acpi_disabled)
return -ENODEV;
driver->drv.name = driver->name;
driver->drv.bus = &acpi_bus_type;
driver->drv.owner = owner;
return driver_register(&driver->drv);
}
EXPORT_SYMBOL(__acpi_bus_register_driver);
/**
* acpi_bus_unregister_driver - unregisters a driver with the ACPI bus
* @driver: driver to unregister
*
* Unregisters a driver with the ACPI bus. Searches the namespace for all
* devices that match the driver's criteria and unbinds.
*/
void acpi_bus_unregister_driver(struct acpi_driver *driver)
{
driver_unregister(&driver->drv);
}
EXPORT_SYMBOL(acpi_bus_unregister_driver);
/* --------------------------------------------------------------------------
ACPI Bus operations
-------------------------------------------------------------------------- */
static int acpi_bus_match(struct device *dev, const struct device_driver *drv)
{
struct acpi_device *acpi_dev = to_acpi_device(dev);
const struct acpi_driver *acpi_drv = to_acpi_driver(drv);
return acpi_dev->flags.match_driver
&& !acpi_match_device_ids(acpi_dev, acpi_drv->ids);
}
static int acpi_device_uevent(const struct device *dev, struct kobj_uevent_env *env)
{
return __acpi_device_uevent_modalias(to_acpi_device(dev), env);
}
static int acpi_device_probe(struct device *dev)
{
struct acpi_device *acpi_dev = to_acpi_device(dev);
struct acpi_driver *acpi_drv = to_acpi_driver(dev->driver);
int ret;
if (acpi_dev->handler && !acpi_is_pnp_device(acpi_dev))
return -EINVAL;
if (!acpi_drv->ops.add)
return -ENOSYS;
ret = acpi_drv->ops.add(acpi_dev);
if (ret) {
acpi_dev->driver_data = NULL;
return ret;
}
pr_debug("Driver [%s] successfully bound to device [%s]\n",
acpi_drv->name, acpi_dev->pnp.bus_id);
Annotation
- Immediate include surface: `linux/module.h`, `linux/init.h`, `linux/ioport.h`, `linux/kernel.h`, `linux/list.h`, `linux/sched.h`, `linux/pm.h`, `linux/device.h`.
- Detected declarations: `struct acpi_notify_handler_devres`, `struct acpi_dev_walk_context`, `function set_copy_dsdt`, `function set_copy_dsdt`, `function acpi_bus_get_status_handle`, `function acpi_bus_get_status`, `function acpi_bus_private_data_handler`, `function acpi_bus_attach_private_data`, `function acpi_bus_get_private_data`, `function acpi_bus_detach_private_data`.
- Atlas domain: Driver Families / drivers/acpi.
- Implementation status: pattern implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.