aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/dma-mapping.h
diff options
context:
space:
mode:
authorAndrew Morton <akpm@linux-foundation.org>2011-11-02 16:39:33 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-11-02 19:07:02 -0400
commit842fa69f3e0c9a178b294e7af7c07f4c9d9e7af2 (patch)
tree5c7b18074454b5ffa8e11175cfe7de08e6549ca7 /include/linux/dma-mapping.h
parentc736de60aed869df8a9aba512cdaf89e32545b00 (diff)
include/linux/dma-mapping.h: add dma_zalloc_coherent()
Lots of driver code does a dma_alloc_coherent() and then zeroes out the memory with a memset. Make it easy for them. Cc: Alexandre Bounine <alexandre.bounine@idt.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/dma-mapping.h')
-rw-r--r--include/linux/dma-mapping.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index 347fdc32177a..be86ae13893f 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -1,6 +1,7 @@
1#ifndef _LINUX_DMA_MAPPING_H 1#ifndef _LINUX_DMA_MAPPING_H
2#define _LINUX_DMA_MAPPING_H 2#define _LINUX_DMA_MAPPING_H
3 3
4#include <linux/string.h>
4#include <linux/device.h> 5#include <linux/device.h>
5#include <linux/err.h> 6#include <linux/err.h>
6#include <linux/dma-attrs.h> 7#include <linux/dma-attrs.h>
@@ -117,6 +118,15 @@ static inline int dma_set_seg_boundary(struct device *dev, unsigned long mask)
117 return -EIO; 118 return -EIO;
118} 119}
119 120
121static inline void *dma_zalloc_coherent(struct device *dev, size_t size,
122 dma_addr_t *dma_handle, gfp_t flag)
123{
124 void *ret = dma_alloc_coherent(dev, size, dma_handle, flag);
125 if (ret)
126 memset(ret, 0, size);
127 return ret;
128}
129
120#ifdef CONFIG_HAS_DMA 130#ifdef CONFIG_HAS_DMA
121static inline int dma_get_cache_alignment(void) 131static inline int dma_get_cache_alignment(void)
122{ 132{