summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2017-06-09 09:11:58 -0400
committerTakashi Iwai <tiwai@suse.de>2017-06-12 02:43:33 -0400
commit111b0cdb97d44cfe5dec1338a78ba8aff65c32e2 (patch)
tree41822f2d0878d180aa540a33ce4e79f19d34b10d
parent8272115578ce02566b4c6bbe45f09d0d55f4a1c6 (diff)
ALSA: seq: Allow the modular sequencer registration
Many drivers bind the sequencer stuff in off-load by another driver module, so that it's loaded only on demand. In the current code, this mechanism doesn't work when the driver is built-in while the sequencer is module. We check with IS_REACHABLE() and enable only when the sequencer is in the same level of build. However, this is basically a overshoot. The binder code (snd-seq-device) is an individual module from the sequencer core (snd-seq), and we just have to make the former a built-in while keeping the latter a module for allowing the scenario like the above. This patch achieves that by rewriting Kconfig slightly. Now, a driver that provides the manual sequencer device binding should select CONFIG_SND_SEQ_DEVICE in a way as select SND_SEQ_DEVICE if SND_SEQUENCER != n Note that the "!=n" is needed here to avoid the influence of the sequencer core is module while the driver is built-in. Also, since rawmidi.o may be linked with snd_seq_device.o when built-in, we have to shuffle the code to make the linker happy. (the kernel linker isn't smart enough yet to handle such a case.) That is, snd_seq_device.c is moved to sound/core from sound/core/seq, as well as Makefile. Last but not least, the patch replaces the code using IS_REACHABLE() with IS_ENABLED(), since now the condition meets always when enabled. Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/core/Kconfig4
-rw-r--r--sound/core/Makefile2
-rw-r--r--sound/core/rawmidi.c4
-rw-r--r--sound/core/seq/Kconfig2
-rw-r--r--sound/core/seq/Makefile3
-rw-r--r--sound/core/seq_device.c (renamed from sound/core/seq/seq_device.c)0
-rw-r--r--sound/drivers/Kconfig2
-rw-r--r--sound/drivers/opl3/opl3_lib.c2
-rw-r--r--sound/drivers/opl4/opl4_lib.c4
-rw-r--r--sound/drivers/opl4/opl4_local.h2
-rw-r--r--sound/isa/Kconfig1
-rw-r--r--sound/isa/sb/emu8000.c2
-rw-r--r--sound/isa/sb/sb16.c2
-rw-r--r--sound/pci/Kconfig1
-rw-r--r--sound/pci/emu10k1/emu10k1.c2
15 files changed, 21 insertions, 12 deletions
diff --git a/sound/core/Kconfig b/sound/core/Kconfig
index 90990eb1d250..6e937a8146a1 100644
--- a/sound/core/Kconfig
+++ b/sound/core/Kconfig
@@ -18,8 +18,12 @@ config SND_DMAENGINE_PCM
18config SND_HWDEP 18config SND_HWDEP
19 tristate 19 tristate
20 20
21config SND_SEQ_DEVICE
22 tristate
23
21config SND_RAWMIDI 24config SND_RAWMIDI
22 tristate 25 tristate
26 select SND_SEQ_DEVICE if SND_SEQUENCER != n
23 27
24config SND_COMPRESS_OFFLOAD 28config SND_COMPRESS_OFFLOAD
25 tristate 29 tristate
diff --git a/sound/core/Makefile b/sound/core/Makefile
index a8514b313a89..e2066e2ef9f8 100644
--- a/sound/core/Makefile
+++ b/sound/core/Makefile
@@ -31,6 +31,7 @@ snd-timer-objs := timer.o
31snd-hrtimer-objs := hrtimer.o 31snd-hrtimer-objs := hrtimer.o
32snd-rtctimer-objs := rtctimer.o 32snd-rtctimer-objs := rtctimer.o
33snd-hwdep-objs := hwdep.o 33snd-hwdep-objs := hwdep.o
34snd-seq-device-objs := seq_device.o
34 35
35snd-compress-objs := compress_offload.o 36snd-compress-objs := compress_offload.o
36 37
@@ -40,6 +41,7 @@ obj-$(CONFIG_SND_TIMER) += snd-timer.o
40obj-$(CONFIG_SND_HRTIMER) += snd-hrtimer.o 41obj-$(CONFIG_SND_HRTIMER) += snd-hrtimer.o
41obj-$(CONFIG_SND_PCM) += snd-pcm.o 42obj-$(CONFIG_SND_PCM) += snd-pcm.o
42obj-$(CONFIG_SND_DMAENGINE_PCM) += snd-pcm-dmaengine.o 43obj-$(CONFIG_SND_DMAENGINE_PCM) += snd-pcm-dmaengine.o
44obj-$(CONFIG_SND_SEQ_DEVICE) += snd-seq-device.o
43obj-$(CONFIG_SND_RAWMIDI) += snd-rawmidi.o 45obj-$(CONFIG_SND_RAWMIDI) += snd-rawmidi.o
44 46
45obj-$(CONFIG_SND_OSSEMUL) += oss/ 47obj-$(CONFIG_SND_OSSEMUL) += oss/
diff --git a/sound/core/rawmidi.c b/sound/core/rawmidi.c
index ab890336175f..153d78bc79c0 100644
--- a/sound/core/rawmidi.c
+++ b/sound/core/rawmidi.c
@@ -1610,7 +1610,7 @@ static int snd_rawmidi_dev_free(struct snd_device *device)
1610 return snd_rawmidi_free(rmidi); 1610 return snd_rawmidi_free(rmidi);
1611} 1611}
1612 1612
1613#if IS_REACHABLE(CONFIG_SND_SEQUENCER) 1613#if IS_ENABLED(CONFIG_SND_SEQUENCER)
1614static void snd_rawmidi_dev_seq_free(struct snd_seq_device *device) 1614static void snd_rawmidi_dev_seq_free(struct snd_seq_device *device)
1615{ 1615{
1616 struct snd_rawmidi *rmidi = device->private_data; 1616 struct snd_rawmidi *rmidi = device->private_data;
@@ -1691,7 +1691,7 @@ static int snd_rawmidi_dev_register(struct snd_device *device)
1691 } 1691 }
1692 } 1692 }
1693 rmidi->proc_entry = entry; 1693 rmidi->proc_entry = entry;
1694#if IS_REACHABLE(CONFIG_SND_SEQUENCER) 1694#if IS_ENABLED(CONFIG_SND_SEQUENCER)
1695 if (!rmidi->ops || !rmidi->ops->dev_register) { /* own registration mechanism */ 1695 if (!rmidi->ops || !rmidi->ops->dev_register) { /* own registration mechanism */
1696 if (snd_seq_device_new(rmidi->card, rmidi->device, SNDRV_SEQ_DEV_ID_MIDISYNTH, 0, &rmidi->seq_dev) >= 0) { 1696 if (snd_seq_device_new(rmidi->card, rmidi->device, SNDRV_SEQ_DEV_ID_MIDISYNTH, 0, &rmidi->seq_dev) >= 0) {
1697 rmidi->seq_dev->private_data = rmidi; 1697 rmidi->seq_dev->private_data = rmidi;
diff --git a/sound/core/seq/Kconfig b/sound/core/seq/Kconfig
index 140e640e62a6..a536760a94c2 100644
--- a/sound/core/seq/Kconfig
+++ b/sound/core/seq/Kconfig
@@ -1,6 +1,7 @@
1config SND_SEQUENCER 1config SND_SEQUENCER
2 tristate "Sequencer support" 2 tristate "Sequencer support"
3 select SND_TIMER 3 select SND_TIMER
4 select SND_SEQ_DEVICE
4 help 5 help
5 Say Y or M to enable MIDI sequencer and router support. This 6 Say Y or M to enable MIDI sequencer and router support. This
6 feature allows routing and enqueueing of MIDI events. Events 7 feature allows routing and enqueueing of MIDI events. Events
@@ -59,4 +60,3 @@ config SND_SEQ_VIRMIDI
59 tristate 60 tristate
60 61
61endif # SND_SEQUENCER 62endif # SND_SEQUENCER
62
diff --git a/sound/core/seq/Makefile b/sound/core/seq/Makefile
index 81a8ea537209..68fd367ac39c 100644
--- a/sound/core/seq/Makefile
+++ b/sound/core/seq/Makefile
@@ -3,7 +3,6 @@
3# Copyright (c) 1999 by Jaroslav Kysela <perex@perex.cz> 3# Copyright (c) 1999 by Jaroslav Kysela <perex@perex.cz>
4# 4#
5 5
6snd-seq-device-objs := seq_device.o
7snd-seq-objs := seq.o seq_lock.o seq_clientmgr.o seq_memory.o seq_queue.o \ 6snd-seq-objs := seq.o seq_lock.o seq_clientmgr.o seq_memory.o seq_queue.o \
8 seq_fifo.o seq_prioq.o seq_timer.o \ 7 seq_fifo.o seq_prioq.o seq_timer.o \
9 seq_system.o seq_ports.o 8 seq_system.o seq_ports.o
@@ -14,7 +13,7 @@ snd-seq-midi-event-objs := seq_midi_event.o
14snd-seq-dummy-objs := seq_dummy.o 13snd-seq-dummy-objs := seq_dummy.o
15snd-seq-virmidi-objs := seq_virmidi.o 14snd-seq-virmidi-objs := seq_virmidi.o
16 15
17obj-$(CONFIG_SND_SEQUENCER) += snd-seq.o snd-seq-device.o 16obj-$(CONFIG_SND_SEQUENCER) += snd-seq.o
18obj-$(CONFIG_SND_SEQUENCER_OSS) += oss/ 17obj-$(CONFIG_SND_SEQUENCER_OSS) += oss/
19 18
20obj-$(CONFIG_SND_SEQ_DUMMY) += snd-seq-dummy.o 19obj-$(CONFIG_SND_SEQ_DUMMY) += snd-seq-dummy.o
diff --git a/sound/core/seq/seq_device.c b/sound/core/seq_device.c
index c4acf17e9f5e..c4acf17e9f5e 100644
--- a/sound/core/seq/seq_device.c
+++ b/sound/core/seq_device.c
diff --git a/sound/drivers/Kconfig b/sound/drivers/Kconfig
index 0e3dc80a7262..7144cc36e8ae 100644
--- a/sound/drivers/Kconfig
+++ b/sound/drivers/Kconfig
@@ -6,11 +6,13 @@ config SND_OPL3_LIB
6 tristate 6 tristate
7 select SND_TIMER 7 select SND_TIMER
8 select SND_HWDEP 8 select SND_HWDEP
9 select SND_SEQ_DEVICE if SND_SEQUENCER != n
9 10
10config SND_OPL4_LIB 11config SND_OPL4_LIB
11 tristate 12 tristate
12 select SND_TIMER 13 select SND_TIMER
13 select SND_HWDEP 14 select SND_HWDEP
15 select SND_SEQ_DEVICE if SND_SEQUENCER != n
14 16
15# select SEQ stuff to min(SND_SEQUENCER,SND_XXX) 17# select SEQ stuff to min(SND_SEQUENCER,SND_XXX)
16config SND_OPL3_LIB_SEQ 18config SND_OPL3_LIB_SEQ
diff --git a/sound/drivers/opl3/opl3_lib.c b/sound/drivers/opl3/opl3_lib.c
index cd9e9f31720f..d5e5b4657b4b 100644
--- a/sound/drivers/opl3/opl3_lib.c
+++ b/sound/drivers/opl3/opl3_lib.c
@@ -528,7 +528,7 @@ int snd_opl3_hwdep_new(struct snd_opl3 * opl3,
528 528
529 opl3->hwdep = hw; 529 opl3->hwdep = hw;
530 opl3->seq_dev_num = seq_device; 530 opl3->seq_dev_num = seq_device;
531#if IS_REACHABLE(CONFIG_SND_SEQUENCER) 531#if IS_ENABLED(CONFIG_SND_SEQUENCER)
532 if (snd_seq_device_new(card, seq_device, SNDRV_SEQ_DEV_ID_OPL3, 532 if (snd_seq_device_new(card, seq_device, SNDRV_SEQ_DEV_ID_OPL3,
533 sizeof(struct snd_opl3 *), &opl3->seq_dev) >= 0) { 533 sizeof(struct snd_opl3 *), &opl3->seq_dev) >= 0) {
534 strcpy(opl3->seq_dev->name, hw->name); 534 strcpy(opl3->seq_dev->name, hw->name);
diff --git a/sound/drivers/opl4/opl4_lib.c b/sound/drivers/opl4/opl4_lib.c
index 240656e54400..bc345d564f8d 100644
--- a/sound/drivers/opl4/opl4_lib.c
+++ b/sound/drivers/opl4/opl4_lib.c
@@ -153,7 +153,7 @@ static int snd_opl4_detect(struct snd_opl4 *opl4)
153 return 0; 153 return 0;
154} 154}
155 155
156#if IS_REACHABLE(CONFIG_SND_SEQUENCER) 156#if IS_ENABLED(CONFIG_SND_SEQUENCER)
157static void snd_opl4_seq_dev_free(struct snd_seq_device *seq_dev) 157static void snd_opl4_seq_dev_free(struct snd_seq_device *seq_dev)
158{ 158{
159 struct snd_opl4 *opl4 = seq_dev->private_data; 159 struct snd_opl4 *opl4 = seq_dev->private_data;
@@ -249,7 +249,7 @@ int snd_opl4_create(struct snd_card *card,
249 snd_opl4_create_mixer(opl4); 249 snd_opl4_create_mixer(opl4);
250 snd_opl4_create_proc(opl4); 250 snd_opl4_create_proc(opl4);
251 251
252#if IS_REACHABLE(CONFIG_SND_SEQUENCER) 252#if IS_ENABLED(CONFIG_SND_SEQUENCER)
253 opl4->seq_client = -1; 253 opl4->seq_client = -1;
254 if (opl4->hardware < OPL3_HW_OPL4_ML) 254 if (opl4->hardware < OPL3_HW_OPL4_ML)
255 snd_opl4_create_seq_dev(opl4, seq_device); 255 snd_opl4_create_seq_dev(opl4, seq_device);
diff --git a/sound/drivers/opl4/opl4_local.h b/sound/drivers/opl4/opl4_local.h
index d5bac93f8245..a16b4677c1e9 100644
--- a/sound/drivers/opl4/opl4_local.h
+++ b/sound/drivers/opl4/opl4_local.h
@@ -184,7 +184,7 @@ struct snd_opl4 {
184#endif 184#endif
185 struct mutex access_mutex; 185 struct mutex access_mutex;
186 186
187#if IS_REACHABLE(CONFIG_SND_SEQUENCER) 187#if IS_ENABLED(CONFIG_SND_SEQUENCER)
188 int used; 188 int used;
189 189
190 int seq_dev_num; 190 int seq_dev_num;
diff --git a/sound/isa/Kconfig b/sound/isa/Kconfig
index ea8ecc5bb826..cb54d9c0a77f 100644
--- a/sound/isa/Kconfig
+++ b/sound/isa/Kconfig
@@ -377,6 +377,7 @@ config SND_SBAWE
377 select SND_OPL3_LIB 377 select SND_OPL3_LIB
378 select SND_MPU401_UART 378 select SND_MPU401_UART
379 select SND_SB16_DSP 379 select SND_SB16_DSP
380 select SND_SEQ_DEVICE if SND_SEQUENCER != n
380 help 381 help
381 Say Y here to include support for Sound Blaster AWE soundcards 382 Say Y here to include support for Sound Blaster AWE soundcards
382 (including the Plug and Play version). 383 (including the Plug and Play version).
diff --git a/sound/isa/sb/emu8000.c b/sound/isa/sb/emu8000.c
index 0b5c4cf3abfa..d56973b770c7 100644
--- a/sound/isa/sb/emu8000.c
+++ b/sound/isa/sb/emu8000.c
@@ -1138,7 +1138,7 @@ snd_emu8000_new(struct snd_card *card, int index, long port, int seq_ports,
1138 snd_emu8000_free(hw); 1138 snd_emu8000_free(hw);
1139 return err; 1139 return err;
1140 } 1140 }
1141#if IS_REACHABLE(CONFIG_SND_SEQUENCER) 1141#if IS_ENABLED(CONFIG_SND_SEQUENCER)
1142 if (snd_seq_device_new(card, index, SNDRV_SEQ_DEV_ID_EMU8000, 1142 if (snd_seq_device_new(card, index, SNDRV_SEQ_DEV_ID_EMU8000,
1143 sizeof(struct snd_emu8000*), &awe) >= 0) { 1143 sizeof(struct snd_emu8000*), &awe) >= 0) {
1144 strcpy(awe->name, "EMU-8000"); 1144 strcpy(awe->name, "EMU-8000");
diff --git a/sound/isa/sb/sb16.c b/sound/isa/sb/sb16.c
index 31ab09b3b049..917a93d696c3 100644
--- a/sound/isa/sb/sb16.c
+++ b/sound/isa/sb/sb16.c
@@ -62,7 +62,7 @@ MODULE_SUPPORTED_DEVICE("{{Creative Labs,SB AWE 32},"
62#define SNDRV_DEBUG_IRQ 62#define SNDRV_DEBUG_IRQ
63#endif 63#endif
64 64
65#if defined(SNDRV_SBAWE) && IS_REACHABLE(CONFIG_SND_SEQUENCER) 65#if defined(SNDRV_SBAWE) && IS_ENABLED(CONFIG_SND_SEQUENCER)
66#define SNDRV_SBAWE_EMU8000 66#define SNDRV_SBAWE_EMU8000
67#endif 67#endif
68 68
diff --git a/sound/pci/Kconfig b/sound/pci/Kconfig
index 9ac9326f28d6..d9f3fdb777e4 100644
--- a/sound/pci/Kconfig
+++ b/sound/pci/Kconfig
@@ -465,6 +465,7 @@ config SND_EMU10K1
465 select SND_RAWMIDI 465 select SND_RAWMIDI
466 select SND_AC97_CODEC 466 select SND_AC97_CODEC
467 select SND_TIMER 467 select SND_TIMER
468 select SND_SEQ_DEVICE if SND_SEQUENCER != n
468 depends on ZONE_DMA 469 depends on ZONE_DMA
469 help 470 help
470 Say Y to include support for Sound Blaster PCI 512, Live!, 471 Say Y to include support for Sound Blaster PCI 512, Live!,
diff --git a/sound/pci/emu10k1/emu10k1.c b/sound/pci/emu10k1/emu10k1.c
index 6a0e49ac5273..d3203df50a1a 100644
--- a/sound/pci/emu10k1/emu10k1.c
+++ b/sound/pci/emu10k1/emu10k1.c
@@ -37,7 +37,7 @@ MODULE_LICENSE("GPL");
37MODULE_SUPPORTED_DEVICE("{{Creative Labs,SB Live!/PCI512/E-mu APS}," 37MODULE_SUPPORTED_DEVICE("{{Creative Labs,SB Live!/PCI512/E-mu APS},"
38 "{Creative Labs,SB Audigy}}"); 38 "{Creative Labs,SB Audigy}}");
39 39
40#if IS_REACHABLE(CONFIG_SND_SEQUENCER) 40#if IS_ENABLED(CONFIG_SND_SEQUENCER)
41#define ENABLE_SYNTH 41#define ENABLE_SYNTH
42#include <sound/emu10k1_synth.h> 42#include <sound/emu10k1_synth.h>
43#endif 43#endif