Update of /cvsroot/alsa/alsa-kernel/core
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24919

Modified Files:
        memalloc.c 
Log Message:
fixed the allocation of coherent DMA pages under 32bit mask.



Index: memalloc.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/core/memalloc.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- memalloc.c  7 Apr 2004 17:48:11 -0000       1.29
+++ memalloc.c  14 Apr 2004 09:44:16 -0000      1.30
@@ -137,14 +137,17 @@
                                         dma_addr_t *dma_handle, int flags)
 {
        void *ret;
-       u64 dma_mask;
+       u64 dma_mask, coherent_dma_mask;
 
        if (dev == NULL || !dev->dma_mask)
                return dma_alloc_coherent(dev, size, dma_handle, flags);
        dma_mask = *dev->dma_mask;
+       coherent_dma_mask = dev->coherent_dma_mask;
        *dev->dma_mask = 0xffffffff;    /* do without masking */
+       dev->coherent_dma_mask = 0xffffffff;    /* do without masking */
        ret = dma_alloc_coherent(dev, size, dma_handle, flags);
        *dev->dma_mask = dma_mask;      /* restore */
+       dev->coherent_dma_mask = coherent_dma_mask;     /* restore */
        if (ret) {
                /* obtained address is out of range? */
                if (((unsigned long)*dma_handle + size - 1) & ~dma_mask) {
@@ -154,8 +157,12 @@
                }
        } else {
                /* wish to success now with the proper mask... */
-               if (dma_mask != 0xffffffffUL)
+               if (dma_mask != 0xffffffffUL) {
+                       /* allocation with GFP_ATOMIC to avoid the long stall */
+                       flags &= ~GFP_KERNEL;
+                       flags |= GFP_ATOMIC;
                        ret = dma_alloc_coherent(dev, size, dma_handle, flags);
+               }
        }
        return ret;
 }



-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
Alsa-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-cvslog

Reply via email to