vserver 2.0 rc7
[linux-2.6.git] / sound / core / seq / oss / seq_oss.c
index 27c5cac..4c0558c 100644 (file)
@@ -59,7 +59,7 @@ static int odev_open(struct inode *inode, struct file *file);
 static int odev_release(struct inode *inode, struct file *file);
 static ssize_t odev_read(struct file *file, char __user *buf, size_t count, loff_t *offset);
 static ssize_t odev_write(struct file *file, const char __user *buf, size_t count, loff_t *offset);
-static int odev_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg);
+static long odev_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
 static unsigned int odev_poll(struct file *file, poll_table * wait);
 #ifdef CONFIG_PROC_FS
 static void info_read(snd_info_entry_t *entry, snd_info_buffer_t *buf);
@@ -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)
@@ -173,20 +177,20 @@ odev_write(struct file *file, const char __user *buf, size_t count, loff_t *offs
        return snd_seq_oss_write(dp, buf, count, file);
 }
 
-static int
-odev_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
+static long
+odev_ioctl(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);
-       /* FIXME: need to unlock BKL to allow preemption */
-       unlock_kernel();
-       err = snd_seq_oss_ioctl(dp, cmd, arg);
-       lock_kernel();
-       return err;
+       return snd_seq_oss_ioctl(dp, cmd, arg);
 }
 
+#ifdef CONFIG_COMPAT
+#define odev_ioctl_compat      odev_ioctl
+#else
+#define odev_ioctl_compat      NULL
+#endif
 
 static unsigned int
 odev_poll(struct file *file, poll_table * wait)
@@ -209,7 +213,8 @@ static struct file_operations seq_oss_f_ops =
        .open =         odev_open,
        .release =      odev_release,
        .poll =         odev_poll,
-       .ioctl =        odev_ioctl,
+       .unlocked_ioctl =       odev_ioctl,
+       .compat_ioctl = odev_ioctl_compat,
 };
 
 static snd_minor_t seq_oss_reg = {