aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2018-12-14 03:15:02 -0500
committerChristoph Hellwig <hch@lst.de>2018-12-20 02:14:09 -0500
commit06d4dd2f2ce1cdb625f77c0676d5af6ba310c01d (patch)
tree4ab5304877a59cda6d57944619e7567af45ae2b6 /include/linux
parent518a2f1925c3165befbf06b75e07636549d92c1c (diff)
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>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/dma-mapping.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index f422aec0f53c..a52c6409bdc2 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -644,12 +644,13 @@ static inline unsigned long dma_max_pfn(struct device *dev)
644} 644}
645#endif 645#endif
646 646
647/*
648 * Please always use dma_alloc_coherent instead as it already zeroes the memory!
649 */
647static inline void *dma_zalloc_coherent(struct device *dev, size_t size, 650static inline void *dma_zalloc_coherent(struct device *dev, size_t size,
648 dma_addr_t *dma_handle, gfp_t flag) 651 dma_addr_t *dma_handle, gfp_t flag)
649{ 652{
650 void *ret = dma_alloc_coherent(dev, size, dma_handle, 653 return dma_alloc_coherent(dev, size, dma_handle, flag);
651 flag | __GFP_ZERO);
652 return ret;
653} 654}
654 655
655static inline int dma_get_cache_alignment(void) 656static inline int dma_get_cache_alignment(void)