patch-2_6_7-vs1_9_1_12
[linux-2.6.git] / sound / oss / forte.c
index 06a31b7..c7e23fc 100644 (file)
@@ -849,6 +849,8 @@ forte_dsp_ioctl (struct inode *inode, struct file *file, unsigned int cmd,
        struct forte_chip *chip;
        struct audio_buf_info abi;
        struct count_info cinfo;
+       void __user *argp = (void __user *)arg;
+       int __user *p = argp;
 
        chip = file->private_data;
        
@@ -865,24 +867,24 @@ forte_dsp_ioctl (struct inode *inode, struct file *file, unsigned int cmd,
        switch (cmd) {
 
        case OSS_GETVERSION:
-               return put_user (SOUND_VERSION, (int *) arg);
+               return put_user (SOUND_VERSION, p);
 
        case SNDCTL_DSP_GETCAPS:
                DPRINTK ("%s: GETCAPS\n", __FUNCTION__);
 
                ival = FORTE_CAPS; /* DUPLEX */
-               return put_user (ival, (int *) arg);
+               return put_user (ival, p);
 
        case SNDCTL_DSP_GETFMTS:
                DPRINTK ("%s: GETFMTS\n", __FUNCTION__);
 
                ival = FORTE_FMTS; /* U8, 16LE */
-               return put_user (ival, (int *) arg);
+               return put_user (ival, p);
 
        case SNDCTL_DSP_SETFMT: /* U8, 16LE */
                DPRINTK ("%s: SETFMT\n", __FUNCTION__);
 
-               if (get_user (ival, (int *) arg))
+               if (get_user (ival, p))
                        return -EFAULT;
 
                spin_lock_irq (&chip->lock);
@@ -899,12 +901,12 @@ forte_dsp_ioctl (struct inode *inode, struct file *file, unsigned int cmd,
 
                spin_unlock_irq (&chip->lock);
        
-               return put_user (rval, (int *) arg);
+               return put_user (rval, p);
 
        case SNDCTL_DSP_STEREO: /* 0 - mono, 1 - stereo */
                DPRINTK ("%s: STEREO\n", __FUNCTION__);
 
-               if (get_user (ival, (int *) arg))
+               if (get_user (ival, p))
                        return -EFAULT;
 
                spin_lock_irq (&chip->lock);
@@ -921,12 +923,12 @@ forte_dsp_ioctl (struct inode *inode, struct file *file, unsigned int cmd,
 
                spin_unlock_irq (&chip->lock);
 
-                return put_user (rval, (int *) arg);
+                return put_user (rval, p);
 
        case SNDCTL_DSP_CHANNELS: /* 1 - mono, 2 - stereo */
                DPRINTK ("%s: CHANNELS\n", __FUNCTION__);
 
-               if (get_user (ival, (int *) arg))
+               if (get_user (ival, p))
                        return -EFAULT;
 
                spin_lock_irq (&chip->lock);
@@ -943,12 +945,12 @@ forte_dsp_ioctl (struct inode *inode, struct file *file, unsigned int cmd,
 
                spin_unlock_irq (&chip->lock);
 
-                return put_user (rval, (int *) arg);
+                return put_user (rval, p);
 
        case SNDCTL_DSP_SPEED:
                DPRINTK ("%s: SPEED\n", __FUNCTION__);
 
-               if (get_user (ival, (int *) arg))
+               if (get_user (ival, p))
                         return -EFAULT;
 
                spin_lock_irq (&chip->lock);
@@ -965,7 +967,7 @@ forte_dsp_ioctl (struct inode *inode, struct file *file, unsigned int cmd,
 
                spin_unlock_irq (&chip->lock);
 
-                return put_user(rval, (int*) arg);
+                return put_user(rval, p);
 
        case SNDCTL_DSP_GETBLKSIZE:
                DPRINTK ("%s: GETBLKSIZE\n", __FUNCTION__);
@@ -980,7 +982,7 @@ forte_dsp_ioctl (struct inode *inode, struct file *file, unsigned int cmd,
 
                spin_unlock_irq (&chip->lock);
 
-                return put_user (ival, (int *) arg);
+                return put_user (ival, p);
 
        case SNDCTL_DSP_RESET:
                DPRINTK ("%s: RESET\n", __FUNCTION__);
@@ -1022,7 +1024,7 @@ forte_dsp_ioctl (struct inode *inode, struct file *file, unsigned int cmd,
        case SNDCTL_DSP_SETFRAGMENT:
                DPRINTK ("%s: SETFRAGMENT\n", __FUNCTION__);
 
-               if (get_user (ival, (int *) arg))
+               if (get_user (ival, p))
                        return -EFAULT;
 
                spin_lock_irq (&chip->lock);
@@ -1041,7 +1043,7 @@ forte_dsp_ioctl (struct inode *inode, struct file *file, unsigned int cmd,
 
                spin_unlock_irq (&chip->lock);
 
-               return put_user (ival, (int *) arg);
+               return put_user (ival, p);
                 
         case SNDCTL_DSP_GETISPACE:
                DPRINTK ("%s: GETISPACE\n", __FUNCTION__);
@@ -1065,7 +1067,7 @@ forte_dsp_ioctl (struct inode *inode, struct file *file, unsigned int cmd,
 
                spin_unlock_irq (&chip->lock);
 
-               return copy_to_user ((void *) arg, &abi, sizeof (abi)) ? -EFAULT : 0;
+               return copy_to_user (argp, &abi, sizeof (abi)) ? -EFAULT : 0;
 
        case SNDCTL_DSP_GETIPTR:
                DPRINTK ("%s: GETIPTR\n", __FUNCTION__);
@@ -1086,7 +1088,7 @@ forte_dsp_ioctl (struct inode *inode, struct file *file, unsigned int cmd,
 
                spin_unlock_irq (&chip->lock);
 
-               return copy_to_user ((void *) arg, &cinfo, sizeof (cinfo)) ? -EFAULT : 0;
+               return copy_to_user (argp, &cinfo, sizeof (cinfo)) ? -EFAULT : 0;
 
         case SNDCTL_DSP_GETOSPACE:
                if (!wr)
@@ -1114,7 +1116,7 @@ forte_dsp_ioctl (struct inode *inode, struct file *file, unsigned int cmd,
 
                spin_unlock_irq (&chip->lock);
                
-               return copy_to_user ((void *) arg, &abi, sizeof (abi)) ? -EFAULT : 0;
+               return copy_to_user (argp, &abi, sizeof (abi)) ? -EFAULT : 0;
 
        case SNDCTL_DSP_GETOPTR:
                if (!wr)
@@ -1133,7 +1135,7 @@ forte_dsp_ioctl (struct inode *inode, struct file *file, unsigned int cmd,
 
                spin_unlock_irq (&chip->lock);
 
-               return copy_to_user ((void *) arg, &cinfo, sizeof (cinfo)) ? -EFAULT : 0;
+               return copy_to_user (argp, &cinfo, sizeof (cinfo)) ? -EFAULT : 0;
 
        case SNDCTL_DSP_GETODELAY:
                if (!wr)
@@ -1157,7 +1159,7 @@ forte_dsp_ioctl (struct inode *inode, struct file *file, unsigned int cmd,
 
                spin_unlock_irq (&chip->lock);
 
-               return put_user (ival, (int *) arg);
+               return put_user (ival, p);
 
        case SNDCTL_DSP_SETDUPLEX:
                DPRINTK ("%s: SETDUPLEX\n", __FUNCTION__);
@@ -1167,11 +1169,11 @@ forte_dsp_ioctl (struct inode *inode, struct file *file, unsigned int cmd,
        case SNDCTL_DSP_GETTRIGGER:
                DPRINTK ("%s: GETTRIGGER\n", __FUNCTION__);
                
-               return put_user (chip->trigger, (int *) arg);
+               return put_user (chip->trigger, p);
                
        case SNDCTL_DSP_SETTRIGGER:
 
-               if (get_user (ival, (int *) arg))
+               if (get_user (ival, p))
                        return -EFAULT;
 
                DPRINTK ("%s: SETTRIGGER %d\n", __FUNCTION__, ival);
@@ -1207,15 +1209,15 @@ forte_dsp_ioctl (struct inode *inode, struct file *file, unsigned int cmd,
                
        case SOUND_PCM_READ_RATE:
                DPRINTK ("%s: PCM_READ_RATE\n", __FUNCTION__);          
-               return put_user (chip->play.rate, (int *) arg);
+               return put_user (chip->play.rate, p);
 
        case SOUND_PCM_READ_CHANNELS:
                DPRINTK ("%s: PCM_READ_CHANNELS\n", __FUNCTION__);
-               return put_user (chip->play.stereo, (int *) arg);
+               return put_user (chip->play.stereo, p);
 
        case SOUND_PCM_READ_BITS:
                DPRINTK ("%s: PCM_READ_BITS\n", __FUNCTION__);          
-               return put_user (chip->play.format, (int *) arg);
+               return put_user (chip->play.format, p);
 
        case SNDCTL_DSP_NONBLOCK:
                DPRINTK ("%s: DSP_NONBLOCK\n", __FUNCTION__);           
@@ -1223,7 +1225,7 @@ forte_dsp_ioctl (struct inode *inode, struct file *file, unsigned int cmd,
                return 0;
 
        default:
-               DPRINTK ("Unsupported ioctl: %x (%p)\n", cmd, (void *) arg);
+               DPRINTK ("Unsupported ioctl: %x (%p)\n", cmd, argp);
                break;
        }
 
@@ -1428,7 +1430,7 @@ forte_dsp_mmap (struct file *file, struct vm_area_struct *vma)
  */
 
 static ssize_t 
-forte_dsp_write (struct file *file, const char *buffer, size_t bytes, 
+forte_dsp_write (struct file *file, const char __user *buffer, size_t bytes, 
                 loff_t *ppos)
 {
        struct forte_chip *chip;
@@ -1536,7 +1538,7 @@ forte_dsp_write (struct file *file, const char *buffer, size_t bytes,
  */
 
 static ssize_t 
-forte_dsp_read (struct file *file, char *buffer, size_t bytes, 
+forte_dsp_read (struct file *file, char __user *buffer, size_t bytes, 
                loff_t *ppos)
 {
        struct forte_chip *chip;