Hi again,

I realized the CVS driver after Jul 31 (sg buffer implementation) was
already broken when using a fragment size smaller than PAGE_SIZE. The 
attached patch fixes this. I now have CVS driver from 8/27/2002 working 
(last commit before the merge), but mainline of today is still broken.

Rui Sousa
Index: alsa-kernel/pci/via82xx.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/pci/via82xx.c,v
retrieving revision 1.1
diff -u -r1.1 via82xx.c
--- alsa-kernel/pci/via82xx.c   4 Sep 2002 14:17:47 -0000       1.1
+++ alsa-kernel/pci/via82xx.c   8 Sep 2002 17:38:04 -0000
@@ -231,7 +231,7 @@
 
        if (dev->tbl_size < PAGE_SIZE) {
                for (i = 0; i < dev->tbl_entries; i++)
-                       dev->table[i << 1] = cpu_to_le32((u32)sgbuf->table[0].addr + 
dev->fragsize * i);
+                       dev->table[i << 1] = 
+cpu_to_le32((u32)sgbuf->table[(dev->fragsize * i) >> PAGE_SHIFT].addr + 
+(dev->fragsize * i) % PAGE_SIZE);
        } else {
                for (i = 0; i < dev->tbl_entries; i++)
                        dev->table[i << 1] = cpu_to_le32((u32)sgbuf->table[i].addr);
@@ -241,7 +241,7 @@
                dev->table[(i << 1) + 1] = cpu_to_le32(VIA_TBL_BIT_FLAG | 
dev->tbl_size);
                size -= dev->tbl_size;
        }
-       dev->table[(dev->tbl_entries << 1) - 1] = cpu_to_le32(VIA_TBL_BIT_EOL | size);
+       dev->table[((dev->tbl_entries - 1) << 1) + 1] = cpu_to_le32(VIA_TBL_BIT_EOL | 
+size);
 
        return 0;
 }

Reply via email to