sound/synth/emux/emux_oss.c
Source file repositories/reference/linux-study-clean/sound/synth/emux/emux_oss.c
File Facts
- System
- Linux kernel
- Corpus path
sound/synth/emux/emux_oss.c- Extension
.c- Size
- 11105 bytes
- Lines
- 493
- Domain
- Driver Families
- Bucket
- sound/synth
- Inferred role
- Driver Families: implementation source
- Status
- source 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.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/export.hlinux/uaccess.hsound/core.hemux_voice.hsound/asoundef.hlinux/ultrasound.h
Detected Declarations
function snd_emux_init_seq_ossfunction snd_emux_detach_seq_ossfunction snd_emux_open_seq_ossfunction reset_port_modefunction snd_emux_close_seq_ossfunction snd_emux_load_patch_seq_ossfunction snd_emux_ioctl_seq_ossfunction snd_emux_reset_seq_ossfunction snd_emux_event_oss_inputfunction emuspec_controlfunction gusspec_controlfunction fake_event
Annotated Snippet
else if (format == SNDRV_OSS_SOUNDFONT_PATCH) {
struct soundfont_patch_info patch;
if (count < (int)sizeof(patch))
return -EINVAL;
if (copy_from_user(&patch, buf, sizeof(patch)))
return -EFAULT;
if (patch.type >= SNDRV_SFNT_LOAD_INFO &&
patch.type <= SNDRV_SFNT_PROBE_DATA)
rc = snd_soundfont_load(emu->card, emu->sflist, buf,
count,
SF_CLIENT_NO(p->chset.port));
else {
if (emu->ops.load_fx)
rc = emu->ops.load_fx(emu, patch.type,
patch.optarg, buf, count);
else
rc = -EINVAL;
}
} else
rc = 0;
return rc;
}
/*
* ioctl
*/
static int
snd_emux_ioctl_seq_oss(struct snd_seq_oss_arg *arg, unsigned int cmd, unsigned long ioarg)
{
struct snd_emux_port *p;
struct snd_emux *emu;
if (snd_BUG_ON(!arg))
return -ENXIO;
p = arg->private_data;
if (snd_BUG_ON(!p))
return -ENXIO;
emu = p->emu;
if (snd_BUG_ON(!emu))
return -ENXIO;
switch (cmd) {
case SNDCTL_SEQ_RESETSAMPLES:
snd_soundfont_remove_samples(emu->sflist);
return 0;
case SNDCTL_SYNTH_MEMAVL:
if (emu->memhdr)
return snd_util_mem_avail(emu->memhdr);
return 0;
}
return 0;
}
/*
* reset device
*/
static int
snd_emux_reset_seq_oss(struct snd_seq_oss_arg *arg)
{
struct snd_emux_port *p;
if (snd_BUG_ON(!arg))
return -ENXIO;
p = arg->private_data;
if (snd_BUG_ON(!p))
return -ENXIO;
snd_emux_reset_port(p);
return 0;
}
/*
* receive raw events: only SEQ_PRIVATE is accepted.
*/
static int
snd_emux_event_oss_input(struct snd_seq_event *ev, int direct, void *private_data,
int atomic, int hop)
{
struct snd_emux *emu;
struct snd_emux_port *p;
unsigned char cmd, *data;
p = private_data;
if (snd_BUG_ON(!p))
return -EINVAL;
Annotation
- Immediate include surface: `linux/export.h`, `linux/uaccess.h`, `sound/core.h`, `emux_voice.h`, `sound/asoundef.h`, `linux/ultrasound.h`.
- Detected declarations: `function snd_emux_init_seq_oss`, `function snd_emux_detach_seq_oss`, `function snd_emux_open_seq_oss`, `function reset_port_mode`, `function snd_emux_close_seq_oss`, `function snd_emux_load_patch_seq_oss`, `function snd_emux_ioctl_seq_oss`, `function snd_emux_reset_seq_oss`, `function snd_emux_event_oss_input`, `function emuspec_control`.
- Atlas domain: Driver Families / sound/synth.
- Implementation status: source implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
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.