sound/aoa/soundbus/core.c
Source file repositories/reference/linux-study-clean/sound/aoa/soundbus/core.c
File Facts
- System
- Linux kernel
- Corpus path
sound/aoa/soundbus/core.c- Extension
.c- Size
- 4545 bytes
- Lines
- 193
- Domain
- Driver Families
- Bucket
- sound/aoa
- 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/module.hlinux/of.hlinux/of_platform.hsoundbus.h
Detected Declarations
function soundbus_dev_putfunction soundbus_probefunction soundbus_ueventfunction soundbus_device_removefunction soundbus_device_shutdownfunction soundbus_add_onefunction soundbus_remove_onefunction soundbus_register_driverfunction soundbus_unregister_driverfunction soundbus_initfunction soundbus_exitmodule init soundbus_initexport soundbus_dev_getexport soundbus_dev_putexport soundbus_add_oneexport soundbus_remove_oneexport soundbus_register_driverexport soundbus_unregister_driver
Annotated Snippet
static const struct bus_type soundbus_bus_type = {
.name = "aoa-soundbus",
.probe = soundbus_probe,
.uevent = soundbus_uevent,
.remove = soundbus_device_remove,
.shutdown = soundbus_device_shutdown,
.dev_groups = soundbus_dev_groups,
};
int soundbus_add_one(struct soundbus_dev *dev)
{
static int devcount;
/* sanity checks */
if (!dev->attach_codec ||
!dev->ofdev.dev.of_node ||
dev->pcmname ||
dev->pcmid != -1) {
printk(KERN_ERR "soundbus: adding device failed sanity check!\n");
return -EINVAL;
}
dev_set_name(&dev->ofdev.dev, "soundbus:%x", ++devcount);
dev->ofdev.dev.bus = &soundbus_bus_type;
return of_device_register(&dev->ofdev);
}
EXPORT_SYMBOL_GPL(soundbus_add_one);
void soundbus_remove_one(struct soundbus_dev *dev)
{
of_device_unregister(&dev->ofdev);
}
EXPORT_SYMBOL_GPL(soundbus_remove_one);
int soundbus_register_driver(struct soundbus_driver *drv)
{
/* initialize common driver fields */
drv->driver.name = drv->name;
drv->driver.bus = &soundbus_bus_type;
/* register with core */
return driver_register(&drv->driver);
}
EXPORT_SYMBOL_GPL(soundbus_register_driver);
void soundbus_unregister_driver(struct soundbus_driver *drv)
{
driver_unregister(&drv->driver);
}
EXPORT_SYMBOL_GPL(soundbus_unregister_driver);
static int __init soundbus_init(void)
{
return bus_register(&soundbus_bus_type);
}
static void __exit soundbus_exit(void)
{
bus_unregister(&soundbus_bus_type);
}
subsys_initcall(soundbus_init);
module_exit(soundbus_exit);
Annotation
- Immediate include surface: `linux/module.h`, `linux/of.h`, `linux/of_platform.h`, `soundbus.h`.
- Detected declarations: `function soundbus_dev_put`, `function soundbus_probe`, `function soundbus_uevent`, `function soundbus_device_remove`, `function soundbus_device_shutdown`, `function soundbus_add_one`, `function soundbus_remove_one`, `function soundbus_register_driver`, `function soundbus_unregister_driver`, `function soundbus_init`.
- Atlas domain: Driver Families / sound/aoa.
- 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.