sound/hda/core/ext/bus.c
Source file repositories/reference/linux-study-clean/sound/hda/core/ext/bus.c
File Facts
- System
- Linux kernel
- Corpus path
sound/hda/core/ext/bus.c- Extension
.c- Size
- 3634 bytes
- Lines
- 143
- Domain
- Driver Families
- Bucket
- sound/hda
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/module.hlinux/slab.hlinux/io.hsound/hdaudio_ext.h
Detected Declarations
function snd_hdac_ext_bus_initfunction snd_hdac_ext_bus_exitfunction snd_hdac_ext_bus_device_removefunction hda_ext_drv_probefunction hdac_ext_drv_removefunction hdac_ext_drv_shutdownfunction snd_hda_ext_driver_registerfunction snd_hda_ext_driver_unregisterexport snd_hdac_ext_bus_initexport snd_hdac_ext_bus_exitexport snd_hdac_ext_bus_device_removeexport snd_hda_ext_driver_registerexport snd_hda_ext_driver_unregister
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
/*
* hdac-ext-bus.c - HD-audio extended core bus functions.
*
* Copyright (C) 2014-2015 Intel Corp
* Author: Jeeja KP <jeeja.kp@intel.com>
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/io.h>
#include <sound/hdaudio_ext.h>
MODULE_DESCRIPTION("HDA extended core");
MODULE_LICENSE("GPL v2");
/**
* snd_hdac_ext_bus_init - initialize a HD-audio extended bus
* @bus: the pointer to HDAC bus object
* @dev: device pointer
* @ops: bus verb operators
* @ext_ops: operators used for ASoC HDA codec drivers
*
* Returns 0 if successful, or a negative error code.
*/
int snd_hdac_ext_bus_init(struct hdac_bus *bus, struct device *dev,
const struct hdac_bus_ops *ops,
const struct hdac_ext_bus_ops *ext_ops)
{
int ret;
ret = snd_hdac_bus_init(bus, dev, ops);
if (ret < 0)
return ret;
bus->ext_ops = ext_ops;
/* FIXME:
* Currently only one bus is supported, if there is device with more
* buses, bus->idx should be greater than 0, but there needs to be a
* reliable way to always assign same number.
*/
bus->idx = 0;
bus->cmd_dma_state = true;
return 0;
}
EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_init);
/**
* snd_hdac_ext_bus_exit - clean up a HD-audio extended bus
* @bus: the pointer to HDAC bus object
*/
void snd_hdac_ext_bus_exit(struct hdac_bus *bus)
{
snd_hdac_bus_exit(bus);
WARN_ON(!list_empty(&bus->hlink_list));
}
EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_exit);
/**
* snd_hdac_ext_bus_device_remove - remove HD-audio extended codec base devices
*
* @bus: the pointer to HDAC bus object
*/
void snd_hdac_ext_bus_device_remove(struct hdac_bus *bus)
{
struct hdac_device *codec, *__codec;
/*
* we need to remove all the codec devices objects created in the
* snd_hdac_ext_bus_device_init
*/
list_for_each_entry_safe(codec, __codec, &bus->codec_list, list) {
snd_hdac_device_unregister(codec);
put_device(&codec->dev);
}
}
EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_device_remove);
#define dev_to_hdac(dev) (container_of((dev), \
struct hdac_device, dev))
static inline struct hdac_driver *get_hdrv(struct device *dev)
{
struct hdac_driver *hdrv = drv_to_hdac_driver(dev->driver);
return hdrv;
}
static inline struct hdac_device *get_hdev(struct device *dev)
Annotation
- Immediate include surface: `linux/module.h`, `linux/slab.h`, `linux/io.h`, `sound/hdaudio_ext.h`.
- Detected declarations: `function snd_hdac_ext_bus_init`, `function snd_hdac_ext_bus_exit`, `function snd_hdac_ext_bus_device_remove`, `function hda_ext_drv_probe`, `function hdac_ext_drv_remove`, `function hdac_ext_drv_shutdown`, `function snd_hda_ext_driver_register`, `function snd_hda_ext_driver_unregister`, `export snd_hdac_ext_bus_init`, `export snd_hdac_ext_bus_exit`.
- Atlas domain: Driver Families / sound/hda.
- Implementation status: integration 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.