Commit 50a55787 authored by Jaroslav Kysela's avatar Jaroslav Kysela

ALSA CVS update - Takashi Iwai <tiwai@suse.de>

CS4281 driver,RME32 driver,RME96 driver,CS46xx driver,NM256 driver
- fixed compile warnings with cast for memcpy_fromio/toio.
- use copy_to_user_fromio() in proc output.
parent 5e2ece84
......@@ -1178,23 +1178,11 @@ static long snd_cs4281_BA0_read(snd_info_entry_t *entry, void *file_private_data
if (file->f_pos + size > CS4281_BA0_SIZE)
size = (long)CS4281_BA0_SIZE - file->f_pos;
if (size > 0) {
char *tmp;
long res;
unsigned long virt;
if ((tmp = kmalloc(size, GFP_KERNEL)) == NULL)
return -ENOMEM;
virt = chip->ba0 + file->f_pos;
memcpy_fromio(tmp, virt, size);
if (copy_to_user(buf, tmp, size))
res = -EFAULT;
else {
res = size;
file->f_pos += size;
}
kfree(tmp);
return res;
if (copy_to_user_fromio(buf, chip->ba0 + file->f_pos, size))
return -EFAULT;
file->f_pos += size;
}
return 0;
return size;
}
static long snd_cs4281_BA1_read(snd_info_entry_t *entry, void *file_private_data,
......@@ -1207,23 +1195,11 @@ static long snd_cs4281_BA1_read(snd_info_entry_t *entry, void *file_private_data
if (file->f_pos + size > CS4281_BA1_SIZE)
size = (long)CS4281_BA1_SIZE - file->f_pos;
if (size > 0) {
char *tmp;
long res;
unsigned long virt;
if ((tmp = kmalloc(size, GFP_KERNEL)) == NULL)
return -ENOMEM;
virt = chip->ba1 + file->f_pos;
memcpy_fromio(tmp, virt, size);
if (copy_to_user(buf, tmp, size))
res = -EFAULT;
else {
res = size;
file->f_pos += size;
}
kfree(tmp);
return res;
if (copy_to_user_fromio(buf, chip->ba1 + file->f_pos, size))
return -EFAULT;
file->f_pos += size;
}
return 0;
return size;
}
static struct snd_info_entry_ops snd_cs4281_proc_ops_BA0 = {
......
......@@ -2849,23 +2849,11 @@ static long snd_cs46xx_io_read(snd_info_entry_t *entry, void *file_private_data,
if (file->f_pos + (size_t)size > region->size)
size = region->size - file->f_pos;
if (size > 0) {
char *tmp;
long res;
unsigned long virt;
if ((tmp = kmalloc(size, GFP_KERNEL)) == NULL)
return -ENOMEM;
virt = region->remap_addr + file->f_pos;
memcpy_fromio(tmp, virt, size);
if (copy_to_user(buf, tmp, size))
res = -EFAULT;
else {
res = size;
file->f_pos += size;
}
kfree(tmp);
return res;
if (copy_to_user_fromio(buf, region->remap_addr + file->f_pos, size))
return -EFAULT;
file->f_pos += size;
}
return 0;
return size;
}
static struct snd_info_entry_ops snd_cs46xx_proc_io_ops = {
......
......@@ -335,7 +335,7 @@ snd_nm256_write_buffer(nm256_t *chip, void *src, int offset, int size)
return;
}
#endif
memcpy_toio(chip->buffer + offset, src, size);
memcpy_toio((void *)chip->buffer + offset, src, size);
}
/*
......
......@@ -1191,18 +1191,18 @@ snd_rme32_playback_pointer(snd_pcm_substream_t * substream)
}
bytes = diff << rme32->playback_frlog;
if (bytes > RME32_BUFFER_SIZE - rme32->playback_ptr) {
memcpy_toio(rme32->iobase + RME32_IO_DATA_BUFFER + rme32->playback_ptr,
memcpy_toio((void *)(rme32->iobase + RME32_IO_DATA_BUFFER + rme32->playback_ptr),
runtime->dma_area + rme32->playback_ptr,
RME32_BUFFER_SIZE - rme32->playback_ptr);
bytes -= RME32_BUFFER_SIZE - rme32->playback_ptr;
if (bytes > RME32_BUFFER_SIZE) {
bytes = RME32_BUFFER_SIZE;
}
memcpy_toio(rme32->iobase + RME32_IO_DATA_BUFFER,
memcpy_toio((void *)(rme32->iobase + RME32_IO_DATA_BUFFER),
runtime->dma_area, bytes);
rme32->playback_ptr = bytes;
} else if (bytes != 0) {
memcpy_toio(rme32->iobase + RME32_IO_DATA_BUFFER + rme32->playback_ptr,
memcpy_toio((void *)(rme32->iobase + RME32_IO_DATA_BUFFER + rme32->playback_ptr),
runtime->dma_area + rme32->playback_ptr, bytes);
rme32->playback_ptr += bytes;
}
......@@ -1223,17 +1223,17 @@ snd_rme32_capture_pointer(snd_pcm_substream_t * substream)
ptr = frameptr << rme32->capture_frlog;
if (ptr > rme32->capture_ptr) {
memcpy_fromio(runtime->dma_area + rme32->capture_ptr,
rme32->iobase + RME32_IO_DATA_BUFFER +
rme32->capture_ptr,
(void *)(rme32->iobase + RME32_IO_DATA_BUFFER +
rme32->capture_ptr),
ptr - rme32->capture_ptr);
rme32->capture_ptr += ptr - rme32->capture_ptr;
} else if (ptr < rme32->capture_ptr) {
memcpy_fromio(runtime->dma_area + rme32->capture_ptr,
rme32->iobase + RME32_IO_DATA_BUFFER +
rme32->capture_ptr,
(void *)(rme32->iobase + RME32_IO_DATA_BUFFER +
rme32->capture_ptr),
RME32_BUFFER_SIZE - rme32->capture_ptr);
memcpy_fromio(runtime->dma_area,
rme32->iobase + RME32_IO_DATA_BUFFER,
(void *)(rme32->iobase + RME32_IO_DATA_BUFFER),
ptr);
rme32->capture_ptr = ptr;
}
......
......@@ -1524,21 +1524,21 @@ snd_rme96_playback_pointer(snd_pcm_substream_t *substream)
bytes = diff << rme96->playback_frlog;
if (bytes > RME96_BUFFER_SIZE - rme96->playback_ptr) {
memcpy_toio(rme96->iobase + RME96_IO_PLAY_BUFFER +
rme96->playback_ptr,
memcpy_toio((void *)(rme96->iobase + RME96_IO_PLAY_BUFFER +
rme96->playback_ptr),
runtime->dma_area + rme96->playback_ptr,
RME96_BUFFER_SIZE - rme96->playback_ptr);
bytes -= RME96_BUFFER_SIZE - rme96->playback_ptr;
if (bytes > RME96_BUFFER_SIZE) {
bytes = RME96_BUFFER_SIZE;
}
memcpy_toio(rme96->iobase + RME96_IO_PLAY_BUFFER,
memcpy_toio((void *)(rme96->iobase + RME96_IO_PLAY_BUFFER),
runtime->dma_area,
bytes);
rme96->playback_ptr = bytes;
} else if (bytes != 0) {
memcpy_toio(rme96->iobase + RME96_IO_PLAY_BUFFER +
rme96->playback_ptr,
memcpy_toio((void *)(rme96->iobase + RME96_IO_PLAY_BUFFER +
rme96->playback_ptr),
runtime->dma_area + rme96->playback_ptr,
bytes);
rme96->playback_ptr += bytes;
......@@ -1560,17 +1560,17 @@ snd_rme96_capture_pointer(snd_pcm_substream_t *substream)
ptr = frameptr << rme96->capture_frlog;
if (ptr > rme96->capture_ptr) {
memcpy_fromio(runtime->dma_area + rme96->capture_ptr,
rme96->iobase + RME96_IO_REC_BUFFER +
rme96->capture_ptr,
(void *)(rme96->iobase + RME96_IO_REC_BUFFER +
rme96->capture_ptr),
ptr - rme96->capture_ptr);
rme96->capture_ptr += ptr - rme96->capture_ptr;
} else if (ptr < rme96->capture_ptr) {
memcpy_fromio(runtime->dma_area + rme96->capture_ptr,
rme96->iobase + RME96_IO_REC_BUFFER +
rme96->capture_ptr,
(void *)(rme96->iobase + RME96_IO_REC_BUFFER +
rme96->capture_ptr),
RME96_BUFFER_SIZE - rme96->capture_ptr);
memcpy_fromio(runtime->dma_area,
rme96->iobase + RME96_IO_REC_BUFFER,
(void *)(rme96->iobase + RME96_IO_REC_BUFFER),
ptr);
rme96->capture_ptr = ptr;
}
......
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