diff options
author | Christoph Hellwig <hch@lst.de> | 2017-05-22 10:58:49 +0200 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2017-06-28 06:54:37 -0700 |
commit | f51f288e237cbcfd3dbd1d4fa2d3dec00d7253e2 (patch) | |
tree | 952177b59b16ae4b935105c825f7831bb57254ec /Documentation/DMA-API-HOWTO.txt | |
parent | 9eef8b8cc26559fe5f2575daf7d08c6a17e81ff8 (diff) | |
download | linux-stable-f51f288e237cbcfd3dbd1d4fa2d3dec00d7253e2.tar.gz linux-stable-f51f288e237cbcfd3dbd1d4fa2d3dec00d7253e2.tar.bz2 linux-stable-f51f288e237cbcfd3dbd1d4fa2d3dec00d7253e2.zip |
dma-mapping: remove DMA_ERROR_CODE
And update the documentation - dma_mapping_error has been supported
everywhere for a long time.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'Documentation/DMA-API-HOWTO.txt')
-rw-r--r-- | Documentation/DMA-API-HOWTO.txt | 31 |
1 files changed, 5 insertions, 26 deletions
diff --git a/Documentation/DMA-API-HOWTO.txt b/Documentation/DMA-API-HOWTO.txt index 979228bc9035..4ed388356898 100644 --- a/Documentation/DMA-API-HOWTO.txt +++ b/Documentation/DMA-API-HOWTO.txt @@ -550,32 +550,11 @@ and to unmap it: dma_unmap_single(dev, dma_handle, size, direction); You should call dma_mapping_error() as dma_map_single() could fail and return -error. Not all DMA implementations support the dma_mapping_error() interface. -However, it is a good practice to call dma_mapping_error() interface, which -will invoke the generic mapping error check interface. Doing so will ensure -that the mapping code will work correctly on all DMA implementations without -any dependency on the specifics of the underlying implementation. Using the -returned address without checking for errors could result in failures ranging -from panics to silent data corruption. A couple of examples of incorrect ways -to check for errors that make assumptions about the underlying DMA -implementation are as follows and these are applicable to dma_map_page() as -well. - -Incorrect example 1: - dma_addr_t dma_handle; - - dma_handle = dma_map_single(dev, addr, size, direction); - if ((dma_handle & 0xffff != 0) || (dma_handle >= 0x1000000)) { - goto map_error; - } - -Incorrect example 2: - dma_addr_t dma_handle; - - dma_handle = dma_map_single(dev, addr, size, direction); - if (dma_handle == DMA_ERROR_CODE) { - goto map_error; - } +error. Doing so will ensure that the mapping code will work correctly on all +DMA implementations without any dependency on the specifics of the underlying +implementation. Using the returned address without checking for errors could +result in failures ranging from panics to silent data corruption. The same +applies to dma_map_page() as well. You should call dma_unmap_single() when the DMA activity is finished, e.g., from the interrupt which told you that the DMA transfer is done. |