dma-mapping: deprecate dma_zalloc_coherent
authorChristoph Hellwig <hch@lst.de>
Fri, 14 Dec 2018 08:15:02 +0000 (09:15 +0100)
committerChristoph Hellwig <hch@lst.de>
Thu, 20 Dec 2018 07:14:09 +0000 (08:14 +0100)
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>
Documentation/DMA-API.txt
include/linux/dma-mapping.h

index 016eb69..e133ccd 100644 (file)
@@ -60,15 +60,6 @@ the returned memory, like GFP_DMA).
 
 ::
 
-       void *
-       dma_zalloc_coherent(struct device *dev, size_t size,
-                           dma_addr_t *dma_handle, gfp_t flag)
-
-Wraps dma_alloc_coherent() and also zeroes the returned memory if the
-allocation attempt succeeded.
-
-::
-
        void
        dma_free_coherent(struct device *dev, size_t size, void *cpu_addr,
                          dma_addr_t dma_handle)
index f422aec..a52c640 100644 (file)
@@ -644,12 +644,13 @@ static inline unsigned long dma_max_pfn(struct device *dev)
 }
 #endif
 
+/*
+ * Please always use dma_alloc_coherent instead as it already zeroes the memory!
+ */
 static inline void *dma_zalloc_coherent(struct device *dev, size_t size,
                                        dma_addr_t *dma_handle, gfp_t flag)
 {
-       void *ret = dma_alloc_coherent(dev, size, dma_handle,
-                                      flag | __GFP_ZERO);
-       return ret;
+       return dma_alloc_coherent(dev, size, dma_handle, flag);
 }
 
 static inline int dma_get_cache_alignment(void)