Commit 936f0e7d authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] sparse: ad1889 annotation

ad1889 annotated
parent aff8ccb8
...@@ -437,13 +437,13 @@ XXX ...@@ -437,13 +437,13 @@ XXX
/************************* /dev/dsp interfaces ************************* */ /************************* /dev/dsp interfaces ************************* */
static ssize_t ad1889_read(struct file *file, char *buffer, size_t count, static ssize_t ad1889_read(struct file *file, char __user *buffer, size_t count,
loff_t *ppos) loff_t *ppos)
{ {
return 0; return 0;
} }
static ssize_t ad1889_write(struct file *file, const char *buffer, size_t count, static ssize_t ad1889_write(struct file *file, const char __user *buffer, size_t count,
loff_t *ppos) loff_t *ppos)
{ {
ad1889_dev_t *dev = (ad1889_dev_t *)file->private_data; ad1889_dev_t *dev = (ad1889_dev_t *)file->private_data;
...@@ -617,11 +617,12 @@ static int ad1889_ioctl(struct inode *inode, struct file *file, unsigned int cmd ...@@ -617,11 +617,12 @@ static int ad1889_ioctl(struct inode *inode, struct file *file, unsigned int cmd
ad1889_dev_t *dev = (ad1889_dev_t *)file->private_data; ad1889_dev_t *dev = (ad1889_dev_t *)file->private_data;
struct dmabuf *dmabuf; struct dmabuf *dmabuf;
audio_buf_info abinfo; audio_buf_info abinfo;
int __user *p = (int __user *)arg;
switch (cmd) switch (cmd)
{ {
case OSS_GETVERSION: case OSS_GETVERSION:
return put_user(SOUND_VERSION, (int *)arg); return put_user(SOUND_VERSION, p);
case SNDCTL_DSP_RESET: case SNDCTL_DSP_RESET:
break; break;
...@@ -631,7 +632,7 @@ static int ad1889_ioctl(struct inode *inode, struct file *file, unsigned int cmd ...@@ -631,7 +632,7 @@ static int ad1889_ioctl(struct inode *inode, struct file *file, unsigned int cmd
case SNDCTL_DSP_SPEED: case SNDCTL_DSP_SPEED:
/* set sampling rate */ /* set sampling rate */
if (get_user(val, (int *)arg)) if (get_user(val, p))
return -EFAULT; return -EFAULT;
if (val > 5400 && val < 48000) if (val > 5400 && val < 48000)
{ {
...@@ -643,7 +644,7 @@ static int ad1889_ioctl(struct inode *inode, struct file *file, unsigned int cmd ...@@ -643,7 +644,7 @@ static int ad1889_ioctl(struct inode *inode, struct file *file, unsigned int cmd
return 0; return 0;
case SNDCTL_DSP_STEREO: /* undocumented? */ case SNDCTL_DSP_STEREO: /* undocumented? */
if (get_user(val, (int *)arg)) if (get_user(val, p))
return -EFAULT; return -EFAULT;
if (file->f_mode & FMODE_READ) { if (file->f_mode & FMODE_READ) {
val = AD1889_READW(ad1889_dev, AD_DSWSMC); val = AD1889_READW(ad1889_dev, AD_DSWSMC);
...@@ -667,13 +668,13 @@ static int ad1889_ioctl(struct inode *inode, struct file *file, unsigned int cmd ...@@ -667,13 +668,13 @@ static int ad1889_ioctl(struct inode *inode, struct file *file, unsigned int cmd
return 0; return 0;
case SNDCTL_DSP_GETBLKSIZE: case SNDCTL_DSP_GETBLKSIZE:
return put_user(DMA_SIZE, (int *)arg); return put_user(DMA_SIZE, p);
case SNDCTL_DSP_GETFMTS: case SNDCTL_DSP_GETFMTS:
return put_user(AFMT_S16_LE|AFMT_U8, (int *)arg); return put_user(AFMT_S16_LE|AFMT_U8, p);
case SNDCTL_DSP_SETFMT: case SNDCTL_DSP_SETFMT:
if (get_user(val, (int *)arg)) if (get_user(val, p))
return -EFAULT; return -EFAULT;
if (file->f_mode & FMODE_READ) if (file->f_mode & FMODE_READ)
...@@ -682,7 +683,7 @@ static int ad1889_ioctl(struct inode *inode, struct file *file, unsigned int cmd ...@@ -682,7 +683,7 @@ static int ad1889_ioctl(struct inode *inode, struct file *file, unsigned int cmd
if (file->f_mode & FMODE_WRITE) if (file->f_mode & FMODE_WRITE)
ad1889_set_wav_fmt(dev, val); ad1889_set_wav_fmt(dev, val);
return put_user(val, (int *)arg); return put_user(val, p);
case SNDCTL_DSP_CHANNELS: case SNDCTL_DSP_CHANNELS:
break; break;
...@@ -696,7 +697,7 @@ static int ad1889_ioctl(struct inode *inode, struct file *file, unsigned int cmd ...@@ -696,7 +697,7 @@ static int ad1889_ioctl(struct inode *inode, struct file *file, unsigned int cmd
case SNDCTL_DSP_SETFRAGMENT: case SNDCTL_DSP_SETFRAGMENT:
/* not supported; uses fixed fragment sizes */ /* not supported; uses fixed fragment sizes */
return put_user(DMA_SIZE, (int *)arg); return put_user(DMA_SIZE, p);
case SNDCTL_DSP_GETOSPACE: case SNDCTL_DSP_GETOSPACE:
case SNDCTL_DSP_GETISPACE: case SNDCTL_DSP_GETISPACE:
...@@ -709,13 +710,13 @@ static int ad1889_ioctl(struct inode *inode, struct file *file, unsigned int cmd ...@@ -709,13 +710,13 @@ static int ad1889_ioctl(struct inode *inode, struct file *file, unsigned int cmd
abinfo.fragstotal = 1; abinfo.fragstotal = 1;
abinfo.fragsize = DMA_SIZE; abinfo.fragsize = DMA_SIZE;
abinfo.bytes = DMA_SIZE; abinfo.bytes = DMA_SIZE;
return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; return copy_to_user(p, &abinfo, sizeof(abinfo)) ? -EFAULT : 0;
case SNDCTL_DSP_NONBLOCK: case SNDCTL_DSP_NONBLOCK:
file->f_flags |= O_NONBLOCK; file->f_flags |= O_NONBLOCK;
return 0; return 0;
case SNDCTL_DSP_GETCAPS: case SNDCTL_DSP_GETCAPS:
return put_user(0, (int *)arg); return put_user(0, p);
case SNDCTL_DSP_GETTRIGGER: case SNDCTL_DSP_GETTRIGGER:
case SNDCTL_DSP_SETTRIGGER: case SNDCTL_DSP_SETTRIGGER:
...@@ -732,7 +733,7 @@ static int ad1889_ioctl(struct inode *inode, struct file *file, unsigned int cmd ...@@ -732,7 +733,7 @@ static int ad1889_ioctl(struct inode *inode, struct file *file, unsigned int cmd
break; break;
case SOUND_PCM_READ_RATE: case SOUND_PCM_READ_RATE:
return put_user(AD1889_READW(ad1889_dev, AD_DSWAS), (int *)arg); return put_user(AD1889_READW(ad1889_dev, AD_DSWAS), p);
case SOUND_PCM_READ_CHANNELS: case SOUND_PCM_READ_CHANNELS:
case SOUND_PCM_READ_BITS: case SOUND_PCM_READ_BITS:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment