Commit a2963a61 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] sparse: es1371 annotation

es1371 annotated
parent 93e9a521
...@@ -1170,7 +1170,7 @@ static int mixdev_ioctl(struct ac97_codec *codec, unsigned int cmd, unsigned lon ...@@ -1170,7 +1170,7 @@ static int mixdev_ioctl(struct ac97_codec *codec, unsigned int cmd, unsigned lon
return 0; return 0;
case SOUND_MIXER_WRITE_PCM: /* use SRC for PCM volume */ case SOUND_MIXER_WRITE_PCM: /* use SRC for PCM volume */
if (get_user(val, (int *)arg)) if (get_user(val, (int __user *)arg))
return -EFAULT; return -EFAULT;
right = ((val >> 8) & 0xff); right = ((val >> 8) & 0xff);
left = (val & 0xff); left = (val & 0xff);
...@@ -1186,7 +1186,7 @@ static int mixdev_ioctl(struct ac97_codec *codec, unsigned int cmd, unsigned lon ...@@ -1186,7 +1186,7 @@ static int mixdev_ioctl(struct ac97_codec *codec, unsigned int cmd, unsigned lon
return 0; return 0;
case SOUND_MIXER_READ_PCM: case SOUND_MIXER_READ_PCM:
return put_user(s->spdif_volume, (int *)arg); return put_user(s->spdif_volume, (int __user *)arg);
} }
return codec->mixer_ioctl(codec, cmd, arg); return codec->mixer_ioctl(codec, cmd, arg);
} }
...@@ -1324,7 +1324,7 @@ static int drain_dac2(struct es1371_state *s, int nonblock) ...@@ -1324,7 +1324,7 @@ static int drain_dac2(struct es1371_state *s, int nonblock)
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
static ssize_t es1371_read(struct file *file, char *buffer, size_t count, loff_t *ppos) static ssize_t es1371_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos)
{ {
struct es1371_state *s = (struct es1371_state *)file->private_data; struct es1371_state *s = (struct es1371_state *)file->private_data;
DECLARE_WAITQUEUE(wait, current); DECLARE_WAITQUEUE(wait, current);
...@@ -1403,7 +1403,7 @@ static ssize_t es1371_read(struct file *file, char *buffer, size_t count, loff_t ...@@ -1403,7 +1403,7 @@ static ssize_t es1371_read(struct file *file, char *buffer, size_t count, loff_t
return ret; return ret;
} }
static ssize_t es1371_write(struct file *file, const char *buffer, size_t count, loff_t *ppos) static ssize_t es1371_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos)
{ {
struct es1371_state *s = (struct es1371_state *)file->private_data; struct es1371_state *s = (struct es1371_state *)file->private_data;
DECLARE_WAITQUEUE(wait, current); DECLARE_WAITQUEUE(wait, current);
...@@ -1578,13 +1578,15 @@ static int es1371_ioctl(struct inode *inode, struct file *file, unsigned int cmd ...@@ -1578,13 +1578,15 @@ static int es1371_ioctl(struct inode *inode, struct file *file, unsigned int cmd
count_info cinfo; count_info cinfo;
int count; int count;
int val, mapped, ret; int val, mapped, ret;
void __user *argp = (void __user *)arg;
int __user *p = argp;
VALIDATE_STATE(s); VALIDATE_STATE(s);
mapped = ((file->f_mode & FMODE_WRITE) && s->dma_dac2.mapped) || mapped = ((file->f_mode & FMODE_WRITE) && s->dma_dac2.mapped) ||
((file->f_mode & FMODE_READ) && s->dma_adc.mapped); ((file->f_mode & FMODE_READ) && s->dma_adc.mapped);
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_SYNC: case SNDCTL_DSP_SYNC:
if (file->f_mode & FMODE_WRITE) if (file->f_mode & FMODE_WRITE)
...@@ -1595,7 +1597,7 @@ static int es1371_ioctl(struct inode *inode, struct file *file, unsigned int cmd ...@@ -1595,7 +1597,7 @@ static int es1371_ioctl(struct inode *inode, struct file *file, unsigned int cmd
return 0; return 0;
case SNDCTL_DSP_GETCAPS: case SNDCTL_DSP_GETCAPS:
return put_user(DSP_CAP_DUPLEX | DSP_CAP_REALTIME | DSP_CAP_TRIGGER | DSP_CAP_MMAP, (int *)arg); return put_user(DSP_CAP_DUPLEX | DSP_CAP_REALTIME | DSP_CAP_TRIGGER | DSP_CAP_MMAP, p);
case SNDCTL_DSP_RESET: case SNDCTL_DSP_RESET:
if (file->f_mode & FMODE_WRITE) { if (file->f_mode & FMODE_WRITE) {
...@@ -1611,7 +1613,7 @@ static int es1371_ioctl(struct inode *inode, struct file *file, unsigned int cmd ...@@ -1611,7 +1613,7 @@ static int es1371_ioctl(struct inode *inode, struct file *file, unsigned int cmd
return 0; return 0;
case SNDCTL_DSP_SPEED: case SNDCTL_DSP_SPEED:
if (get_user(val, (int *)arg)) if (get_user(val, p))
return -EFAULT; return -EFAULT;
if (val >= 0) { if (val >= 0) {
if (file->f_mode & FMODE_READ) { if (file->f_mode & FMODE_READ) {
...@@ -1625,10 +1627,10 @@ static int es1371_ioctl(struct inode *inode, struct file *file, unsigned int cmd ...@@ -1625,10 +1627,10 @@ static int es1371_ioctl(struct inode *inode, struct file *file, unsigned int cmd
set_dac2_rate(s, val); set_dac2_rate(s, val);
} }
} }
return put_user((file->f_mode & FMODE_READ) ? s->adcrate : s->dac2rate, (int *)arg); return put_user((file->f_mode & FMODE_READ) ? s->adcrate : s->dac2rate, p);
case SNDCTL_DSP_STEREO: case SNDCTL_DSP_STEREO:
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) {
stop_adc(s); stop_adc(s);
...@@ -1655,7 +1657,7 @@ static int es1371_ioctl(struct inode *inode, struct file *file, unsigned int cmd ...@@ -1655,7 +1657,7 @@ static int es1371_ioctl(struct inode *inode, struct file *file, unsigned int cmd
return 0; return 0;
case SNDCTL_DSP_CHANNELS: case SNDCTL_DSP_CHANNELS:
if (get_user(val, (int *)arg)) if (get_user(val, p))
return -EFAULT; return -EFAULT;
if (val != 0) { if (val != 0) {
if (file->f_mode & FMODE_READ) { if (file->f_mode & FMODE_READ) {
...@@ -1681,13 +1683,13 @@ static int es1371_ioctl(struct inode *inode, struct file *file, unsigned int cmd ...@@ -1681,13 +1683,13 @@ static int es1371_ioctl(struct inode *inode, struct file *file, unsigned int cmd
spin_unlock_irqrestore(&s->lock, flags); spin_unlock_irqrestore(&s->lock, flags);
} }
} }
return put_user((s->sctrl & ((file->f_mode & FMODE_READ) ? SCTRL_R1SMB : SCTRL_P2SMB)) ? 2 : 1, (int *)arg); return put_user((s->sctrl & ((file->f_mode & FMODE_READ) ? SCTRL_R1SMB : SCTRL_P2SMB)) ? 2 : 1, p);
case SNDCTL_DSP_GETFMTS: /* Returns a mask */ case SNDCTL_DSP_GETFMTS: /* Returns a mask */
return put_user(AFMT_S16_LE|AFMT_U8, (int *)arg); return put_user(AFMT_S16_LE|AFMT_U8, p);
case SNDCTL_DSP_SETFMT: /* Selects ONE fmt*/ case SNDCTL_DSP_SETFMT: /* Selects ONE fmt*/
if (get_user(val, (int *)arg)) if (get_user(val, p))
return -EFAULT; return -EFAULT;
if (val != AFMT_QUERY) { if (val != AFMT_QUERY) {
if (file->f_mode & FMODE_READ) { if (file->f_mode & FMODE_READ) {
...@@ -1714,7 +1716,7 @@ static int es1371_ioctl(struct inode *inode, struct file *file, unsigned int cmd ...@@ -1714,7 +1716,7 @@ static int es1371_ioctl(struct inode *inode, struct file *file, unsigned int cmd
} }
} }
return put_user((s->sctrl & ((file->f_mode & FMODE_READ) ? SCTRL_R1SEB : SCTRL_P2SEB)) ? return put_user((s->sctrl & ((file->f_mode & FMODE_READ) ? SCTRL_R1SEB : SCTRL_P2SEB)) ?
AFMT_S16_LE : AFMT_U8, (int *)arg); AFMT_S16_LE : AFMT_U8, p);
case SNDCTL_DSP_POST: case SNDCTL_DSP_POST:
return 0; return 0;
...@@ -1725,10 +1727,10 @@ static int es1371_ioctl(struct inode *inode, struct file *file, unsigned int cmd ...@@ -1725,10 +1727,10 @@ static int es1371_ioctl(struct inode *inode, struct file *file, unsigned int cmd
val |= PCM_ENABLE_INPUT; val |= PCM_ENABLE_INPUT;
if (file->f_mode & FMODE_WRITE && s->ctrl & CTRL_DAC2_EN) if (file->f_mode & FMODE_WRITE && s->ctrl & CTRL_DAC2_EN)
val |= PCM_ENABLE_OUTPUT; val |= PCM_ENABLE_OUTPUT;
return put_user(val, (int *)arg); return put_user(val, p);
case SNDCTL_DSP_SETTRIGGER: case SNDCTL_DSP_SETTRIGGER:
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) {
if (val & PCM_ENABLE_INPUT) { if (val & PCM_ENABLE_INPUT) {
...@@ -1769,7 +1771,7 @@ static int es1371_ioctl(struct inode *inode, struct file *file, unsigned int cmd ...@@ -1769,7 +1771,7 @@ static int es1371_ioctl(struct inode *inode, struct file *file, unsigned int cmd
abinfo.fragstotal = s->dma_dac2.numfrag; abinfo.fragstotal = s->dma_dac2.numfrag;
abinfo.fragments = abinfo.bytes >> s->dma_dac2.fragshift; abinfo.fragments = abinfo.bytes >> s->dma_dac2.fragshift;
spin_unlock_irqrestore(&s->lock, flags); spin_unlock_irqrestore(&s->lock, flags);
return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; return copy_to_user(argp, &abinfo, sizeof(abinfo)) ? -EFAULT : 0;
case SNDCTL_DSP_GETISPACE: case SNDCTL_DSP_GETISPACE:
if (!(file->f_mode & FMODE_READ)) if (!(file->f_mode & FMODE_READ))
...@@ -1786,7 +1788,7 @@ static int es1371_ioctl(struct inode *inode, struct file *file, unsigned int cmd ...@@ -1786,7 +1788,7 @@ static int es1371_ioctl(struct inode *inode, struct file *file, unsigned int cmd
abinfo.fragstotal = s->dma_adc.numfrag; abinfo.fragstotal = s->dma_adc.numfrag;
abinfo.fragments = abinfo.bytes >> s->dma_adc.fragshift; abinfo.fragments = abinfo.bytes >> s->dma_adc.fragshift;
spin_unlock_irqrestore(&s->lock, flags); spin_unlock_irqrestore(&s->lock, flags);
return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; return copy_to_user(argp, &abinfo, sizeof(abinfo)) ? -EFAULT : 0;
case SNDCTL_DSP_NONBLOCK: case SNDCTL_DSP_NONBLOCK:
file->f_flags |= O_NONBLOCK; file->f_flags |= O_NONBLOCK;
...@@ -1803,7 +1805,7 @@ static int es1371_ioctl(struct inode *inode, struct file *file, unsigned int cmd ...@@ -1803,7 +1805,7 @@ static int es1371_ioctl(struct inode *inode, struct file *file, unsigned int cmd
spin_unlock_irqrestore(&s->lock, flags); spin_unlock_irqrestore(&s->lock, flags);
if (count < 0) if (count < 0)
count = 0; count = 0;
return put_user(count, (int *)arg); return put_user(count, p);
case SNDCTL_DSP_GETIPTR: case SNDCTL_DSP_GETIPTR:
if (!(file->f_mode & FMODE_READ)) if (!(file->f_mode & FMODE_READ))
...@@ -1821,7 +1823,7 @@ static int es1371_ioctl(struct inode *inode, struct file *file, unsigned int cmd ...@@ -1821,7 +1823,7 @@ static int es1371_ioctl(struct inode *inode, struct file *file, unsigned int cmd
if (s->dma_adc.mapped) if (s->dma_adc.mapped)
s->dma_adc.count &= s->dma_adc.fragsize-1; s->dma_adc.count &= s->dma_adc.fragsize-1;
spin_unlock_irqrestore(&s->lock, flags); spin_unlock_irqrestore(&s->lock, flags);
if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo))) if (copy_to_user(argp, &cinfo, sizeof(cinfo)))
return -EFAULT; return -EFAULT;
return 0; return 0;
...@@ -1841,7 +1843,7 @@ static int es1371_ioctl(struct inode *inode, struct file *file, unsigned int cmd ...@@ -1841,7 +1843,7 @@ static int es1371_ioctl(struct inode *inode, struct file *file, unsigned int cmd
if (s->dma_dac2.mapped) if (s->dma_dac2.mapped)
s->dma_dac2.count &= s->dma_dac2.fragsize-1; s->dma_dac2.count &= s->dma_dac2.fragsize-1;
spin_unlock_irqrestore(&s->lock, flags); spin_unlock_irqrestore(&s->lock, flags);
if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo))) if (copy_to_user(argp, &cinfo, sizeof(cinfo)))
return -EFAULT; return -EFAULT;
return 0; return 0;
...@@ -1849,14 +1851,14 @@ static int es1371_ioctl(struct inode *inode, struct file *file, unsigned int cmd ...@@ -1849,14 +1851,14 @@ static int es1371_ioctl(struct inode *inode, struct file *file, unsigned int cmd
if (file->f_mode & FMODE_WRITE) { if (file->f_mode & FMODE_WRITE) {
if ((val = prog_dmabuf_dac2(s))) if ((val = prog_dmabuf_dac2(s)))
return val; return val;
return put_user(s->dma_dac2.fragsize, (int *)arg); return put_user(s->dma_dac2.fragsize, p);
} }
if ((val = prog_dmabuf_adc(s))) if ((val = prog_dmabuf_adc(s)))
return val; return val;
return put_user(s->dma_adc.fragsize, (int *)arg); return put_user(s->dma_adc.fragsize, p);
case SNDCTL_DSP_SETFRAGMENT: case SNDCTL_DSP_SETFRAGMENT:
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) {
s->dma_adc.ossfragshift = val & 0xffff; s->dma_adc.ossfragshift = val & 0xffff;
...@@ -1884,7 +1886,7 @@ static int es1371_ioctl(struct inode *inode, struct file *file, unsigned int cmd ...@@ -1884,7 +1886,7 @@ static int es1371_ioctl(struct inode *inode, struct file *file, unsigned int cmd
if ((file->f_mode & FMODE_READ && s->dma_adc.subdivision) || if ((file->f_mode & FMODE_READ && s->dma_adc.subdivision) ||
(file->f_mode & FMODE_WRITE && s->dma_dac2.subdivision)) (file->f_mode & FMODE_WRITE && s->dma_dac2.subdivision))
return -EINVAL; return -EINVAL;
if (get_user(val, (int *)arg)) if (get_user(val, p))
return -EFAULT; return -EFAULT;
if (val != 1 && val != 2 && val != 4) if (val != 1 && val != 2 && val != 4)
return -EINVAL; return -EINVAL;
...@@ -1895,13 +1897,13 @@ static int es1371_ioctl(struct inode *inode, struct file *file, unsigned int cmd ...@@ -1895,13 +1897,13 @@ static int es1371_ioctl(struct inode *inode, struct file *file, unsigned int cmd
return 0; return 0;
case SOUND_PCM_READ_RATE: case SOUND_PCM_READ_RATE:
return put_user((file->f_mode & FMODE_READ) ? s->adcrate : s->dac2rate, (int *)arg); return put_user((file->f_mode & FMODE_READ) ? s->adcrate : s->dac2rate, p);
case SOUND_PCM_READ_CHANNELS: case SOUND_PCM_READ_CHANNELS:
return put_user((s->sctrl & ((file->f_mode & FMODE_READ) ? SCTRL_R1SMB : SCTRL_P2SMB)) ? 2 : 1, (int *)arg); return put_user((s->sctrl & ((file->f_mode & FMODE_READ) ? SCTRL_R1SMB : SCTRL_P2SMB)) ? 2 : 1, p);
case SOUND_PCM_READ_BITS: case SOUND_PCM_READ_BITS:
return put_user((s->sctrl & ((file->f_mode & FMODE_READ) ? SCTRL_R1SEB : SCTRL_P2SEB)) ? 16 : 8, (int *)arg); return put_user((s->sctrl & ((file->f_mode & FMODE_READ) ? SCTRL_R1SEB : SCTRL_P2SEB)) ? 16 : 8, p);
case SOUND_PCM_WRITE_FILTER: case SOUND_PCM_WRITE_FILTER:
case SNDCTL_DSP_SETSYNCRO: case SNDCTL_DSP_SETSYNCRO:
...@@ -2017,7 +2019,7 @@ static /*const*/ struct file_operations es1371_audio_fops = { ...@@ -2017,7 +2019,7 @@ static /*const*/ struct file_operations es1371_audio_fops = {
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
static ssize_t es1371_write_dac(struct file *file, const char *buffer, size_t count, loff_t *ppos) static ssize_t es1371_write_dac(struct file *file, const char __user *buffer, size_t count, loff_t *ppos)
{ {
struct es1371_state *s = (struct es1371_state *)file->private_data; struct es1371_state *s = (struct es1371_state *)file->private_data;
DECLARE_WAITQUEUE(wait, current); DECLARE_WAITQUEUE(wait, current);
...@@ -2149,11 +2151,12 @@ static int es1371_ioctl_dac(struct inode *inode, struct file *file, unsigned int ...@@ -2149,11 +2151,12 @@ static int es1371_ioctl_dac(struct inode *inode, struct file *file, unsigned int
count_info cinfo; count_info cinfo;
int count; int count;
int val, ret; int val, ret;
int __user *p = (int __user *)arg;
VALIDATE_STATE(s); VALIDATE_STATE(s);
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_SYNC: case SNDCTL_DSP_SYNC:
return drain_dac1(s, 0/*file->f_flags & O_NONBLOCK*/); return drain_dac1(s, 0/*file->f_flags & O_NONBLOCK*/);
...@@ -2162,7 +2165,7 @@ static int es1371_ioctl_dac(struct inode *inode, struct file *file, unsigned int ...@@ -2162,7 +2165,7 @@ static int es1371_ioctl_dac(struct inode *inode, struct file *file, unsigned int
return -EINVAL; return -EINVAL;
case SNDCTL_DSP_GETCAPS: case SNDCTL_DSP_GETCAPS:
return put_user(DSP_CAP_REALTIME | DSP_CAP_TRIGGER | DSP_CAP_MMAP, (int *)arg); return put_user(DSP_CAP_REALTIME | DSP_CAP_TRIGGER | DSP_CAP_MMAP, p);
case SNDCTL_DSP_RESET: case SNDCTL_DSP_RESET:
stop_dac1(s); stop_dac1(s);
...@@ -2171,17 +2174,17 @@ static int es1371_ioctl_dac(struct inode *inode, struct file *file, unsigned int ...@@ -2171,17 +2174,17 @@ static int es1371_ioctl_dac(struct inode *inode, struct file *file, unsigned int
return 0; return 0;
case SNDCTL_DSP_SPEED: case SNDCTL_DSP_SPEED:
if (get_user(val, (int *)arg)) if (get_user(val, p))
return -EFAULT; return -EFAULT;
if (val >= 0) { if (val >= 0) {
stop_dac1(s); stop_dac1(s);
s->dma_dac1.ready = 0; s->dma_dac1.ready = 0;
set_dac1_rate(s, val); set_dac1_rate(s, val);
} }
return put_user(s->dac1rate, (int *)arg); return put_user(s->dac1rate, p);
case SNDCTL_DSP_STEREO: case SNDCTL_DSP_STEREO:
if (get_user(val, (int *)arg)) if (get_user(val, p))
return -EFAULT; return -EFAULT;
stop_dac1(s); stop_dac1(s);
s->dma_dac1.ready = 0; s->dma_dac1.ready = 0;
...@@ -2195,7 +2198,7 @@ static int es1371_ioctl_dac(struct inode *inode, struct file *file, unsigned int ...@@ -2195,7 +2198,7 @@ static int es1371_ioctl_dac(struct inode *inode, struct file *file, unsigned int
return 0; return 0;
case SNDCTL_DSP_CHANNELS: case SNDCTL_DSP_CHANNELS:
if (get_user(val, (int *)arg)) if (get_user(val, p))
return -EFAULT; return -EFAULT;
if (val != 0) { if (val != 0) {
stop_dac1(s); stop_dac1(s);
...@@ -2208,13 +2211,13 @@ static int es1371_ioctl_dac(struct inode *inode, struct file *file, unsigned int ...@@ -2208,13 +2211,13 @@ static int es1371_ioctl_dac(struct inode *inode, struct file *file, unsigned int
outl(s->sctrl, s->io+ES1371_REG_SERIAL_CONTROL); outl(s->sctrl, s->io+ES1371_REG_SERIAL_CONTROL);
spin_unlock_irqrestore(&s->lock, flags); spin_unlock_irqrestore(&s->lock, flags);
} }
return put_user((s->sctrl & SCTRL_P1SMB) ? 2 : 1, (int *)arg); return put_user((s->sctrl & SCTRL_P1SMB) ? 2 : 1, p);
case SNDCTL_DSP_GETFMTS: /* Returns a mask */ case SNDCTL_DSP_GETFMTS: /* Returns a mask */
return put_user(AFMT_S16_LE|AFMT_U8, (int *)arg); return put_user(AFMT_S16_LE|AFMT_U8, p);
case SNDCTL_DSP_SETFMT: /* Selects ONE fmt*/ case SNDCTL_DSP_SETFMT: /* Selects ONE fmt*/
if (get_user(val, (int *)arg)) if (get_user(val, p))
return -EFAULT; return -EFAULT;
if (val != AFMT_QUERY) { if (val != AFMT_QUERY) {
stop_dac1(s); stop_dac1(s);
...@@ -2227,16 +2230,16 @@ static int es1371_ioctl_dac(struct inode *inode, struct file *file, unsigned int ...@@ -2227,16 +2230,16 @@ static int es1371_ioctl_dac(struct inode *inode, struct file *file, unsigned int
outl(s->sctrl, s->io+ES1371_REG_SERIAL_CONTROL); outl(s->sctrl, s->io+ES1371_REG_SERIAL_CONTROL);
spin_unlock_irqrestore(&s->lock, flags); spin_unlock_irqrestore(&s->lock, flags);
} }
return put_user((s->sctrl & SCTRL_P1SEB) ? AFMT_S16_LE : AFMT_U8, (int *)arg); return put_user((s->sctrl & SCTRL_P1SEB) ? AFMT_S16_LE : AFMT_U8, p);
case SNDCTL_DSP_POST: case SNDCTL_DSP_POST:
return 0; return 0;
case SNDCTL_DSP_GETTRIGGER: case SNDCTL_DSP_GETTRIGGER:
return put_user((s->ctrl & CTRL_DAC1_EN) ? PCM_ENABLE_OUTPUT : 0, (int *)arg); return put_user((s->ctrl & CTRL_DAC1_EN) ? PCM_ENABLE_OUTPUT : 0, p);
case SNDCTL_DSP_SETTRIGGER: case SNDCTL_DSP_SETTRIGGER:
if (get_user(val, (int *)arg)) if (get_user(val, p))
return -EFAULT; return -EFAULT;
if (val & PCM_ENABLE_OUTPUT) { if (val & PCM_ENABLE_OUTPUT) {
if (!s->dma_dac1.ready && (ret = prog_dmabuf_dac1(s))) if (!s->dma_dac1.ready && (ret = prog_dmabuf_dac1(s)))
...@@ -2262,7 +2265,7 @@ static int es1371_ioctl_dac(struct inode *inode, struct file *file, unsigned int ...@@ -2262,7 +2265,7 @@ static int es1371_ioctl_dac(struct inode *inode, struct file *file, unsigned int
abinfo.fragstotal = s->dma_dac1.numfrag; abinfo.fragstotal = s->dma_dac1.numfrag;
abinfo.fragments = abinfo.bytes >> s->dma_dac1.fragshift; abinfo.fragments = abinfo.bytes >> s->dma_dac1.fragshift;
spin_unlock_irqrestore(&s->lock, flags); spin_unlock_irqrestore(&s->lock, flags);
return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0; return copy_to_user((void __user *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0;
case SNDCTL_DSP_NONBLOCK: case SNDCTL_DSP_NONBLOCK:
file->f_flags |= O_NONBLOCK; file->f_flags |= O_NONBLOCK;
...@@ -2277,7 +2280,7 @@ static int es1371_ioctl_dac(struct inode *inode, struct file *file, unsigned int ...@@ -2277,7 +2280,7 @@ static int es1371_ioctl_dac(struct inode *inode, struct file *file, unsigned int
spin_unlock_irqrestore(&s->lock, flags); spin_unlock_irqrestore(&s->lock, flags);
if (count < 0) if (count < 0)
count = 0; count = 0;
return put_user(count, (int *)arg); return put_user(count, p);
case SNDCTL_DSP_GETOPTR: case SNDCTL_DSP_GETOPTR:
if (!s->dma_dac1.ready && (val = prog_dmabuf_dac1(s)) != 0) if (!s->dma_dac1.ready && (val = prog_dmabuf_dac1(s)) != 0)
...@@ -2293,17 +2296,17 @@ static int es1371_ioctl_dac(struct inode *inode, struct file *file, unsigned int ...@@ -2293,17 +2296,17 @@ static int es1371_ioctl_dac(struct inode *inode, struct file *file, unsigned int
if (s->dma_dac1.mapped) if (s->dma_dac1.mapped)
s->dma_dac1.count &= s->dma_dac1.fragsize-1; s->dma_dac1.count &= s->dma_dac1.fragsize-1;
spin_unlock_irqrestore(&s->lock, flags); spin_unlock_irqrestore(&s->lock, flags);
if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo))) if (copy_to_user((void __user *)arg, &cinfo, sizeof(cinfo)))
return -EFAULT; return -EFAULT;
return 0; return 0;
case SNDCTL_DSP_GETBLKSIZE: case SNDCTL_DSP_GETBLKSIZE:
if ((val = prog_dmabuf_dac1(s))) if ((val = prog_dmabuf_dac1(s)))
return val; return val;
return put_user(s->dma_dac1.fragsize, (int *)arg); return put_user(s->dma_dac1.fragsize, p);
case SNDCTL_DSP_SETFRAGMENT: case SNDCTL_DSP_SETFRAGMENT:
if (get_user(val, (int *)arg)) if (get_user(val, p))
return -EFAULT; return -EFAULT;
s->dma_dac1.ossfragshift = val & 0xffff; s->dma_dac1.ossfragshift = val & 0xffff;
s->dma_dac1.ossmaxfrags = (val >> 16) & 0xffff; s->dma_dac1.ossmaxfrags = (val >> 16) & 0xffff;
...@@ -2318,7 +2321,7 @@ static int es1371_ioctl_dac(struct inode *inode, struct file *file, unsigned int ...@@ -2318,7 +2321,7 @@ static int es1371_ioctl_dac(struct inode *inode, struct file *file, unsigned int
case SNDCTL_DSP_SUBDIVIDE: case SNDCTL_DSP_SUBDIVIDE:
if (s->dma_dac1.subdivision) if (s->dma_dac1.subdivision)
return -EINVAL; return -EINVAL;
if (get_user(val, (int *)arg)) if (get_user(val, p))
return -EFAULT; return -EFAULT;
if (val != 1 && val != 2 && val != 4) if (val != 1 && val != 2 && val != 4)
return -EINVAL; return -EINVAL;
...@@ -2326,13 +2329,13 @@ static int es1371_ioctl_dac(struct inode *inode, struct file *file, unsigned int ...@@ -2326,13 +2329,13 @@ static int es1371_ioctl_dac(struct inode *inode, struct file *file, unsigned int
return 0; return 0;
case SOUND_PCM_READ_RATE: case SOUND_PCM_READ_RATE:
return put_user(s->dac1rate, (int *)arg); return put_user(s->dac1rate, p);
case SOUND_PCM_READ_CHANNELS: case SOUND_PCM_READ_CHANNELS:
return put_user((s->sctrl & SCTRL_P1SMB) ? 2 : 1, (int *)arg); return put_user((s->sctrl & SCTRL_P1SMB) ? 2 : 1, p);
case SOUND_PCM_READ_BITS: case SOUND_PCM_READ_BITS:
return put_user((s->sctrl & SCTRL_P1SEB) ? 16 : 8, (int *)arg); return put_user((s->sctrl & SCTRL_P1SEB) ? 16 : 8, p);
case SOUND_PCM_WRITE_FILTER: case SOUND_PCM_WRITE_FILTER:
case SNDCTL_DSP_SETSYNCRO: case SNDCTL_DSP_SETSYNCRO:
...@@ -2430,7 +2433,7 @@ static /*const*/ struct file_operations es1371_dac_fops = { ...@@ -2430,7 +2433,7 @@ static /*const*/ struct file_operations es1371_dac_fops = {
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
static ssize_t es1371_midi_read(struct file *file, char *buffer, size_t count, loff_t *ppos) static ssize_t es1371_midi_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos)
{ {
struct es1371_state *s = (struct es1371_state *)file->private_data; struct es1371_state *s = (struct es1371_state *)file->private_data;
DECLARE_WAITQUEUE(wait, current); DECLARE_WAITQUEUE(wait, current);
...@@ -2493,7 +2496,7 @@ static ssize_t es1371_midi_read(struct file *file, char *buffer, size_t count, l ...@@ -2493,7 +2496,7 @@ static ssize_t es1371_midi_read(struct file *file, char *buffer, size_t count, l
return ret; return ret;
} }
static ssize_t es1371_midi_write(struct file *file, const char *buffer, size_t count, loff_t *ppos) static ssize_t es1371_midi_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos)
{ {
struct es1371_state *s = (struct es1371_state *)file->private_data; struct es1371_state *s = (struct es1371_state *)file->private_data;
DECLARE_WAITQUEUE(wait, current); DECLARE_WAITQUEUE(wait, current);
......
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