diff options
author | Tejun Heo <tj@kernel.org> | 2008-08-28 10:42:51 -0400 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2008-08-29 04:06:21 -0400 |
commit | d886e87cb82b0f6636476c1104bb84d7c8dc87d9 (patch) | |
tree | f44fe9eeb7fea8687f8d4fc34a2aad813293462c | |
parent | 9f99a6386eb1ad1197a401495669315de2f19039 (diff) |
sound: make OSS sound core optional
sound/sound_core.c implements soundcore.ko and contains two parts -
sound_class which is shared by both ALSA and OSS and device
redirection support for OSS. It's always compiled when any sound
support is enabled although it's necessary only when OSS (the actual
one or emulation) is enabled. This is slightly wasteful and as device
redirection always registers character device region for major 14, it
prevents alternative implementation.
This patch introduces a new config SOUND_OSS_CORE which is selected
iff OSS support is actually necessary and build the OSS core part
conditionally.
If OSS is disabled, soundcore merely contains sound_class but leaving
it that way seems to be the simplest approach as otherwise sound_class
should be in ALSA core file if OSS is disabled but should be in
soundcore if OSS is enabled. Also, there's also the user confusion
factor.
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
-rw-r--r-- | arch/um/Kconfig.char | 4 | ||||
-rw-r--r-- | sound/Kconfig | 5 | ||||
-rw-r--r-- | sound/core/Kconfig | 1 | ||||
-rw-r--r-- | sound/oss/dmasound/Kconfig | 1 | ||||
-rw-r--r-- | sound/sound_core.c | 79 |
5 files changed, 71 insertions, 19 deletions
diff --git a/arch/um/Kconfig.char b/arch/um/Kconfig.char index 1b238ebae6b3..70dabd1e0652 100644 --- a/arch/um/Kconfig.char +++ b/arch/um/Kconfig.char | |||
@@ -203,6 +203,10 @@ config SOUND | |||
203 | tristate | 203 | tristate |
204 | default UML_SOUND | 204 | default UML_SOUND |
205 | 205 | ||
206 | config SOUND_OSS_CORE | ||
207 | bool | ||
208 | default UML_SOUND | ||
209 | |||
206 | config HOSTAUDIO | 210 | config HOSTAUDIO |
207 | tristate | 211 | tristate |
208 | default UML_SOUND | 212 | default UML_SOUND |
diff --git a/sound/Kconfig b/sound/Kconfig index 8ebf512ced6c..200aca1faa71 100644 --- a/sound/Kconfig +++ b/sound/Kconfig | |||
@@ -28,6 +28,10 @@ menuconfig SOUND | |||
28 | 28 | ||
29 | if SOUND | 29 | if SOUND |
30 | 30 | ||
31 | config SOUND_OSS_CORE | ||
32 | bool | ||
33 | default n | ||
34 | |||
31 | source "sound/oss/dmasound/Kconfig" | 35 | source "sound/oss/dmasound/Kconfig" |
32 | 36 | ||
33 | if !M68K | 37 | if !M68K |
@@ -80,6 +84,7 @@ endif # SND | |||
80 | 84 | ||
81 | menuconfig SOUND_PRIME | 85 | menuconfig SOUND_PRIME |
82 | tristate "Open Sound System (DEPRECATED)" | 86 | tristate "Open Sound System (DEPRECATED)" |
87 | select SOUND_OSS_CORE | ||
83 | help | 88 | help |
84 | Say 'Y' or 'M' to enable Open Sound System drivers. | 89 | Say 'Y' or 'M' to enable Open Sound System drivers. |
85 | 90 | ||
diff --git a/sound/core/Kconfig b/sound/core/Kconfig index 9c4da1cd4a6b..91f91c5cdb4e 100644 --- a/sound/core/Kconfig +++ b/sound/core/Kconfig | |||
@@ -44,6 +44,7 @@ config SND_SEQ_DUMMY | |||
44 | will be called snd-seq-dummy. | 44 | will be called snd-seq-dummy. |
45 | 45 | ||
46 | config SND_OSSEMUL | 46 | config SND_OSSEMUL |
47 | select SOUND_OSS_CORE | ||
47 | bool | 48 | bool |
48 | 49 | ||
49 | config SND_MIXER_OSS | 50 | config SND_MIXER_OSS |
diff --git a/sound/oss/dmasound/Kconfig b/sound/oss/dmasound/Kconfig index 3eb782720e58..f456574a964d 100644 --- a/sound/oss/dmasound/Kconfig +++ b/sound/oss/dmasound/Kconfig | |||
@@ -42,3 +42,4 @@ config DMASOUND_Q40 | |||
42 | 42 | ||
43 | config DMASOUND | 43 | config DMASOUND |
44 | tristate | 44 | tristate |
45 | select SOUND_OSS_CORE | ||
diff --git a/sound/sound_core.c b/sound/sound_core.c index 1b04259a4328..68614c3ed541 100644 --- a/sound/sound_core.c +++ b/sound/sound_core.c | |||
@@ -1,5 +1,61 @@ | |||
1 | /* | 1 | /* |
2 | * Sound core handling. Breaks out sound functions to submodules | 2 | * Sound core. This file is composed of two parts. sound_class |
3 | * which is common to both OSS and ALSA and OSS sound core which | ||
4 | * is used OSS or emulation of it. | ||
5 | */ | ||
6 | |||
7 | /* | ||
8 | * First, the common part. | ||
9 | */ | ||
10 | #include <linux/module.h> | ||
11 | #include <linux/device.h> | ||
12 | #include <linux/err.h> | ||
13 | |||
14 | #ifdef CONFIG_SOUND_OSS_CORE | ||
15 | static int __init init_oss_soundcore(void); | ||
16 | static void __exit cleanup_oss_soundcore(void); | ||
17 | #else | ||
18 | static inline int init_oss_soundcore(void) { return 0; } | ||
19 | static inline void cleanup_oss_soundcore(void) { } | ||
20 | #endif | ||
21 | |||
22 | struct class *sound_class; | ||
23 | EXPORT_SYMBOL(sound_class); | ||
24 | |||
25 | MODULE_DESCRIPTION("Core sound module"); | ||
26 | MODULE_AUTHOR("Alan Cox"); | ||
27 | MODULE_LICENSE("GPL"); | ||
28 | |||
29 | static int __init init_soundcore(void) | ||
30 | { | ||
31 | int rc; | ||
32 | |||
33 | rc = init_oss_soundcore(); | ||
34 | if (rc) | ||
35 | return rc; | ||
36 | |||
37 | sound_class = class_create(THIS_MODULE, "sound"); | ||
38 | if (IS_ERR(sound_class)) { | ||
39 | cleanup_oss_soundcore(); | ||
40 | return PTR_ERR(sound_class); | ||
41 | } | ||
42 | |||
43 | return 0; | ||
44 | } | ||
45 | |||
46 | static void __exit cleanup_soundcore(void) | ||
47 | { | ||
48 | cleanup_oss_soundcore(); | ||
49 | class_destroy(sound_class); | ||
50 | } | ||
51 | |||
52 | module_init(init_soundcore); | ||
53 | module_exit(cleanup_soundcore); | ||
54 | |||
55 | |||
56 | #ifdef CONFIG_SOUND_OSS_CORE | ||
57 | /* | ||
58 | * OSS sound core handling. Breaks out sound functions to submodules | ||
3 | * | 59 | * |
4 | * Author: Alan Cox <alan.cox@linux.org> | 60 | * Author: Alan Cox <alan.cox@linux.org> |
5 | * | 61 | * |
@@ -34,21 +90,17 @@ | |||
34 | * locking at some point in 2.3.x. | 90 | * locking at some point in 2.3.x. |
35 | */ | 91 | */ |
36 | 92 | ||
37 | #include <linux/module.h> | ||
38 | #include <linux/init.h> | 93 | #include <linux/init.h> |
39 | #include <linux/slab.h> | 94 | #include <linux/slab.h> |
40 | #include <linux/smp_lock.h> | 95 | #include <linux/smp_lock.h> |
41 | #include <linux/types.h> | 96 | #include <linux/types.h> |
42 | #include <linux/kernel.h> | 97 | #include <linux/kernel.h> |
43 | #include <linux/fs.h> | ||
44 | #include <linux/sound.h> | 98 | #include <linux/sound.h> |
45 | #include <linux/major.h> | 99 | #include <linux/major.h> |
46 | #include <linux/kmod.h> | 100 | #include <linux/kmod.h> |
47 | #include <linux/device.h> | ||
48 | 101 | ||
49 | #define SOUND_STEP 16 | 102 | #define SOUND_STEP 16 |
50 | 103 | ||
51 | |||
52 | struct sound_unit | 104 | struct sound_unit |
53 | { | 105 | { |
54 | int unit_minor; | 106 | int unit_minor; |
@@ -64,9 +116,6 @@ extern int msnd_classic_init(void); | |||
64 | extern int msnd_pinnacle_init(void); | 116 | extern int msnd_pinnacle_init(void); |
65 | #endif | 117 | #endif |
66 | 118 | ||
67 | struct class *sound_class; | ||
68 | EXPORT_SYMBOL(sound_class); | ||
69 | |||
70 | /* | 119 | /* |
71 | * Low level list operator. Scan the ordered list, find a hole and | 120 | * Low level list operator. Scan the ordered list, find a hole and |
72 | * join into it. Called with the lock asserted | 121 | * join into it. Called with the lock asserted |
@@ -523,31 +572,23 @@ int soundcore_open(struct inode *inode, struct file *file) | |||
523 | return -ENODEV; | 572 | return -ENODEV; |
524 | } | 573 | } |
525 | 574 | ||
526 | MODULE_DESCRIPTION("Core sound module"); | ||
527 | MODULE_AUTHOR("Alan Cox"); | ||
528 | MODULE_LICENSE("GPL"); | ||
529 | MODULE_ALIAS_CHARDEV_MAJOR(SOUND_MAJOR); | 575 | MODULE_ALIAS_CHARDEV_MAJOR(SOUND_MAJOR); |
530 | 576 | ||
531 | static void __exit cleanup_soundcore(void) | 577 | static void __exit cleanup_oss_soundcore(void) |
532 | { | 578 | { |
533 | /* We have nothing to really do here - we know the lists must be | 579 | /* We have nothing to really do here - we know the lists must be |
534 | empty */ | 580 | empty */ |
535 | unregister_chrdev(SOUND_MAJOR, "sound"); | 581 | unregister_chrdev(SOUND_MAJOR, "sound"); |
536 | class_destroy(sound_class); | ||
537 | } | 582 | } |
538 | 583 | ||
539 | static int __init init_soundcore(void) | 584 | static int __init init_oss_soundcore(void) |
540 | { | 585 | { |
541 | if (register_chrdev(SOUND_MAJOR, "sound", &soundcore_fops)==-1) { | 586 | if (register_chrdev(SOUND_MAJOR, "sound", &soundcore_fops)==-1) { |
542 | printk(KERN_ERR "soundcore: sound device already in use.\n"); | 587 | printk(KERN_ERR "soundcore: sound device already in use.\n"); |
543 | return -EBUSY; | 588 | return -EBUSY; |
544 | } | 589 | } |
545 | sound_class = class_create(THIS_MODULE, "sound"); | ||
546 | if (IS_ERR(sound_class)) | ||
547 | return PTR_ERR(sound_class); | ||
548 | 590 | ||
549 | return 0; | 591 | return 0; |
550 | } | 592 | } |
551 | 593 | ||
552 | module_init(init_soundcore); | 594 | #endif /* CONFIG_SOUND_OSS_CORE */ |
553 | module_exit(cleanup_soundcore); | ||