X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sound%2Fdrivers%2Fopl4%2Fopl4_proc.c;h=6a1486258acfa23c96af240d9fb411c3c3f0c18d;hb=c7b5ebbddf7bcd3651947760f423e3783bbe6573;hp=2b346d6001384d5a5c2de5cc8aa74d449e269df1;hpb=5273a3df6485dc2ad6aa7ddd441b9a21970f003b;p=linux-2.6.git diff --git a/sound/drivers/opl4/opl4_proc.c b/sound/drivers/opl4/opl4_proc.c index 2b346d600..6a1486258 100644 --- a/sound/drivers/opl4/opl4_proc.c +++ b/sound/drivers/opl4/opl4_proc.c @@ -26,7 +26,7 @@ static int snd_opl4_mem_proc_open(snd_info_entry_t *entry, unsigned short mode, void **file_private_data) { - opl4_t *opl4 = snd_magic_cast(opl4_t, entry->private_data, return -ENXIO); + opl4_t *opl4 = entry->private_data; down(&opl4->access_mutex); if (opl4->memory_access) { @@ -41,7 +41,7 @@ static int snd_opl4_mem_proc_open(snd_info_entry_t *entry, static int snd_opl4_mem_proc_release(snd_info_entry_t *entry, unsigned short mode, void *file_private_data) { - opl4_t *opl4 = snd_magic_cast(opl4_t, entry->private_data, return -ENXIO); + opl4_t *opl4 = entry->private_data; down(&opl4->access_mutex); opl4->memory_access--; @@ -50,41 +50,42 @@ static int snd_opl4_mem_proc_release(snd_info_entry_t *entry, } static long snd_opl4_mem_proc_read(snd_info_entry_t *entry, void *file_private_data, - struct file *file, char *_buf, long count) + struct file *file, char __user *_buf, + unsigned long count, unsigned long pos) { - opl4_t *opl4 = snd_magic_cast(opl4_t, entry->private_data, return -ENXIO); + opl4_t *opl4 = entry->private_data; long size; char* buf; size = count; - if (file->f_pos + size > entry->size) - size = entry->size - file->f_pos; + if (pos + size > entry->size) + size = entry->size - pos; if (size > 0) { buf = vmalloc(size); if (!buf) return -ENOMEM; - snd_opl4_read_memory(opl4, buf, file->f_pos, size); + snd_opl4_read_memory(opl4, buf, pos, size); if (copy_to_user(_buf, buf, size)) { vfree(buf); return -EFAULT; } vfree(buf); - file->f_pos += size; return size; } return 0; } static long snd_opl4_mem_proc_write(snd_info_entry_t *entry, void *file_private_data, - struct file *file, const char *_buf, long count) + struct file *file, const char __user *_buf, + unsigned long count, unsigned long pos) { - opl4_t *opl4 = snd_magic_cast(opl4_t, entry->private_data, return -ENXIO); + opl4_t *opl4 = entry->private_data; long size; char *buf; size = count; - if (file->f_pos + size > entry->size) - size = entry->size - file->f_pos; + if (pos + size > entry->size) + size = entry->size - pos; if (size > 0) { buf = vmalloc(size); if (!buf) @@ -93,9 +94,8 @@ static long snd_opl4_mem_proc_write(snd_info_entry_t *entry, void *file_private_ vfree(buf); return -EFAULT; } - snd_opl4_write_memory(opl4, buf, file->f_pos, size); + snd_opl4_write_memory(opl4, buf, pos, size); vfree(buf); - file->f_pos += size; return size; } return 0;