Commit 3d774d5e authored by Takashi Iwai's avatar Takashi Iwai

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: default avatarTakashi Iwai <tiwai@suse.de>
parent eb3b705a
...@@ -25,9 +25,7 @@ ...@@ -25,9 +25,7 @@
#include <sound/seq_device.h> #include <sound/seq_device.h>
#include <sound/soundfont.h> #include <sound/soundfont.h>
#include <sound/seq_midi_emul.h> #include <sound/seq_midi_emul.h>
#ifdef CONFIG_SND_SEQUENCER_OSS
#include <sound/seq_oss.h> #include <sound/seq_oss.h>
#endif
#include <sound/emux_legacy.h> #include <sound/emux_legacy.h>
#include <sound/seq_virmidi.h> #include <sound/seq_virmidi.h>
...@@ -66,7 +64,7 @@ struct snd_emux_operators { ...@@ -66,7 +64,7 @@ struct snd_emux_operators {
const void __user *data, long count); const void __user *data, long count);
void (*sysex)(struct snd_emux *emu, char *buf, int len, int parsed, void (*sysex)(struct snd_emux *emu, char *buf, int len, int parsed,
struct snd_midi_channel_set *chset); struct snd_midi_channel_set *chset);
#ifdef CONFIG_SND_SEQUENCER_OSS #if IS_ENABLED(CONFIG_SND_SEQUENCER_OSS)
int (*oss_ioctl)(struct snd_emux *emu, int cmd, int p1, int p2); int (*oss_ioctl)(struct snd_emux *emu, int cmd, int p1, int p2);
#endif #endif
}; };
...@@ -129,7 +127,7 @@ struct snd_emux { ...@@ -129,7 +127,7 @@ struct snd_emux {
struct snd_info_entry *proc; struct snd_info_entry *proc;
#endif #endif
#ifdef CONFIG_SND_SEQUENCER_OSS #if IS_ENABLED(CONFIG_SND_SEQUENCER_OSS)
struct snd_seq_device *oss_synth; struct snd_seq_device *oss_synth;
#endif #endif
}; };
...@@ -150,7 +148,7 @@ struct snd_emux_port { ...@@ -150,7 +148,7 @@ struct snd_emux_port {
#ifdef SNDRV_EMUX_USE_RAW_EFFECT #ifdef SNDRV_EMUX_USE_RAW_EFFECT
struct snd_emux_effect_table *effect; struct snd_emux_effect_table *effect;
#endif #endif
#ifdef CONFIG_SND_SEQUENCER_OSS #if IS_ENABLED(CONFIG_SND_SEQUENCER_OSS)
struct snd_seq_oss_arg *oss_arg; struct snd_seq_oss_arg *oss_arg;
#endif #endif
}; };
......
...@@ -55,10 +55,8 @@ ...@@ -55,10 +55,8 @@
#include <sound/hwdep.h> #include <sound/hwdep.h>
#include <sound/timer.h> #include <sound/timer.h>
#include <sound/seq_midi_emul.h> #include <sound/seq_midi_emul.h>
#ifdef CONFIG_SND_SEQUENCER_OSS
#include <sound/seq_oss.h> #include <sound/seq_oss.h>
#include <sound/seq_oss_legacy.h> #include <sound/seq_oss_legacy.h>
#endif
#include <sound/seq_device.h> #include <sound/seq_device.h>
#include <sound/asound_fm.h> #include <sound/asound_fm.h>
...@@ -330,7 +328,7 @@ struct snd_opl3 { ...@@ -330,7 +328,7 @@ struct snd_opl3 {
struct snd_seq_device *seq_dev; /* sequencer device */ struct snd_seq_device *seq_dev; /* sequencer device */
struct snd_midi_channel_set * chset; struct snd_midi_channel_set * chset;
#ifdef CONFIG_SND_SEQUENCER_OSS #if IS_ENABLED(CONFIG_SND_SEQUENCER_OSS)
struct snd_seq_device *oss_seq_dev; /* OSS sequencer device */ struct snd_seq_device *oss_seq_dev; /* OSS sequencer device */
struct snd_midi_channel_set * oss_chset; struct snd_midi_channel_set * oss_chset;
#endif #endif
......
...@@ -110,7 +110,7 @@ config SND_PCM_TIMER ...@@ -110,7 +110,7 @@ config SND_PCM_TIMER
footprint, about 20KB on x86_64 platform. footprint, about 20KB on x86_64 platform.
config SND_SEQUENCER_OSS config SND_SEQUENCER_OSS
bool "OSS Sequencer API" tristate "OSS Sequencer API"
depends on SND_SEQUENCER depends on SND_SEQUENCER
depends on SND_OSSEMUL depends on SND_OSSEMUL
help help
......
...@@ -15,10 +15,9 @@ snd-seq-dummy-objs := seq_dummy.o ...@@ -15,10 +15,9 @@ snd-seq-dummy-objs := seq_dummy.o
snd-seq-virmidi-objs := seq_virmidi.o snd-seq-virmidi-objs := seq_virmidi.o
obj-$(CONFIG_SND_SEQUENCER) += snd-seq.o snd-seq-device.o obj-$(CONFIG_SND_SEQUENCER) += snd-seq.o snd-seq-device.o
ifeq ($(CONFIG_SND_SEQUENCER_OSS),y) obj-$(CONFIG_SND_SEQUENCER_OSS) += snd-seq-midi-event.o
obj-$(CONFIG_SND_SEQUENCER) += snd-seq-midi-event.o obj-$(CONFIG_SND_SEQUENCER_OSS) += oss/
obj-$(CONFIG_SND_SEQUENCER) += oss/
endif
obj-$(CONFIG_SND_SEQ_DUMMY) += snd-seq-dummy.o obj-$(CONFIG_SND_SEQ_DUMMY) += snd-seq-dummy.o
# Toplevel Module Dependency # Toplevel Module Dependency
......
...@@ -7,4 +7,4 @@ snd-seq-oss-objs := seq_oss.o seq_oss_init.o seq_oss_timer.o seq_oss_ioctl.o \ ...@@ -7,4 +7,4 @@ snd-seq-oss-objs := seq_oss.o seq_oss_init.o seq_oss_timer.o seq_oss_ioctl.o \
seq_oss_event.o seq_oss_rw.o seq_oss_synth.o \ seq_oss_event.o seq_oss_rw.o seq_oss_synth.o \
seq_oss_midi.o seq_oss_readq.o seq_oss_writeq.o seq_oss_midi.o seq_oss_readq.o seq_oss_writeq.o
obj-$(CONFIG_SND_SEQUENCER) += snd-seq-oss.o obj-$(CONFIG_SND_SEQUENCER_OSS) += snd-seq-oss.o
...@@ -252,7 +252,7 @@ static int snd_opl3_seq_probe(struct device *_dev) ...@@ -252,7 +252,7 @@ static int snd_opl3_seq_probe(struct device *_dev)
spin_lock_init(&opl3->sys_timer_lock); spin_lock_init(&opl3->sys_timer_lock);
opl3->sys_timer_status = 0; opl3->sys_timer_status = 0;
#ifdef CONFIG_SND_SEQUENCER_OSS #if IS_ENABLED(CONFIG_SND_SEQUENCER_OSS)
snd_opl3_init_seq_oss(opl3, name); snd_opl3_init_seq_oss(opl3, name);
#endif #endif
return 0; return 0;
...@@ -267,7 +267,7 @@ static int snd_opl3_seq_remove(struct device *_dev) ...@@ -267,7 +267,7 @@ static int snd_opl3_seq_remove(struct device *_dev)
if (opl3 == NULL) if (opl3 == NULL)
return -EINVAL; return -EINVAL;
#ifdef CONFIG_SND_SEQUENCER_OSS #if IS_ENABLED(CONFIG_SND_SEQUENCER_OSS)
snd_opl3_free_seq_oss(opl3); snd_opl3_free_seq_oss(opl3);
#endif #endif
if (opl3->seq_client >= 0) { if (opl3->seq_client >= 0) {
......
...@@ -44,9 +44,12 @@ void snd_opl3_load_drums(struct snd_opl3 *opl3); ...@@ -44,9 +44,12 @@ void snd_opl3_load_drums(struct snd_opl3 *opl3);
void snd_opl3_drum_switch(struct snd_opl3 *opl3, int note, int on_off, int vel, struct snd_midi_channel *chan); void snd_opl3_drum_switch(struct snd_opl3 *opl3, int note, int on_off, int vel, struct snd_midi_channel *chan);
/* Prototypes for opl3_oss.c */ /* Prototypes for opl3_oss.c */
#ifdef CONFIG_SND_SEQUENCER_OSS #if IS_ENABLED(CONFIG_SND_SEQUENCER_OSS)
void snd_opl3_init_seq_oss(struct snd_opl3 *opl3, char *name); void snd_opl3_init_seq_oss(struct snd_opl3 *opl3, char *name);
void snd_opl3_free_seq_oss(struct snd_opl3 *opl3); void snd_opl3_free_seq_oss(struct snd_opl3 *opl3);
#else
#define snd_opl3_init_seq_oss(opl3, name) /* NOP */
#define snd_opl3_free_seq_oss(opl3) /* NOP */
#endif #endif
#endif #endif
...@@ -36,7 +36,7 @@ static void reset_voice(struct snd_emux *emu, int ch); ...@@ -36,7 +36,7 @@ static void reset_voice(struct snd_emux *emu, int ch);
static void terminate_voice(struct snd_emux_voice *vp); static void terminate_voice(struct snd_emux_voice *vp);
static void sysex(struct snd_emux *emu, char *buf, int len, int parsed, static void sysex(struct snd_emux *emu, char *buf, int len, int parsed,
struct snd_midi_channel_set *chset); struct snd_midi_channel_set *chset);
#ifdef CONFIG_SND_SEQUENCER_OSS #if IS_ENABLED(CONFIG_SND_SEQUENCER_OSS)
static int oss_ioctl(struct snd_emux *emu, int cmd, int p1, int p2); static int oss_ioctl(struct snd_emux *emu, int cmd, int p1, int p2);
#endif #endif
static int load_fx(struct snd_emux *emu, int type, int mode, static int load_fx(struct snd_emux *emu, int type, int mode,
...@@ -76,7 +76,7 @@ static struct snd_emux_operators emu8000_ops = { ...@@ -76,7 +76,7 @@ static struct snd_emux_operators emu8000_ops = {
.sample_reset = snd_emu8000_sample_reset, .sample_reset = snd_emu8000_sample_reset,
.load_fx = load_fx, .load_fx = load_fx,
.sysex = sysex, .sysex = sysex,
#ifdef CONFIG_SND_SEQUENCER_OSS #if IS_ENABLED(CONFIG_SND_SEQUENCER_OSS)
.oss_ioctl = oss_ioctl, .oss_ioctl = oss_ioctl,
#endif #endif
}; };
...@@ -477,7 +477,7 @@ sysex(struct snd_emux *emu, char *buf, int len, int parsed, struct snd_midi_chan ...@@ -477,7 +477,7 @@ sysex(struct snd_emux *emu, char *buf, int len, int parsed, struct snd_midi_chan
} }
#ifdef CONFIG_SND_SEQUENCER_OSS #if IS_ENABLED(CONFIG_SND_SEQUENCER_OSS)
/* /*
* OSS ioctl callback * OSS ioctl callback
*/ */
......
...@@ -47,7 +47,7 @@ int snd_emux_new(struct snd_emux **remu) ...@@ -47,7 +47,7 @@ int snd_emux_new(struct snd_emux **remu)
mutex_init(&emu->register_mutex); mutex_init(&emu->register_mutex);
emu->client = -1; emu->client = -1;
#ifdef CONFIG_SND_SEQUENCER_OSS #if IS_ENABLED(CONFIG_SND_SEQUENCER_OSS)
emu->oss_synth = NULL; emu->oss_synth = NULL;
#endif #endif
emu->max_voices = 0; emu->max_voices = 0;
...@@ -123,7 +123,7 @@ int snd_emux_register(struct snd_emux *emu, struct snd_card *card, int index, ch ...@@ -123,7 +123,7 @@ int snd_emux_register(struct snd_emux *emu, struct snd_card *card, int index, ch
snd_emux_init_voices(emu); snd_emux_init_voices(emu);
snd_emux_init_seq(emu, card, index); snd_emux_init_seq(emu, card, index);
#ifdef CONFIG_SND_SEQUENCER_OSS #if IS_ENABLED(CONFIG_SND_SEQUENCER_OSS)
snd_emux_init_seq_oss(emu); snd_emux_init_seq_oss(emu);
#endif #endif
snd_emux_init_virmidi(emu, card); snd_emux_init_virmidi(emu, card);
...@@ -150,7 +150,7 @@ int snd_emux_free(struct snd_emux *emu) ...@@ -150,7 +150,7 @@ int snd_emux_free(struct snd_emux *emu)
snd_emux_proc_free(emu); snd_emux_proc_free(emu);
snd_emux_delete_virmidi(emu); snd_emux_delete_virmidi(emu);
#ifdef CONFIG_SND_SEQUENCER_OSS #if IS_ENABLED(CONFIG_SND_SEQUENCER_OSS)
snd_emux_detach_seq_oss(emu); snd_emux_detach_seq_oss(emu);
#endif #endif
snd_emux_detach_seq(emu); snd_emux_detach_seq(emu);
......
...@@ -150,7 +150,7 @@ effect_get_offset(struct snd_midi_channel *chan, int lo, int hi, int mode) ...@@ -150,7 +150,7 @@ effect_get_offset(struct snd_midi_channel *chan, int lo, int hi, int mode)
return addr; return addr;
} }
#ifdef CONFIG_SND_SEQUENCER_OSS #if IS_ENABLED(CONFIG_SND_SEQUENCER_OSS)
/* change effects - for OSS sequencer compatibility */ /* change effects - for OSS sequencer compatibility */
void void
snd_emux_send_effect_oss(struct snd_emux_port *port, snd_emux_send_effect_oss(struct snd_emux_port *port,
......
...@@ -23,8 +23,6 @@ ...@@ -23,8 +23,6 @@
*/ */
#ifdef CONFIG_SND_SEQUENCER_OSS
#include <linux/export.h> #include <linux/export.h>
#include <linux/uaccess.h> #include <linux/uaccess.h>
#include <sound/core.h> #include <sound/core.h>
...@@ -505,5 +503,3 @@ fake_event(struct snd_emux *emu, struct snd_emux_port *port, int ch, int param, ...@@ -505,5 +503,3 @@ fake_event(struct snd_emux *emu, struct snd_emux_port *port, int ch, int param,
ev.data.control.value = val; ev.data.control.value = val;
snd_emux_event_input(&ev, 0, port, atomic, hop); snd_emux_event_input(&ev, 0, port, atomic, hop);
} }
#endif /* CONFIG_SND_SEQUENCER_OSS */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment