sound/ac97/snd_ac97_compat.c
Source file repositories/reference/linux-study-clean/sound/ac97/snd_ac97_compat.c
File Facts
- System
- Linux kernel
- Corpus path
sound/ac97/snd_ac97_compat.c- Extension
.c- Size
- 3025 bytes
- Lines
- 121
- Domain
- Driver Families
- Bucket
- sound/ac97
- 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.
- 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/list.hlinux/slab.hsound/ac97/codec.hsound/ac97/compat.hsound/ac97/controller.hsound/soc.hac97_core.h
Detected Declarations
function Copyrightfunction compat_ac97_resetfunction compat_ac97_warm_resetfunction compat_ac97_writefunction compat_ac97_readfunction snd_ac97_compat_releasefunction snd_ac97_resetexport snd_ac97_compat_allocexport snd_ac97_compat_releaseexport snd_ac97_reset
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (C) 2016 Robert Jarzmik <robert.jarzmik@free.fr>
*/
#include <linux/list.h>
#include <linux/slab.h>
#include <sound/ac97/codec.h>
#include <sound/ac97/compat.h>
#include <sound/ac97/controller.h>
#include <sound/soc.h>
#include "ac97_core.h"
static void compat_ac97_release(struct device *dev)
{
kfree(to_ac97_t(dev));
}
static void compat_ac97_reset(struct snd_ac97 *ac97)
{
struct ac97_codec_device *adev = to_ac97_device(ac97->private_data);
struct ac97_controller *actrl = adev->ac97_ctrl;
if (actrl->ops->reset)
actrl->ops->reset(actrl);
}
static void compat_ac97_warm_reset(struct snd_ac97 *ac97)
{
struct ac97_codec_device *adev = to_ac97_device(ac97->private_data);
struct ac97_controller *actrl = adev->ac97_ctrl;
if (actrl->ops->warm_reset)
actrl->ops->warm_reset(actrl);
}
static void compat_ac97_write(struct snd_ac97 *ac97, unsigned short reg,
unsigned short val)
{
struct ac97_codec_device *adev = to_ac97_device(ac97->private_data);
struct ac97_controller *actrl = adev->ac97_ctrl;
actrl->ops->write(actrl, ac97->num, reg, val);
}
static unsigned short compat_ac97_read(struct snd_ac97 *ac97,
unsigned short reg)
{
struct ac97_codec_device *adev = to_ac97_device(ac97->private_data);
struct ac97_controller *actrl = adev->ac97_ctrl;
return actrl->ops->read(actrl, ac97->num, reg);
}
static const struct snd_ac97_bus_ops compat_snd_ac97_bus_ops = {
.reset = compat_ac97_reset,
.warm_reset = compat_ac97_warm_reset,
.write = compat_ac97_write,
.read = compat_ac97_read,
};
static struct snd_ac97_bus compat_soc_ac97_bus = {
.ops = &compat_snd_ac97_bus_ops,
};
struct snd_ac97 *snd_ac97_compat_alloc(struct ac97_codec_device *adev)
{
struct snd_ac97 *ac97;
int ret;
ac97 = kzalloc_obj(struct snd_ac97);
if (ac97 == NULL)
return ERR_PTR(-ENOMEM);
ac97->private_data = adev;
ac97->bus = &compat_soc_ac97_bus;
ac97->dev.parent = &adev->dev;
ac97->dev.release = compat_ac97_release;
dev_set_name(&ac97->dev, "%s-compat", dev_name(&adev->dev));
ret = device_register(&ac97->dev);
if (ret) {
put_device(&ac97->dev);
return ERR_PTR(ret);
}
return ac97;
}
EXPORT_SYMBOL_GPL(snd_ac97_compat_alloc);
Annotation
- Immediate include surface: `linux/list.h`, `linux/slab.h`, `sound/ac97/codec.h`, `sound/ac97/compat.h`, `sound/ac97/controller.h`, `sound/soc.h`, `ac97_core.h`.
- Detected declarations: `function Copyright`, `function compat_ac97_reset`, `function compat_ac97_warm_reset`, `function compat_ac97_write`, `function compat_ac97_read`, `function snd_ac97_compat_release`, `function snd_ac97_reset`, `export snd_ac97_compat_alloc`, `export snd_ac97_compat_release`, `export snd_ac97_reset`.
- Atlas domain: Driver Families / sound/ac97.
- 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.