X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sound%2Fpci%2Femu10k1%2Femuproc.c;h=9582c3179d75ace7e81bfe0d6624bb33a6c48e53;hb=9bf4aaab3e101692164d49b7ca357651eb691cb6;hp=39f5307e2183f4eec5748b88af982dea5bc7bed9;hpb=db216c3d5e4c040e557a50f8f5d35d5c415e8c1c;p=linux-2.6.git diff --git a/sound/pci/emu10k1/emuproc.c b/sound/pci/emu10k1/emuproc.c index 39f5307e2..9582c3179 100644 --- a/sound/pci/emu10k1/emuproc.c +++ b/sound/pci/emu10k1/emuproc.c @@ -191,7 +191,8 @@ static void snd_emu10k1_proc_acode_read(snd_info_entry_t *entry, #define TOTAL_SIZE_CODE (0x200*8) static long snd_emu10k1_fx8010_read(snd_info_entry_t *entry, void *file_private_data, - struct file *file, char __user *buf, long count) + struct file *file, char __user *buf, + unsigned long count, unsigned long pos) { long size; emu10k1_t *emu = snd_magic_cast(emu10k1_t, entry->private_data, return -ENXIO); @@ -209,21 +210,20 @@ static long snd_emu10k1_fx8010_read(snd_info_entry_t *entry, void *file_private_ offset = emu->audigy ? A_FXGPREGBASE : FXGPREGBASE; } size = count; - if (file->f_pos + size > entry->size) - size = (long)entry->size - file->f_pos; + if (pos + size > entry->size) + size = (long)entry->size - pos; if (size > 0) { unsigned int *tmp; long res; unsigned int idx; if ((tmp = kmalloc(size + 8, GFP_KERNEL)) == NULL) return -ENOMEM; - for (idx = 0; idx < ((file->f_pos & 3) + size + 3) >> 2; idx++) - tmp[idx] = snd_emu10k1_ptr_read(emu, offset + idx + (file->f_pos >> 2), 0); - if (copy_to_user(buf, ((char *)tmp) + (file->f_pos & 3), size)) + for (idx = 0; idx < ((pos & 3) + size + 3) >> 2; idx++) + tmp[idx] = snd_emu10k1_ptr_read(emu, offset + idx + (pos >> 2), 0); + if (copy_to_user(buf, ((char *)tmp) + (pos & 3), size)) res = -EFAULT; else { res = size; - file->f_pos += size; } kfree(tmp); return res;