ARM: dma-mapping: remove offset parameter to prepare for generic dma_ops
authorMarek Szyprowski <m.szyprowski@samsung.com>
Fri, 10 Feb 2012 18:55:20 +0000 (19:55 +0100)
committerGrazvydas Ignotas <notasas@gmail.com>
Tue, 26 Feb 2013 17:51:06 +0000 (19:51 +0200)
commit4d3550e39c4f685ca83b0c5724be4e44c5eedbc1
treeb9e56cb3325d0df0ae3cb2258945d5bcd4dad0ab
parent95505e85c18d36340f8da05a00d3b98853a77749
ARM: dma-mapping: remove offset parameter to prepare for generic dma_ops

This patch removes the need for the offset parameter in dma bounce
functions. This is required to let dma-mapping framework on ARM
architecture to use common, generic dma_map_ops based dma-mapping
helpers.

Background and more detailed explaination:

dma_*_range_* functions are available from the early days of the dma
mapping api. They are the correct way of doing a partial syncs on the
buffer (usually used by the network device drivers). This patch changes
only the internal implementation of the dma bounce functions to let
them tunnel through dma_map_ops structure. The driver api stays
unchanged, so driver are obliged to call dma_*_range_* functions to
keep code clean and easy to understand.

The only drawback from this patch is reduced detection of the dma api
abuse. Let us consider the following code:

dma_addr = dma_map_single(dev, ptr, 64, DMA_TO_DEVICE);
dma_sync_single_range_for_cpu(dev, dma_addr+16, 0, 32, DMA_TO_DEVICE);

Without the patch such code fails, because dma bounce code is unable
to find the bounce buffer for the given dma_address. After the patch
the above sync call will be equivalent to:

dma_sync_single_range_for_cpu(dev, dma_addr, 16, 32, DMA_TO_DEVICE);

which succeeds.

I don't consider this as a real problem, because DMA API abuse should be
caught by debug_dma_* function family. This patch lets us to simplify
the internal low-level implementation without chaning the driver visible
API.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
Tested-By: Subash Patel <subash.ramaswamy@linaro.org>
arch/arm/common/dmabounce.c
arch/arm/include/asm/dma-mapping.h
arch/arm/mm/dma-mapping.c