Commit 06d4dd2f2ce1cdb625f77c0676d5af6ba310c01d
1 parent
518a2f1925
dma-mapping: deprecate dma_zalloc_coherent
We now always return zeroed memory from dma_alloc_coherent. Note that simply passing GFP_ZERO to dma_alloc_coherent wasn't always doing the right thing to start with given that various allocators are not backed by the page allocator and thus would ignore GFP_ZERO. Signed-off-by: Christoph Hellwig <hch@lst.de>
Showing 2 changed files with 4 additions and 12 deletions Side-by-side Diff
Documentation/DMA-API.txt
... | ... | @@ -60,15 +60,6 @@ |
60 | 60 | |
61 | 61 | :: |
62 | 62 | |
63 | - void * | |
64 | - dma_zalloc_coherent(struct device *dev, size_t size, | |
65 | - dma_addr_t *dma_handle, gfp_t flag) | |
66 | - | |
67 | -Wraps dma_alloc_coherent() and also zeroes the returned memory if the | |
68 | -allocation attempt succeeded. | |
69 | - | |
70 | -:: | |
71 | - | |
72 | 63 | void |
73 | 64 | dma_free_coherent(struct device *dev, size_t size, void *cpu_addr, |
74 | 65 | dma_addr_t dma_handle) |
include/linux/dma-mapping.h
... | ... | @@ -644,12 +644,13 @@ |
644 | 644 | } |
645 | 645 | #endif |
646 | 646 | |
647 | +/* | |
648 | + * Please always use dma_alloc_coherent instead as it already zeroes the memory! | |
649 | + */ | |
647 | 650 | static inline void *dma_zalloc_coherent(struct device *dev, size_t size, |
648 | 651 | dma_addr_t *dma_handle, gfp_t flag) |
649 | 652 | { |
650 | - void *ret = dma_alloc_coherent(dev, size, dma_handle, | |
651 | - flag | __GFP_ZERO); | |
652 | - return ret; | |
653 | + return dma_alloc_coherent(dev, size, dma_handle, flag); | |
653 | 654 | } |
654 | 655 | |
655 | 656 | static inline int dma_get_cache_alignment(void) |