Skip to content

Commit 3d774d5

Browse files
committed
ALSA: seq: Allow the tristate build of OSS emulation
Currently OSS sequencer emulation is tied with ALSA sequencer core, both are built in the same level; i.e. when CONFIG_SND_SEQUENCER=y, the OSS sequencer emulation is also always built-in, even though the functionality can be built as an individual module. This patch changes the rule and allows users to build snd-seq-oss module while others are built-in. Essentially, it's just a few simple changes in Kconfig and Makefile. Some driver codes like opl3 need to convert from the simple ifdef to IS_ENABLED(). But that's all. You might wonder how about the dependency: right, it can be messy, but it still works. Since we rewrote the sequencer binding with the standard bus, the driver can be bound at any time on demand. So, the synthesizer driver module can be loaded individually from the OSS emulation core before/after it. Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent eb3b705 commit 3d774d5

11 files changed

Lines changed: 22 additions & 28 deletions

File tree

‎include/sound/emux_synth.h‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@
2525
#include <sound/seq_device.h>
2626
#include <sound/soundfont.h>
2727
#include <sound/seq_midi_emul.h>
28-
#ifdef CONFIG_SND_SEQUENCER_OSS
2928
#include <sound/seq_oss.h>
30-
#endif
3129
#include <sound/emux_legacy.h>
3230
#include <sound/seq_virmidi.h>
3331

@@ -66,7 +64,7 @@ struct snd_emux_operators {
6664
const void __user *data, long count);
6765
void (*sysex)(struct snd_emux *emu, char *buf, int len, int parsed,
6866
struct snd_midi_channel_set *chset);
69-
#ifdef CONFIG_SND_SEQUENCER_OSS
67+
#if IS_ENABLED(CONFIG_SND_SEQUENCER_OSS)
7068
int (*oss_ioctl)(struct snd_emux *emu, int cmd, int p1, int p2);
7169
#endif
7270
};
@@ -129,7 +127,7 @@ struct snd_emux {
129127
struct snd_info_entry *proc;
130128
#endif
131129

132-
#ifdef CONFIG_SND_SEQUENCER_OSS
130+
#if IS_ENABLED(CONFIG_SND_SEQUENCER_OSS)
133131
struct snd_seq_device *oss_synth;
134132
#endif
135133
};
@@ -150,7 +148,7 @@ struct snd_emux_port {
150148
#ifdef SNDRV_EMUX_USE_RAW_EFFECT
151149
struct snd_emux_effect_table *effect;
152150
#endif
153-
#ifdef CONFIG_SND_SEQUENCER_OSS
151+
#if IS_ENABLED(CONFIG_SND_SEQUENCER_OSS)
154152
struct snd_seq_oss_arg *oss_arg;
155153
#endif
156154
};

‎include/sound/opl3.h‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,8 @@
5555
#include <sound/hwdep.h>
5656
#include <sound/timer.h>
5757
#include <sound/seq_midi_emul.h>
58-
#ifdef CONFIG_SND_SEQUENCER_OSS
5958
#include <sound/seq_oss.h>
6059
#include <sound/seq_oss_legacy.h>
61-
#endif
6260
#include <sound/seq_device.h>
6361
#include <sound/asound_fm.h>
6462

@@ -330,7 +328,7 @@ struct snd_opl3 {
330328
struct snd_seq_device *seq_dev; /* sequencer device */
331329
struct snd_midi_channel_set * chset;
332330

333-
#ifdef CONFIG_SND_SEQUENCER_OSS
331+
#if IS_ENABLED(CONFIG_SND_SEQUENCER_OSS)
334332
struct snd_seq_device *oss_seq_dev; /* OSS sequencer device */
335333
struct snd_midi_channel_set * oss_chset;
336334
#endif

‎sound/core/Kconfig‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ config SND_PCM_TIMER
110110
footprint, about 20KB on x86_64 platform.
111111

112112
config SND_SEQUENCER_OSS
113-
bool "OSS Sequencer API"
113+
tristate "OSS Sequencer API"
114114
depends on SND_SEQUENCER
115115
depends on SND_OSSEMUL
116116
help

‎sound/core/seq/Makefile‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,9 @@ snd-seq-dummy-objs := seq_dummy.o
1515
snd-seq-virmidi-objs := seq_virmidi.o
1616

1717
obj-$(CONFIG_SND_SEQUENCER) += snd-seq.o snd-seq-device.o
18-
ifeq ($(CONFIG_SND_SEQUENCER_OSS),y)
19-
obj-$(CONFIG_SND_SEQUENCER) += snd-seq-midi-event.o
20-
obj-$(CONFIG_SND_SEQUENCER) += oss/
21-
endif
18+
obj-$(CONFIG_SND_SEQUENCER_OSS) += snd-seq-midi-event.o
19+
obj-$(CONFIG_SND_SEQUENCER_OSS) += oss/
20+
2221
obj-$(CONFIG_SND_SEQ_DUMMY) += snd-seq-dummy.o
2322

2423
# Toplevel Module Dependency

‎sound/core/seq/oss/Makefile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ snd-seq-oss-objs := seq_oss.o seq_oss_init.o seq_oss_timer.o seq_oss_ioctl.o \
77
seq_oss_event.o seq_oss_rw.o seq_oss_synth.o \
88
seq_oss_midi.o seq_oss_readq.o seq_oss_writeq.o
99

10-
obj-$(CONFIG_SND_SEQUENCER) += snd-seq-oss.o
10+
obj-$(CONFIG_SND_SEQUENCER_OSS) += snd-seq-oss.o

‎sound/drivers/opl3/opl3_seq.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ static int snd_opl3_seq_probe(struct device *_dev)
252252
spin_lock_init(&opl3->sys_timer_lock);
253253
opl3->sys_timer_status = 0;
254254

255-
#ifdef CONFIG_SND_SEQUENCER_OSS
255+
#if IS_ENABLED(CONFIG_SND_SEQUENCER_OSS)
256256
snd_opl3_init_seq_oss(opl3, name);
257257
#endif
258258
return 0;
@@ -267,7 +267,7 @@ static int snd_opl3_seq_remove(struct device *_dev)
267267
if (opl3 == NULL)
268268
return -EINVAL;
269269

270-
#ifdef CONFIG_SND_SEQUENCER_OSS
270+
#if IS_ENABLED(CONFIG_SND_SEQUENCER_OSS)
271271
snd_opl3_free_seq_oss(opl3);
272272
#endif
273273
if (opl3->seq_client >= 0) {

‎sound/drivers/opl3/opl3_voice.h‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,12 @@ void snd_opl3_load_drums(struct snd_opl3 *opl3);
4444
void snd_opl3_drum_switch(struct snd_opl3 *opl3, int note, int on_off, int vel, struct snd_midi_channel *chan);
4545

4646
/* Prototypes for opl3_oss.c */
47-
#ifdef CONFIG_SND_SEQUENCER_OSS
47+
#if IS_ENABLED(CONFIG_SND_SEQUENCER_OSS)
4848
void snd_opl3_init_seq_oss(struct snd_opl3 *opl3, char *name);
4949
void snd_opl3_free_seq_oss(struct snd_opl3 *opl3);
50+
#else
51+
#define snd_opl3_init_seq_oss(opl3, name) /* NOP */
52+
#define snd_opl3_free_seq_oss(opl3) /* NOP */
5053
#endif
5154

5255
#endif

‎sound/isa/sb/emu8000_callback.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ static void reset_voice(struct snd_emux *emu, int ch);
3636
static void terminate_voice(struct snd_emux_voice *vp);
3737
static void sysex(struct snd_emux *emu, char *buf, int len, int parsed,
3838
struct snd_midi_channel_set *chset);
39-
#ifdef CONFIG_SND_SEQUENCER_OSS
39+
#if IS_ENABLED(CONFIG_SND_SEQUENCER_OSS)
4040
static int oss_ioctl(struct snd_emux *emu, int cmd, int p1, int p2);
4141
#endif
4242
static int load_fx(struct snd_emux *emu, int type, int mode,
@@ -76,7 +76,7 @@ static struct snd_emux_operators emu8000_ops = {
7676
.sample_reset = snd_emu8000_sample_reset,
7777
.load_fx = load_fx,
7878
.sysex = sysex,
79-
#ifdef CONFIG_SND_SEQUENCER_OSS
79+
#if IS_ENABLED(CONFIG_SND_SEQUENCER_OSS)
8080
.oss_ioctl = oss_ioctl,
8181
#endif
8282
};
@@ -477,7 +477,7 @@ sysex(struct snd_emux *emu, char *buf, int len, int parsed, struct snd_midi_chan
477477
}
478478

479479

480-
#ifdef CONFIG_SND_SEQUENCER_OSS
480+
#if IS_ENABLED(CONFIG_SND_SEQUENCER_OSS)
481481
/*
482482
* OSS ioctl callback
483483
*/

‎sound/synth/emux/emux.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ int snd_emux_new(struct snd_emux **remu)
4747
mutex_init(&emu->register_mutex);
4848

4949
emu->client = -1;
50-
#ifdef CONFIG_SND_SEQUENCER_OSS
50+
#if IS_ENABLED(CONFIG_SND_SEQUENCER_OSS)
5151
emu->oss_synth = NULL;
5252
#endif
5353
emu->max_voices = 0;
@@ -123,7 +123,7 @@ int snd_emux_register(struct snd_emux *emu, struct snd_card *card, int index, ch
123123
snd_emux_init_voices(emu);
124124

125125
snd_emux_init_seq(emu, card, index);
126-
#ifdef CONFIG_SND_SEQUENCER_OSS
126+
#if IS_ENABLED(CONFIG_SND_SEQUENCER_OSS)
127127
snd_emux_init_seq_oss(emu);
128128
#endif
129129
snd_emux_init_virmidi(emu, card);
@@ -150,7 +150,7 @@ int snd_emux_free(struct snd_emux *emu)
150150

151151
snd_emux_proc_free(emu);
152152
snd_emux_delete_virmidi(emu);
153-
#ifdef CONFIG_SND_SEQUENCER_OSS
153+
#if IS_ENABLED(CONFIG_SND_SEQUENCER_OSS)
154154
snd_emux_detach_seq_oss(emu);
155155
#endif
156156
snd_emux_detach_seq(emu);

‎sound/synth/emux/emux_effect.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ effect_get_offset(struct snd_midi_channel *chan, int lo, int hi, int mode)
150150
return addr;
151151
}
152152

153-
#ifdef CONFIG_SND_SEQUENCER_OSS
153+
#if IS_ENABLED(CONFIG_SND_SEQUENCER_OSS)
154154
/* change effects - for OSS sequencer compatibility */
155155
void
156156
snd_emux_send_effect_oss(struct snd_emux_port *port,

0 commit comments

Comments
 (0)