[PATCH master 02/23] dma: give inline dma_alloc a single external definition

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We'll be adding more calls to dma_alloc shortly, so move it
out-of-line.

Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx>
---
 drivers/dma/map.c | 5 +++++
 include/dma.h     | 6 +++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/dma/map.c b/drivers/dma/map.c
index ab86a8c7b139..ed7d3b68ffb1 100644
--- a/drivers/dma/map.c
+++ b/drivers/dma/map.c
@@ -2,6 +2,11 @@
 #include <dma.h>
 #include "debug.h"
 
+void *dma_alloc(size_t size)
+{
+	return xmemalign(DMA_ALIGNMENT, ALIGN(size, DMA_ALIGNMENT));
+}
+
 void dma_sync_single_for_cpu(struct device *dev, dma_addr_t address,
 			     size_t size, enum dma_data_direction dir)
 {
diff --git a/include/dma.h b/include/dma.h
index df9807b4f2e4..0b77949eaf05 100644
--- a/include/dma.h
+++ b/include/dma.h
@@ -21,10 +21,14 @@
 #define DMA_ALIGNMENT	32
 #endif
 
+#ifdef CONFIG_HAS_DMA
+void *dma_alloc(size_t size);
+#else
 static inline void *dma_alloc(size_t size)
 {
-	return xmemalign(DMA_ALIGNMENT, ALIGN(size, DMA_ALIGNMENT));
+	return malloc(size);
 }
+#endif
 
 static inline void dma_free(void *mem)
 {
-- 
2.39.2





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux