vserver 1.9.5.x5
[linux-2.6.git] / sound / core / seq / oss / seq_oss.c
index 5681563..53eb754 100644 (file)
@@ -22,6 +22,7 @@
 
 #include <sound/driver.h>
 #include <linux/init.h>
+#include <linux/smp_lock.h>
 #include <linux/moduleparam.h>
 #include <sound/core.h>
 #include <sound/minors.h>
@@ -35,7 +36,6 @@
 MODULE_AUTHOR("Takashi Iwai <tiwai@suse.de>");
 MODULE_DESCRIPTION("OSS-compatible sequencer module");
 MODULE_LICENSE("GPL");
-MODULE_CLASSES("{sound}");
 /* Takashi says this is really only for sound-service-0-, but this is OK. */
 MODULE_ALIAS_SNDRV_MINOR(SNDRV_MINOR_OSS_SEQUENCER);
 MODULE_ALIAS_SNDRV_MINOR(SNDRV_MINOR_OSS_MUSIC);
@@ -78,16 +78,17 @@ static int __init alsa_seq_oss_init(void)
                snd_seq_oss_synth_unregister,
        };
 
+       snd_seq_autoload_lock();
        if ((rc = register_device()) < 0)
-               return rc;
+               goto error;
        if ((rc = register_proc()) < 0) {
                unregister_device();
-               return rc;
+               goto error;
        }
        if ((rc = snd_seq_oss_create_client()) < 0) {
                unregister_proc();
                unregister_device();
-               return rc;
+               goto error;
        }
 
        if ((rc = snd_seq_device_register_driver(SNDRV_SEQ_DEV_ID_OSS, &ops,
@@ -95,12 +96,15 @@ static int __init alsa_seq_oss_init(void)
                snd_seq_oss_delete_client();
                unregister_proc();
                unregister_device();
-               return rc;
+               goto error;
        }
 
        /* success */
        snd_seq_oss_synth_init();
-       return 0;
+
+ error:
+       snd_seq_autoload_unlock();
+       return rc;
 }
 
 static void __exit alsa_seq_oss_exit(void)
@@ -177,9 +181,14 @@ static int
 odev_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
 {
        seq_oss_devinfo_t *dp;
+       int err;
        dp = file->private_data;
        snd_assert(dp != NULL, return -EIO);
-       return snd_seq_oss_ioctl(dp, cmd, arg);
+       /* FIXME: need to unlock BKL to allow preemption */
+       unlock_kernel();
+       err = snd_seq_oss_ioctl(dp, cmd, arg);
+       lock_kernel();
+       return err;
 }