VServer 1.9.2 (patch-2.6.8.1-vs1.9.2.diff)
[linux-2.6.git] / sound / pci / emu10k1 / emuproc.c
index 39f5307..9582c31 100644 (file)
@@ -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;