sound/hda/core/hda_bus_type.c
Source file repositories/reference/linux-study-clean/sound/hda/core/hda_bus_type.c
File Facts
- System
- Linux kernel
- Corpus path
sound/hda/core/hda_bus_type.c- Extension
.c- Size
- 2186 bytes
- Lines
- 98
- Domain
- Driver Families
- Bucket
- sound/hda
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/init.hlinux/device.hlinux/module.hlinux/mod_devicetable.hlinux/export.hsound/hdaudio.h
Detected Declarations
function hdac_get_device_idfunction hdac_codec_matchfunction hda_bus_matchfunction hda_ueventfunction hda_bus_initfunction hda_bus_exitmodule init hda_bus_initexport hdac_get_device_idexport snd_hda_bus_type
Annotated Snippet
static int hda_bus_match(struct device *dev, const struct device_driver *drv)
{
struct hdac_device *hdev = dev_to_hdac_dev(dev);
const struct hdac_driver *hdrv = drv_to_hdac_driver(drv);
if (hdev->type != hdrv->type)
return 0;
/*
* if driver provided a match function use that otherwise we will
* use hdac_codec_match function
*/
if (hdrv->match)
return hdrv->match(hdev, hdrv);
else
return hdac_codec_match(hdev, hdrv);
return 1;
}
static int hda_uevent(const struct device *dev, struct kobj_uevent_env *env)
{
char modalias[32];
snd_hdac_codec_modalias(dev_to_hdac_dev(dev), modalias,
sizeof(modalias));
if (add_uevent_var(env, "MODALIAS=%s", modalias))
return -ENOMEM;
return 0;
}
const struct bus_type snd_hda_bus_type = {
.name = "hdaudio",
.match = hda_bus_match,
.uevent = hda_uevent,
};
EXPORT_SYMBOL_GPL(snd_hda_bus_type);
static int __init hda_bus_init(void)
{
return bus_register(&snd_hda_bus_type);
}
static void __exit hda_bus_exit(void)
{
bus_unregister(&snd_hda_bus_type);
}
subsys_initcall(hda_bus_init);
module_exit(hda_bus_exit);
Annotation
- Immediate include surface: `linux/init.h`, `linux/device.h`, `linux/module.h`, `linux/mod_devicetable.h`, `linux/export.h`, `sound/hdaudio.h`.
- Detected declarations: `function hdac_get_device_id`, `function hdac_codec_match`, `function hda_bus_match`, `function hda_uevent`, `function hda_bus_init`, `function hda_bus_exit`, `module init hda_bus_init`, `export hdac_get_device_id`, `export snd_hda_bus_type`.
- Atlas domain: Driver Families / sound/hda.
- Implementation status: pattern 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.