vserver 2.0 rc7
[linux-2.6.git] / sound / core / hwdep.c
index cbd8eba..997dd41 100644 (file)
@@ -223,7 +223,7 @@ static int snd_hwdep_dsp_load(snd_hwdep_t *hw, snd_hwdep_dsp_image_t __user *_in
        /* check whether the dsp was already loaded */
        if (hw->dsp_loaded & (1 << info.index))
                return -EBUSY;
-       if (verify_area(VERIFY_READ, info.image, info.length))
+       if (!access_ok(VERIFY_READ, info.image, info.length))
                return -EFAULT;
        err = hw->ops.dsp_load(hw, &info);
        if (err < 0)
@@ -232,8 +232,7 @@ static int snd_hwdep_dsp_load(snd_hwdep_t *hw, snd_hwdep_dsp_image_t __user *_in
        return 0;
 }
 
-static inline int _snd_hwdep_ioctl(struct inode *inode, struct file * file,
-                                  unsigned int cmd, unsigned long arg)
+static long snd_hwdep_ioctl(struct file * file, unsigned int cmd, unsigned long arg)
 {
        snd_hwdep_t *hw = file->private_data;
        void __user *argp = (void __user *)arg;
@@ -252,17 +251,6 @@ static inline int _snd_hwdep_ioctl(struct inode *inode, struct file * file,
        return -ENOTTY;
 }
 
-/* FIXME: need to unlock BKL to allow preemption */
-static int snd_hwdep_ioctl(struct inode *inode, struct file * file,
-                          unsigned int cmd, unsigned long arg)
-{
-       int err;
-       unlock_kernel();
-       err = _snd_hwdep_ioctl(inode, file, cmd, arg);
-       lock_kernel();
-       return err;
-}
-
 static int snd_hwdep_mmap(struct file * file, struct vm_area_struct * vma)
 {
        snd_hwdep_t *hw = file->private_data;
@@ -315,6 +303,12 @@ static int snd_hwdep_control_ioctl(snd_card_t * card, snd_ctl_file_t * control,
        return -ENOIOCTLCMD;
 }
 
+#ifdef CONFIG_COMPAT
+#include "hwdep_compat.c"
+#else
+#define snd_hwdep_ioctl_compat NULL
+#endif
+
 /*
 
  */
@@ -328,7 +322,8 @@ static struct file_operations snd_hwdep_f_ops =
        .open =         snd_hwdep_open,
        .release =      snd_hwdep_release,
        .poll =         snd_hwdep_poll,
-       .ioctl =        snd_hwdep_ioctl,
+       .unlocked_ioctl =       snd_hwdep_ioctl,
+       .compat_ioctl = snd_hwdep_ioctl_compat,
        .mmap =         snd_hwdep_mmap,
 };
 
@@ -509,12 +504,14 @@ static int __init alsa_hwdep_init(void)
        }
        snd_hwdep_proc_entry = entry;
        snd_ctl_register_ioctl(snd_hwdep_control_ioctl);
+       snd_ctl_register_ioctl_compat(snd_hwdep_control_ioctl);
        return 0;
 }
 
 static void __exit alsa_hwdep_exit(void)
 {
        snd_ctl_unregister_ioctl(snd_hwdep_control_ioctl);
+       snd_ctl_unregister_ioctl_compat(snd_hwdep_control_ioctl);
        if (snd_hwdep_proc_entry) {
                snd_info_unregister(snd_hwdep_proc_entry);
                snd_hwdep_proc_entry = NULL;