Simplify the use of dma_inv_range() by changing its signature to accept pointer to start of the data and data size. This change allows us to avoid a whole bunch of repetitive arithmetic currently done by all of the callers.
Signed-off-by: Andrey Smirnov <andrew.smir...@gmail.com> --- arch/arm/cpu/mmu.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/arch/arm/cpu/mmu.c b/arch/arm/cpu/mmu.c index 2b7b9e30a..390ccc581 100644 --- a/arch/arm/cpu/mmu.c +++ b/arch/arm/cpu/mmu.c @@ -118,8 +118,11 @@ static void dma_flush_range(void *ptr, size_t size) outer_cache.flush_range(start, end); } -static void dma_inv_range(unsigned long start, unsigned long end) +static void dma_inv_range(void *ptr, size_t size) { + unsigned long start = (unsigned long)ptr; + unsigned long end = start + size; + if (outer_cache.inv_range) outer_cache.inv_range(start, end); __dma_inv_range(start, end); @@ -507,7 +510,7 @@ static void *dma_alloc_map(size_t size, dma_addr_t *dma_handle, unsigned flags) if (dma_handle) *dma_handle = (dma_addr_t)ret; - dma_inv_range((unsigned long)ret, (unsigned long)ret + size); + dma_inv_range(ret, size); arch_remap_range(ret, size, flags); @@ -536,7 +539,7 @@ void dma_sync_single_for_cpu(dma_addr_t address, size_t size, enum dma_data_direction dir) { if (dir != DMA_TO_DEVICE) - dma_inv_range(address, address + size); + dma_inv_range((void *)address, size); } void dma_sync_single_for_device(dma_addr_t address, size_t size, -- 2.20.1 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox