dma-mapping.h: preserve unmap info for CONFIG_DMA_API_DEBUG
authorAndrey Smirnov <[email protected]>
Wed, 28 Sep 2016 22:22:33 +0000 (15:22 -0700)
committerLinus Torvalds <[email protected]>
Wed, 28 Sep 2016 23:19:01 +0000 (16:19 -0700)
When CONFIG_DMA_API_DEBUG is enabled we need to preserve unmapping address
even if "unmap" is a no-op for our architecutre because we need
debug_dma_unmap_page() to correctly cleanup all of the debug bookkeeping.
Failing to do so results in a false positive warnings about previously
mapped areas never being unmapped.

Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Andrey Smirnov <[email protected]>
Reviewed-by: Robin Murphy <[email protected]>
Cc: Joerg Roedel <[email protected]>
Cc: Will Deacon <[email protected]>
Cc: Zhen Lei <[email protected]>
Cc: "Luis R. Rodriguez" <[email protected]>
Cc: Christian Borntraeger <[email protected]>
Cc: Geliang Tang <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
include/linux/dma-mapping.h

index 66533e18276cf00e86de1fa8f9251c30f921fcf7..dc69df04abc1d449fdc0948a00dd320ebe882327 100644 (file)
@@ -718,7 +718,7 @@ static inline int dma_mmap_wc(struct device *dev,
 #define dma_mmap_writecombine dma_mmap_wc
 #endif
 
-#ifdef CONFIG_NEED_DMA_MAP_STATE
+#if defined(CONFIG_NEED_DMA_MAP_STATE) || defined(CONFIG_DMA_API_DEBUG)
 #define DEFINE_DMA_UNMAP_ADDR(ADDR_NAME)        dma_addr_t ADDR_NAME
 #define DEFINE_DMA_UNMAP_LEN(LEN_NAME)          __u32 LEN_NAME
 #define dma_unmap_addr(PTR, ADDR_NAME)           ((PTR)->ADDR_NAME)