linux-cvs-patches
[Top] [All Lists]

CVS Update@linux-mips.org: linux

To: linux-cvs-patches@linux-mips.org
Subject: CVS Update@linux-mips.org: linux
From: ths@linux-mips.org
Date: Fri, 09 Sep 2005 18:09:25 +0100
Reply-to: linux-mips@linux-mips.org
Sender: linux-cvs-patches-bounce@linux-mips.org
CVSROOT:        /home/cvs
Module name:    linux
Changes by:     ths@ftp.linux-mips.org  05/09/09 18:09:18

Modified files:
        arch/mips/mm   : dma-noncoherent.c 

Log message:
        Don't set up a sg dma address if we have no page address for some 
reason.
        Code cleanup.

diff -urN linux/arch/mips/mm/dma-noncoherent.c 
linux/arch/mips/mm/dma-noncoherent.c
--- linux/arch/mips/mm/dma-noncoherent.c        2005/07/11 10:03:28     1.13
+++ linux/arch/mips/mm/dma-noncoherent.c        2005/09/09 17:09:18     1.14
@@ -105,22 +105,7 @@
 {
        unsigned long addr = (unsigned long) ptr;
 
-       switch (direction) {
-       case DMA_TO_DEVICE:
-               dma_cache_wback(addr, size);
-               break;
-
-       case DMA_FROM_DEVICE:
-               dma_cache_inv(addr, size);
-               break;
-
-       case DMA_BIDIRECTIONAL:
-               dma_cache_wback_inv(addr, size);
-               break;
-
-       default:
-               BUG();
-       }
+       __dma_sync(addr, size, direction);
 
        return virt_to_phys(ptr);
 }
@@ -133,22 +118,7 @@
        unsigned long addr;
        addr = dma_addr + PAGE_OFFSET;
 
-       switch (direction) {
-       case DMA_TO_DEVICE:
-               //dma_cache_wback(addr, size);
-               break;
-
-       case DMA_FROM_DEVICE:
-               //dma_cache_inv(addr, size);
-               break;
-
-       case DMA_BIDIRECTIONAL:
-               //dma_cache_wback_inv(addr, size);
-               break;
-
-       default:
-               BUG();
-       }
+       //__dma_sync(addr, size, direction);
 }
 
 EXPORT_SYMBOL(dma_unmap_single);
@@ -164,10 +134,11 @@
                unsigned long addr;
 
                addr = (unsigned long) page_address(sg->page);
-               if (addr)
+               if (addr) {
                        __dma_sync(addr + sg->offset, sg->length, direction);
-               sg->dma_address = (dma_addr_t)
-                       (page_to_phys(sg->page) + sg->offset);
+                       sg->dma_address = (dma_addr_t)page_to_phys(sg->page)
+                                         + sg->offset;
+               }
        }
 
        return nents;
@@ -218,9 +189,8 @@
 
        for (i = 0; i < nhwentries; i++, sg++) {
                addr = (unsigned long) page_address(sg->page);
-               if (!addr)
-                       continue;
-               dma_cache_wback_inv(addr + sg->offset, sg->length);
+               if (addr)
+                       __dma_sync(addr + sg->offset, sg->length, direction);
        }
 }
 

<Prev in Thread] Current Thread [Next in Thread>