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

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>

authored by

Tejun Heo and committed by
Jaroslav Kysela
d886e87c 9f99a638

+71 -19
+4
arch/um/Kconfig.char
··· 203 203 tristate 204 204 default UML_SOUND 205 205 206 + config SOUND_OSS_CORE 207 + bool 208 + default UML_SOUND 209 + 206 210 config HOSTAUDIO 207 211 tristate 208 212 default UML_SOUND
+5
sound/Kconfig
··· 28 28 29 29 if SOUND 30 30 31 + config SOUND_OSS_CORE 32 + bool 33 + default n 34 + 31 35 source "sound/oss/dmasound/Kconfig" 32 36 33 37 if !M68K ··· 84 80 85 81 menuconfig SOUND_PRIME 86 82 tristate "Open Sound System (DEPRECATED)" 83 + select SOUND_OSS_CORE 87 84 help 88 85 Say 'Y' or 'M' to enable Open Sound System drivers. 89 86
+1
sound/core/Kconfig
··· 44 44 will be called snd-seq-dummy. 45 45 46 46 config SND_OSSEMUL 47 + select SOUND_OSS_CORE 47 48 bool 48 49 49 50 config SND_MIXER_OSS
+1
sound/oss/dmasound/Kconfig
··· 42 42 43 43 config DMASOUND 44 44 tristate 45 + select SOUND_OSS_CORE
+60 -19
sound/sound_core.c
··· 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 60 * Author: Alan Cox <alan.cox@linux.org> 5 61 * ··· 90 34 * locking at some point in 2.3.x. 91 35 */ 92 36 93 - #include <linux/module.h> 94 37 #include <linux/init.h> 95 38 #include <linux/slab.h> 96 39 #include <linux/smp_lock.h> 97 40 #include <linux/types.h> 98 41 #include <linux/kernel.h> 99 - #include <linux/fs.h> 100 42 #include <linux/sound.h> 101 43 #include <linux/major.h> 102 44 #include <linux/kmod.h> 103 - #include <linux/device.h> 104 45 105 46 #define SOUND_STEP 16 106 - 107 47 108 48 struct sound_unit 109 49 { ··· 115 63 #ifdef CONFIG_SOUND_MSNDPIN 116 64 extern int msnd_pinnacle_init(void); 117 65 #endif 118 - 119 - struct class *sound_class; 120 - EXPORT_SYMBOL(sound_class); 121 66 122 67 /* 123 68 * Low level list operator. Scan the ordered list, find a hole and ··· 572 523 return -ENODEV; 573 524 } 574 525 575 - MODULE_DESCRIPTION("Core sound module"); 576 - MODULE_AUTHOR("Alan Cox"); 577 - MODULE_LICENSE("GPL"); 578 526 MODULE_ALIAS_CHARDEV_MAJOR(SOUND_MAJOR); 579 527 580 - static void __exit cleanup_soundcore(void) 528 + static void __exit cleanup_oss_soundcore(void) 581 529 { 582 530 /* We have nothing to really do here - we know the lists must be 583 531 empty */ 584 532 unregister_chrdev(SOUND_MAJOR, "sound"); 585 - class_destroy(sound_class); 586 533 } 587 534 588 - static int __init init_soundcore(void) 535 + static int __init init_oss_soundcore(void) 589 536 { 590 537 if (register_chrdev(SOUND_MAJOR, "sound", &soundcore_fops)==-1) { 591 538 printk(KERN_ERR "soundcore: sound device already in use.\n"); 592 539 return -EBUSY; 593 540 } 594 - sound_class = class_create(THIS_MODULE, "sound"); 595 - if (IS_ERR(sound_class)) 596 - return PTR_ERR(sound_class); 597 541 598 542 return 0; 599 543 } 600 544 601 - module_init(init_soundcore); 602 - module_exit(cleanup_soundcore); 545 + #endif /* CONFIG_SOUND_OSS_CORE */