Commit 7606f3c8 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] sparse: sb annotation

sb annotation (both ALSA and OSS drivers)
parent 5a1c7700
......@@ -87,14 +87,14 @@ read_word(const void __user *buf, int offset, int mode)
unsigned short c;
if (mode & SNDRV_SFNT_SAMPLE_8BITS) {
unsigned char cc;
get_user(cc, (unsigned char*)buf + offset);
get_user(cc, (unsigned char __user *)buf + offset);
c = cc << 8; /* convert 8bit -> 16bit */
} else {
#ifdef SNDRV_LITTLE_ENDIAN
get_user(c, (unsigned short*)buf + offset);
get_user(c, (unsigned short __user *)buf + offset);
#else
unsigned short cc;
get_user(cc, (unsigned short*)buf + offset);
get_user(cc, (unsigned short __user *)buf + offset);
c = swab16(cc);
#endif
}
......
......@@ -515,12 +515,12 @@ static int emu8k_pcm_silence(snd_pcm_substream_t *subs,
static int emu8k_pcm_copy(snd_pcm_substream_t *subs,
int voice,
snd_pcm_uframes_t pos,
void *src,
void __user *src,
snd_pcm_uframes_t count)
{
emu8k_pcm_t *rec = subs->runtime->private_data;
emu8000_t *emu = rec->emu;
unsigned short *buf = src;
unsigned short __user *buf = src;
snd_emu8000_write_wait(emu, 1);
EMU8000_SMALW_WRITE(emu, pos + rec->loop_start[0]);
......
......@@ -89,9 +89,9 @@ static int read_register(sb_t *chip, unsigned char reg);
static int set_mode_register(sb_t *chip, unsigned char mode);
static int get_version(sb_t *chip);
static int snd_sb_csp_riff_load(snd_sb_csp_t * p, snd_sb_csp_microcode_t * code);
static int snd_sb_csp_riff_load(snd_sb_csp_t * p, snd_sb_csp_microcode_t __user * code);
static int snd_sb_csp_unload(snd_sb_csp_t * p);
static int snd_sb_csp_load_user(snd_sb_csp_t * p, const unsigned char *buf, int size, int load_flags);
static int snd_sb_csp_load_user(snd_sb_csp_t * p, const unsigned char __user *buf, int size, int load_flags);
static int snd_sb_csp_autoload(snd_sb_csp_t * p, int pcm_sfmt, int play_rec_mode);
static int snd_sb_csp_check_version(snd_sb_csp_t * p);
......@@ -213,7 +213,7 @@ static int snd_sb_csp_ioctl(snd_hwdep_t * hw, struct file *file, unsigned int cm
info.run_width = p->run_width;
info.version = p->version;
info.state = p->running;
if (copy_to_user((void *) arg, &info, sizeof(info)))
if (copy_to_user((void __user *)arg, &info, sizeof(info)))
err = -EFAULT;
else
err = 0;
......@@ -222,7 +222,7 @@ static int snd_sb_csp_ioctl(snd_hwdep_t * hw, struct file *file, unsigned int cm
/* load CSP microcode */
case SNDRV_SB_CSP_IOCTL_LOAD_CODE:
err = (p->running & SNDRV_SB_CSP_ST_RUNNING ?
-EBUSY : snd_sb_csp_riff_load(p, (snd_sb_csp_microcode_t *) arg));
-EBUSY : snd_sb_csp_riff_load(p, (snd_sb_csp_microcode_t __user *) arg));
break;
case SNDRV_SB_CSP_IOCTL_UNLOAD_CODE:
err = (p->running & SNDRV_SB_CSP_ST_RUNNING ?
......@@ -231,7 +231,7 @@ static int snd_sb_csp_ioctl(snd_hwdep_t * hw, struct file *file, unsigned int cm
/* change CSP running state */
case SNDRV_SB_CSP_IOCTL_START:
if (copy_from_user(&start_info, (void *) arg, sizeof(start_info)))
if (copy_from_user(&start_info, (void __user *) arg, sizeof(start_info)))
err = -EFAULT;
else
err = snd_sb_csp_start(p, start_info.sample_width, start_info.channels);
......@@ -297,11 +297,12 @@ static int snd_sb_csp_unuse(snd_sb_csp_t * p)
* load microcode via ioctl:
* code is user-space pointer
*/
static int snd_sb_csp_riff_load(snd_sb_csp_t * p, snd_sb_csp_microcode_t * mcode)
static int snd_sb_csp_riff_load(snd_sb_csp_t * p, snd_sb_csp_microcode_t __user * mcode)
{
snd_sb_csp_mc_header_t info;
unsigned char *data_ptr, *data_end;
unsigned char __user *data_ptr;
unsigned char __user *data_end;
unsigned short func_nr = 0;
riff_header_t file_h, item_h, code_h;
......@@ -627,7 +628,6 @@ static int snd_sb_csp_load(snd_sb_csp_t * p, const unsigned char *buf, int size,
/* Send high byte */
snd_sbdsp_command(p->chip, (unsigned char)((size - 1) >> 8));
/* send microcode sequence */
if (load_flags & SNDRV_SB_CSP_LOAD_FROMUSER)
/* load from kernel space */
while (size--) {
if (!snd_sbdsp_command(p->chip, *buf++))
......@@ -675,8 +675,8 @@ static int snd_sb_csp_load(snd_sb_csp_t * p, const unsigned char *buf, int size,
spin_unlock_irqrestore(&p->chip->reg_lock, flags);
return result;
}
static int snd_sb_csp_load_user(snd_sb_csp_t * p, const unsigned char *buf, int size, int load_flags)
static int snd_sb_csp_load_user(snd_sb_csp_t * p, const unsigned char __user *buf, int size, int load_flags)
{
int err = -ENOMEM;
unsigned char *kbuf = kmalloc(size, GFP_KERNEL);
......
......@@ -836,7 +836,7 @@ static signed short *lbuf16 = (signed short *)lbuf8;
static void
sb16_copy_from_user(int dev,
char *localbuf, int localoffs,
const char *userbuf, int useroffs,
const char __user *userbuf, int useroffs,
int max_in, int max_out,
int *used, int *returned,
int len)
......
......@@ -943,7 +943,10 @@ void sb_setmixer(sb_devc * devc, unsigned int port, unsigned int value)
{
unsigned long flags;
if (devc->model == MDL_ESS) return ess_setmixer (devc, port, value);
if (devc->model == MDL_ESS) {
ess_setmixer (devc, port, value);
return;
}
spin_lock_irqsave(&devc->lock, flags);
......
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