]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
sound: make OSS sound core optional
authorTejun Heo <tj@kernel.org>
Thu, 28 Aug 2008 14:42:51 +0000 (16:42 +0200)
committerJaroslav Kysela <perex@perex.cz>
Fri, 29 Aug 2008 08:06:21 +0000 (10:06 +0200)
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>
arch/um/Kconfig.char
sound/Kconfig
sound/core/Kconfig
sound/oss/dmasound/Kconfig
sound/sound_core.c

index 1b238ebae6b39973cbf7d57b0d7dbe8a40f49a06..70dabd1e0652a1a0725962b28a67abcc729010f9 100644 (file)
@@ -203,6 +203,10 @@ config SOUND
        tristate
        default UML_SOUND
 
+config SOUND_OSS_CORE
+       bool
+       default UML_SOUND
+
 config HOSTAUDIO
        tristate
        default UML_SOUND
index 8ebf512ced6caacee8f0f0a8aafa80772e530889..200aca1faa7112f0413f3cd92ab0a55cec48f588 100644 (file)
@@ -28,6 +28,10 @@ menuconfig SOUND
 
 if SOUND
 
+config SOUND_OSS_CORE
+       bool
+       default n
+
 source "sound/oss/dmasound/Kconfig"
 
 if !M68K
@@ -80,6 +84,7 @@ endif # SND
 
 menuconfig SOUND_PRIME
        tristate "Open Sound System (DEPRECATED)"
+       select SOUND_OSS_CORE
        help
          Say 'Y' or 'M' to enable Open Sound System drivers.
 
index 9c4da1cd4a6b0e1477a33d0f15cb34adb3b30451..91f91c5cdb4ee0974fb8173c64e0000ebb008731 100644 (file)
@@ -44,6 +44,7 @@ config SND_SEQ_DUMMY
          will be called snd-seq-dummy.
 
 config SND_OSSEMUL
+       select SOUND_OSS_CORE
        bool
 
 config SND_MIXER_OSS
index 3eb782720e58e3a00ffbabb11fb63bfbd38bf5ae..f456574a964dc22639eb3dcf1a426c85288a1480 100644 (file)
@@ -42,3 +42,4 @@ config DMASOUND_Q40
 
 config DMASOUND
        tristate
+       select SOUND_OSS_CORE
index 1b04259a4328486357059acfd892bb3015285203..68614c3ed5412f2209c16f94bc74d0785a0baa7c 100644 (file)
@@ -1,5 +1,61 @@
 /*
- *     Sound core handling. Breaks out sound functions to submodules
+ *     Sound core.  This file is composed of two parts.  sound_class
+ *     which is common to both OSS and ALSA and OSS sound core which
+ *     is used OSS or emulation of it.
+ */
+
+/*
+ * First, the common part.
+ */
+#include <linux/module.h>
+#include <linux/device.h>
+#include <linux/err.h>
+
+#ifdef CONFIG_SOUND_OSS_CORE
+static int __init init_oss_soundcore(void);
+static void __exit cleanup_oss_soundcore(void);
+#else
+static inline int init_oss_soundcore(void)     { return 0; }
+static inline void cleanup_oss_soundcore(void) { }
+#endif
+
+struct class *sound_class;
+EXPORT_SYMBOL(sound_class);
+
+MODULE_DESCRIPTION("Core sound module");
+MODULE_AUTHOR("Alan Cox");
+MODULE_LICENSE("GPL");
+
+static int __init init_soundcore(void)
+{
+       int rc;
+
+       rc = init_oss_soundcore();
+       if (rc)
+               return rc;
+
+       sound_class = class_create(THIS_MODULE, "sound");
+       if (IS_ERR(sound_class)) {
+               cleanup_oss_soundcore();
+               return PTR_ERR(sound_class);
+       }
+
+       return 0;
+}
+
+static void __exit cleanup_soundcore(void)
+{
+       cleanup_oss_soundcore();
+       class_destroy(sound_class);
+}
+
+module_init(init_soundcore);
+module_exit(cleanup_soundcore);
+
+
+#ifdef CONFIG_SOUND_OSS_CORE
+/*
+ *     OSS sound core handling. Breaks out sound functions to submodules
  *     
  *     Author:         Alan Cox <alan.cox@linux.org>
  *
  *     locking at some point in 2.3.x.
  */
 
-#include <linux/module.h>
 #include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/smp_lock.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
-#include <linux/fs.h>
 #include <linux/sound.h>
 #include <linux/major.h>
 #include <linux/kmod.h>
-#include <linux/device.h>
 
 #define SOUND_STEP 16
 
-
 struct sound_unit
 {
        int unit_minor;
@@ -64,9 +116,6 @@ extern int msnd_classic_init(void);
 extern int msnd_pinnacle_init(void);
 #endif
 
-struct class *sound_class;
-EXPORT_SYMBOL(sound_class);
-
 /*
  *     Low level list operator. Scan the ordered list, find a hole and
  *     join into it. Called with the lock asserted
@@ -523,31 +572,23 @@ int soundcore_open(struct inode *inode, struct file *file)
        return -ENODEV;
 }
 
-MODULE_DESCRIPTION("Core sound module");
-MODULE_AUTHOR("Alan Cox");
-MODULE_LICENSE("GPL");
 MODULE_ALIAS_CHARDEV_MAJOR(SOUND_MAJOR);
 
-static void __exit cleanup_soundcore(void)
+static void __exit cleanup_oss_soundcore(void)
 {
        /* We have nothing to really do here - we know the lists must be
           empty */
        unregister_chrdev(SOUND_MAJOR, "sound");
-       class_destroy(sound_class);
 }
 
-static int __init init_soundcore(void)
+static int __init init_oss_soundcore(void)
 {
        if (register_chrdev(SOUND_MAJOR, "sound", &soundcore_fops)==-1) {
                printk(KERN_ERR "soundcore: sound device already in use.\n");
                return -EBUSY;
        }
-       sound_class = class_create(THIS_MODULE, "sound");
-       if (IS_ERR(sound_class))
-               return PTR_ERR(sound_class);
 
        return 0;
 }
 
-module_init(init_soundcore);
-module_exit(cleanup_soundcore);
+#endif /* CONFIG_SOUND_OSS_CORE */