From e0c6584df9c414b50de17e1abc1099f7501bbb60 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Sun, 27 Aug 2017 10:35:40 +0200 Subject: sh: make dma_cache_sync a no-op sh does not implement DMA_ATTR_NON_CONSISTENT allocations, so it doesn't make any sense to do any work in dma_cache_sync given that it must be a no-op when dma_alloc_attrs returns coherent memory. On the other hand sh uses dma_cache_sync internally in the dma_ops implementation and for the maple bus that does not use the DMA API, so a the old functionality for dma_cache_sync is still provided under the name sh_sync_dma_for_device, and without the redundant dev argument. While at it two of the syncing dma_ops also go the proper _for_device postfix. Signed-off-by: Christoph Hellwig Reviewed-by: Robin Murphy --- arch/sh/kernel/dma-nommu.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'arch/sh/kernel') diff --git a/arch/sh/kernel/dma-nommu.c b/arch/sh/kernel/dma-nommu.c index d24c707b2181..62b485107eae 100644 --- a/arch/sh/kernel/dma-nommu.c +++ b/arch/sh/kernel/dma-nommu.c @@ -9,6 +9,7 @@ */ #include #include +#include static dma_addr_t nommu_map_page(struct device *dev, struct page *page, unsigned long offset, size_t size, @@ -20,7 +21,7 @@ static dma_addr_t nommu_map_page(struct device *dev, struct page *page, WARN_ON(size == 0); if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC)) - dma_cache_sync(dev, page_address(page) + offset, size, dir); + sh_sync_dma_for_device(page_address(page) + offset, size, dir); return addr; } @@ -38,7 +39,7 @@ static int nommu_map_sg(struct device *dev, struct scatterlist *sg, BUG_ON(!sg_page(s)); if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC)) - dma_cache_sync(dev, sg_virt(s), s->length, dir); + sh_sync_dma_for_device(sg_virt(s), s->length, dir); s->dma_address = sg_phys(s); s->dma_length = s->length; @@ -48,20 +49,20 @@ static int nommu_map_sg(struct device *dev, struct scatterlist *sg, } #ifdef CONFIG_DMA_NONCOHERENT -static void nommu_sync_single(struct device *dev, dma_addr_t addr, +static void nommu_sync_single_for_device(struct device *dev, dma_addr_t addr, size_t size, enum dma_data_direction dir) { - dma_cache_sync(dev, phys_to_virt(addr), size, dir); + sh_sync_dma_for_device(phys_to_virt(addr), size, dir); } -static void nommu_sync_sg(struct device *dev, struct scatterlist *sg, +static void nommu_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nelems, enum dma_data_direction dir) { struct scatterlist *s; int i; for_each_sg(sg, s, nelems, i) - dma_cache_sync(dev, sg_virt(s), s->length, dir); + sh_sync_dma_for_device(sg_virt(s), s->length, dir); } #endif @@ -71,8 +72,8 @@ const struct dma_map_ops nommu_dma_ops = { .map_page = nommu_map_page, .map_sg = nommu_map_sg, #ifdef CONFIG_DMA_NONCOHERENT - .sync_single_for_device = nommu_sync_single, - .sync_sg_for_device = nommu_sync_sg, + .sync_single_for_device = nommu_sync_single_for_device, + .sync_sg_for_device = nommu_sync_sg_for_device, #endif .is_phys = 1, }; -- cgit v1.2.3