Skip to content
Snippets Groups Projects
Commit 06d4dd2f authored by Christoph Hellwig's avatar Christoph Hellwig
Browse files

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: default avatarChristoph Hellwig <hch@lst.de>
parent 518a2f19
No related branches found
No related tags found
No related merge requests found
...@@ -58,15 +58,6 @@ specify the ``GFP_`` flags (see kmalloc()) for the allocation (the ...@@ -58,15 +58,6 @@ specify the ``GFP_`` flags (see kmalloc()) for the allocation (the
implementation may choose to ignore flags that affect the location of implementation may choose to ignore flags that affect the location of
the returned memory, like GFP_DMA). 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 void
......
...@@ -644,12 +644,13 @@ static inline unsigned long dma_max_pfn(struct device *dev) ...@@ -644,12 +644,13 @@ static inline unsigned long dma_max_pfn(struct device *dev)
} }
#endif #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, static inline void *dma_zalloc_coherent(struct device *dev, size_t size,
dma_addr_t *dma_handle, gfp_t flag) dma_addr_t *dma_handle, gfp_t flag)
{ {
void *ret = dma_alloc_coherent(dev, size, dma_handle, return dma_alloc_coherent(dev, size, dma_handle, flag);
flag | __GFP_ZERO);
return ret;
} }
static inline int dma_get_cache_alignment(void) static inline int dma_get_cache_alignment(void)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment