Skip to contentSkip to conversation

dma-mapping: Undefine dma_map_single(), etc if CONFIG_HAVE_DMA_ATTRS is defined

PATCH In review [email protected] 2 participants 3 messages Jun 14, 2011 Generic include/asm header files

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dma-mapping: Undefine dma_map_single(), etc if CONFIG_HAVE_DMA_ATTRS is defined

From: KyongHo Cho <[email protected]>

If <asm/dma-mapping.h> includes <asm-generic/dma-mapping-common.h>, dma_map_single() become defined recursively when CONFIG_HAVE_DMA_ATTRS is not defined.
Since dma_map_*_attrs() are defined in <linux/dma-mapping.h>, those in <asm-generic/dma-mapping-common.h> must be not defined if CONFIG_HAVE_DMA_ATTRS is not defined.

CC FUJITA Tomonori <[email protected]>
CC Joerg Roedel <[email protected]>

CC Arnd Bergmann <[email protected]>

Change-Id: Ib99ee2b355dbe679263ce2e4e27d6219148c8338

---
 include/asm-generic/dma-mapping-common.h |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)
include/asm-generic/dma-mapping-common.h +8 -5
index 0c80bb3..b9a2040 100644
@@ -6,6 +6,7 @@
 #include <linux/dma-debug.h>
 #include <linux/dma-attrs.h>
 
+#ifdef CONFIG_HAVE_DMA_ATTRS
 static inline dma_addr_t dma_map_single_attrs(struct device *dev, void *ptr,
 					      size_t size,
 					      enum dma_data_direction dir,
@@ -67,6 +68,13 @@ static inline void dma_unmap_sg_attrs(struct device *dev, struct scatterlist *sg
 		ops->unmap_sg(dev, sg, nents, dir, attrs);
 }
 
+#define dma_map_single(d, a, s, r) dma_map_single_attrs(d, a, s, r, NULL)
+#define dma_unmap_single(d, a, s, r) dma_unmap_single_attrs(d, a, s, r, NULL)
+#define dma_map_sg(d, s, n, r) dma_map_sg_attrs(d, s, n, r, NULL)
+#define dma_unmap_sg(d, s, n, r) dma_unmap_sg_attrs(d, s, n, r, NULL)
+
+#endif /* CONFIG_HAVE_DMA_ATTRS */
+
 static inline dma_addr_t dma_map_page(struct device *dev, struct page *page,
 				      size_t offset, size_t size,
 				      enum dma_data_direction dir)
@@ -160,9 +168,4 @@ dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
 
 }
 
-#define dma_map_single(d, a, s, r) dma_map_single_attrs(d, a, s, r, NULL)
-#define dma_unmap_single(d, a, s, r) dma_unmap_single_attrs(d, a, s, r, NULL)
-#define dma_map_sg(d, s, n, r) dma_map_sg_attrs(d, s, n, r, NULL)
-#define dma_unmap_sg(d, s, n, r) dma_unmap_sg_attrs(d, s, n, r, NULL)
-
 #endif
Signature · 1 line
1.7.1
#1 lore raw
Quoted 10 lines · pullip.cho at samsung.com

From: KyongHo Cho <[email protected]>

If <asm/dma-mapping.h> includes <asm-generic/dma-mapping-common.h>, dma_map_single() become defined recursively when CONFIG_HAVE_DMA_ATTRS is not defined.
Since dma_map_*_attrs() are defined in <linux/dma-mapping.h>, those in <asm-generic/dma-mapping-common.h> must be not defined if CONFIG_HAVE_DMA_ATTRS is not defined.

Quoted 6 lines
CC FUJITA Tomonori <[email protected]>
CC Joerg Roedel <[email protected]>

CC Arnd Bergmann <[email protected]>

Change-Id: Ib99ee2b355dbe679263ce2e4e27d6219148c8338

Please don't use this here.

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.

#2 lore raw
Quoted 4 lines · Kukjin Kim
Quoted 1 line

Change-Id: Ib99ee2b355dbe679263ce2e4e27d6219148c8338

Please don't use this here.

I forgot to remove that.
Thank you.