Synchronize dma_map_page/dma_unmap_page and dma_map_single/dma_unmap_single. This will reduce unnecessary writeback/invalidate. Signed-off-by: Atsushi Nemoto <anemo@xxxxxxxxxxxxx> --- This patch depends on a patch titled "fix oops in dma_unmap_page on not coherent mips platforms". by Jan Nikitenko. http://www.linux-mips.org/cgi-bin/mesg.cgi?a=linux-mips&i=20081128075258.GA10200%40nikitenko.systek.local arch/mips/mm/dma-default.c | 13 ++----------- 1 files changed, 2 insertions(+), 11 deletions(-) diff --git a/arch/mips/mm/dma-default.c b/arch/mips/mm/dma-default.c index bed56f1..96b0061 100644 --- a/arch/mips/mm/dma-default.c +++ b/arch/mips/mm/dma-default.c @@ -209,7 +209,7 @@ dma_addr_t dma_map_page(struct device *dev, struct page *page, unsigned long addr; addr = (unsigned long) page_address(page) + offset; - dma_cache_wback_inv(addr, size); + __dma_sync(addr, size, direction); } return plat_map_dma_mem_page(dev, page) + offset; @@ -220,16 +220,7 @@ EXPORT_SYMBOL(dma_map_page); void dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size, enum dma_data_direction direction) { - BUG_ON(direction == DMA_NONE); - - if (!plat_device_is_coherent(dev) && direction != DMA_TO_DEVICE) { - unsigned long addr; - - addr = dma_addr_to_virt(dma_address); - dma_cache_wback_inv(addr, size); - } - - plat_unmap_dma_mem(dev, dma_address); + dma_unmap_single(dev, dma_address, size, direction); } EXPORT_SYMBOL(dma_unmap_page); -- 1.5.6.3