Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+22 -28
+3 -5
include/sound/emux_synth.h
··· 25 25 #include <sound/seq_device.h> 26 26 #include <sound/soundfont.h> 27 27 #include <sound/seq_midi_emul.h> 28 - #ifdef CONFIG_SND_SEQUENCER_OSS 29 28 #include <sound/seq_oss.h> 30 - #endif 31 29 #include <sound/emux_legacy.h> 32 30 #include <sound/seq_virmidi.h> 33 31 ··· 64 66 const void __user *data, long count); 65 67 void (*sysex)(struct snd_emux *emu, char *buf, int len, int parsed, 66 68 struct snd_midi_channel_set *chset); 67 - #ifdef CONFIG_SND_SEQUENCER_OSS 69 + #if IS_ENABLED(CONFIG_SND_SEQUENCER_OSS) 68 70 int (*oss_ioctl)(struct snd_emux *emu, int cmd, int p1, int p2); 69 71 #endif 70 72 }; ··· 127 129 struct snd_info_entry *proc; 128 130 #endif 129 131 130 - #ifdef CONFIG_SND_SEQUENCER_OSS 132 + #if IS_ENABLED(CONFIG_SND_SEQUENCER_OSS) 131 133 struct snd_seq_device *oss_synth; 132 134 #endif 133 135 }; ··· 148 150 #ifdef SNDRV_EMUX_USE_RAW_EFFECT 149 151 struct snd_emux_effect_table *effect; 150 152 #endif 151 - #ifdef CONFIG_SND_SEQUENCER_OSS 153 + #if IS_ENABLED(CONFIG_SND_SEQUENCER_OSS) 152 154 struct snd_seq_oss_arg *oss_arg; 153 155 #endif 154 156 };
+1 -3
include/sound/opl3.h
··· 55 55 #include <sound/hwdep.h> 56 56 #include <sound/timer.h> 57 57 #include <sound/seq_midi_emul.h> 58 - #ifdef CONFIG_SND_SEQUENCER_OSS 59 58 #include <sound/seq_oss.h> 60 59 #include <sound/seq_oss_legacy.h> 61 - #endif 62 60 #include <sound/seq_device.h> 63 61 #include <sound/asound_fm.h> 64 62 ··· 328 330 struct snd_seq_device *seq_dev; /* sequencer device */ 329 331 struct snd_midi_channel_set * chset; 330 332 331 - #ifdef CONFIG_SND_SEQUENCER_OSS 333 + #if IS_ENABLED(CONFIG_SND_SEQUENCER_OSS) 332 334 struct snd_seq_device *oss_seq_dev; /* OSS sequencer device */ 333 335 struct snd_midi_channel_set * oss_chset; 334 336 #endif
+1 -1
sound/core/Kconfig
··· 110 110 footprint, about 20KB on x86_64 platform. 111 111 112 112 config SND_SEQUENCER_OSS 113 - bool "OSS Sequencer API" 113 + tristate "OSS Sequencer API" 114 114 depends on SND_SEQUENCER 115 115 depends on SND_OSSEMUL 116 116 help
+3 -4
sound/core/seq/Makefile
··· 15 15 snd-seq-virmidi-objs := seq_virmidi.o 16 16 17 17 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 + 22 21 obj-$(CONFIG_SND_SEQ_DUMMY) += snd-seq-dummy.o 23 22 24 23 # Toplevel Module Dependency
+1 -1
sound/core/seq/oss/Makefile
··· 7 7 seq_oss_event.o seq_oss_rw.o seq_oss_synth.o \ 8 8 seq_oss_midi.o seq_oss_readq.o seq_oss_writeq.o 9 9 10 - obj-$(CONFIG_SND_SEQUENCER) += snd-seq-oss.o 10 + obj-$(CONFIG_SND_SEQUENCER_OSS) += snd-seq-oss.o
+2 -2
sound/drivers/opl3/opl3_seq.c
··· 252 252 spin_lock_init(&opl3->sys_timer_lock); 253 253 opl3->sys_timer_status = 0; 254 254 255 - #ifdef CONFIG_SND_SEQUENCER_OSS 255 + #if IS_ENABLED(CONFIG_SND_SEQUENCER_OSS) 256 256 snd_opl3_init_seq_oss(opl3, name); 257 257 #endif 258 258 return 0; ··· 267 267 if (opl3 == NULL) 268 268 return -EINVAL; 269 269 270 - #ifdef CONFIG_SND_SEQUENCER_OSS 270 + #if IS_ENABLED(CONFIG_SND_SEQUENCER_OSS) 271 271 snd_opl3_free_seq_oss(opl3); 272 272 #endif 273 273 if (opl3->seq_client >= 0) {
+4 -1
sound/drivers/opl3/opl3_voice.h
··· 44 44 void snd_opl3_drum_switch(struct snd_opl3 *opl3, int note, int on_off, int vel, struct snd_midi_channel *chan); 45 45 46 46 /* Prototypes for opl3_oss.c */ 47 - #ifdef CONFIG_SND_SEQUENCER_OSS 47 + #if IS_ENABLED(CONFIG_SND_SEQUENCER_OSS) 48 48 void snd_opl3_init_seq_oss(struct snd_opl3 *opl3, char *name); 49 49 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 */ 50 53 #endif 51 54 52 55 #endif
+3 -3
sound/isa/sb/emu8000_callback.c
··· 36 36 static void terminate_voice(struct snd_emux_voice *vp); 37 37 static void sysex(struct snd_emux *emu, char *buf, int len, int parsed, 38 38 struct snd_midi_channel_set *chset); 39 - #ifdef CONFIG_SND_SEQUENCER_OSS 39 + #if IS_ENABLED(CONFIG_SND_SEQUENCER_OSS) 40 40 static int oss_ioctl(struct snd_emux *emu, int cmd, int p1, int p2); 41 41 #endif 42 42 static int load_fx(struct snd_emux *emu, int type, int mode, ··· 76 76 .sample_reset = snd_emu8000_sample_reset, 77 77 .load_fx = load_fx, 78 78 .sysex = sysex, 79 - #ifdef CONFIG_SND_SEQUENCER_OSS 79 + #if IS_ENABLED(CONFIG_SND_SEQUENCER_OSS) 80 80 .oss_ioctl = oss_ioctl, 81 81 #endif 82 82 }; ··· 477 477 } 478 478 479 479 480 - #ifdef CONFIG_SND_SEQUENCER_OSS 480 + #if IS_ENABLED(CONFIG_SND_SEQUENCER_OSS) 481 481 /* 482 482 * OSS ioctl callback 483 483 */
+3 -3
sound/synth/emux/emux.c
··· 47 47 mutex_init(&emu->register_mutex); 48 48 49 49 emu->client = -1; 50 - #ifdef CONFIG_SND_SEQUENCER_OSS 50 + #if IS_ENABLED(CONFIG_SND_SEQUENCER_OSS) 51 51 emu->oss_synth = NULL; 52 52 #endif 53 53 emu->max_voices = 0; ··· 123 123 snd_emux_init_voices(emu); 124 124 125 125 snd_emux_init_seq(emu, card, index); 126 - #ifdef CONFIG_SND_SEQUENCER_OSS 126 + #if IS_ENABLED(CONFIG_SND_SEQUENCER_OSS) 127 127 snd_emux_init_seq_oss(emu); 128 128 #endif 129 129 snd_emux_init_virmidi(emu, card); ··· 150 150 151 151 snd_emux_proc_free(emu); 152 152 snd_emux_delete_virmidi(emu); 153 - #ifdef CONFIG_SND_SEQUENCER_OSS 153 + #if IS_ENABLED(CONFIG_SND_SEQUENCER_OSS) 154 154 snd_emux_detach_seq_oss(emu); 155 155 #endif 156 156 snd_emux_detach_seq(emu);
+1 -1
sound/synth/emux/emux_effect.c
··· 150 150 return addr; 151 151 } 152 152 153 - #ifdef CONFIG_SND_SEQUENCER_OSS 153 + #if IS_ENABLED(CONFIG_SND_SEQUENCER_OSS) 154 154 /* change effects - for OSS sequencer compatibility */ 155 155 void 156 156 snd_emux_send_effect_oss(struct snd_emux_port *port,
-4
sound/synth/emux/emux_oss.c
··· 23 23 */ 24 24 25 25 26 - #ifdef CONFIG_SND_SEQUENCER_OSS 27 - 28 26 #include <linux/export.h> 29 27 #include <linux/uaccess.h> 30 28 #include <sound/core.h> ··· 503 505 ev.data.control.value = val; 504 506 snd_emux_event_input(&ev, 0, port, atomic, hop); 505 507 } 506 - 507 - #endif /* CONFIG_SND_SEQUENCER_OSS */