sound/synth/emux/emux_seq.c
Source file repositories/reference/linux-study-clean/sound/synth/emux/emux_seq.c
File Facts
- System
- Linux kernel
- Corpus path
sound/synth/emux/emux_seq.c- Extension
.c- Size
- 8062 bytes
- Lines
- 390
- 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.
- 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
emux_voice.hlinux/slab.hlinux/module.h
Detected Declarations
function snd_emux_init_seqfunction snd_emux_detach_seqfunction snd_emux_create_portfunction free_portfunction snd_emux_init_portfunction snd_emux_reset_portfunction snd_emux_event_inputfunction __snd_emux_inc_countfunction snd_emux_inc_countfunction __snd_emux_dec_countfunction snd_emux_dec_countfunction snd_emux_usefunction unusefunction snd_emux_init_virmidifunction snd_emux_delete_virmidi
Annotated Snippet
if (!p) {
dev_err(card->dev, "can't create port\n");
return -ENOMEM;
}
p->port_mode = SNDRV_EMUX_PORT_MODE_MIDI;
snd_emux_init_port(p);
emu->ports[i] = p->chset.port;
emu->portptrs[i] = p;
}
return 0;
}
/*
* Detach from the ports that were set up for this synthesizer and
* destroy the kernel client.
*/
void
snd_emux_detach_seq(struct snd_emux *emu)
{
if (emu->voices)
snd_emux_terminate_all(emu);
if (emu->client >= 0) {
snd_seq_delete_kernel_client(emu->client);
emu->client = -1;
}
}
/*
* create a sequencer port and channel_set
*/
struct snd_emux_port *
snd_emux_create_port(struct snd_emux *emu, char *name,
int max_channels, int oss_port,
struct snd_seq_port_callback *callback)
{
struct snd_emux_port *p;
int i, type, cap;
/* Allocate structures for this channel */
p = kzalloc_flex(*p, chset.channels, max_channels);
if (!p)
return NULL;
p->chset.max_channels = max_channels;
for (i = 0; i < max_channels; i++)
p->chset.channels[i].number = i;
p->chset.private_data = p;
p->emu = emu;
p->chset.client = emu->client;
#ifdef SNDRV_EMUX_USE_RAW_EFFECT
snd_emux_create_effect(p);
#endif
callback->private_free = free_port;
callback->private_data = p;
cap = SNDRV_SEQ_PORT_CAP_WRITE;
if (oss_port) {
type = SNDRV_SEQ_PORT_TYPE_SPECIFIC;
} else {
type = DEFAULT_MIDI_TYPE;
cap |= SNDRV_SEQ_PORT_CAP_SUBS_WRITE;
}
p->chset.port = snd_seq_event_port_attach(emu->client, callback,
cap, type, max_channels,
emu->max_voices, name);
return p;
}
/*
* release memory block for port
*/
static void
free_port(void *private_data)
{
struct snd_emux_port *p;
p = private_data;
if (p) {
#ifdef SNDRV_EMUX_USE_RAW_EFFECT
snd_emux_delete_effect(p);
Annotation
- Immediate include surface: `emux_voice.h`, `linux/slab.h`, `linux/module.h`.
- Detected declarations: `function snd_emux_init_seq`, `function snd_emux_detach_seq`, `function snd_emux_create_port`, `function free_port`, `function snd_emux_init_port`, `function snd_emux_reset_port`, `function snd_emux_event_input`, `function __snd_emux_inc_count`, `function snd_emux_inc_count`, `function __snd_emux_dec_count`.
- Atlas domain: Driver Families / sound/synth.
- Implementation status: source 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.