aboutsummaryrefslogtreecommitdiffstats
path: root/arch/blackfin/include/asm/dma-mapping.h
diff options
context:
space:
mode:
authorSonic Zhang <sonic.zhang@analog.com>2009-12-16 02:52:52 -0500
committerMike Frysinger <vapier@gentoo.org>2010-03-09 00:30:46 -0500
commita3a6a590190ca77aedf9de871d941c1139a5a24c (patch)
tree3fbc9066b9e1ce9de3b4f73b81467ec2f48d3262 /arch/blackfin/include/asm/dma-mapping.h
parent0c270807db7c6478d60ab2bc23511fd5868a7a80 (diff)
Blackfin: dma-mapping: fix thinko in constant optimization
Make sure the non-constant version of the dma_sync functions actually complete instead of recursively calling itself forever. Signed-off-by: Sonic Zhang <sonic.zhang@analog.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'arch/blackfin/include/asm/dma-mapping.h')
-rw-r--r--arch/blackfin/include/asm/dma-mapping.h15
1 files changed, 9 insertions, 6 deletions
diff --git a/arch/blackfin/include/asm/dma-mapping.h b/arch/blackfin/include/asm/dma-mapping.h
index f9172ff30e5c..e63f6d9fdab8 100644
--- a/arch/blackfin/include/asm/dma-mapping.h
+++ b/arch/blackfin/include/asm/dma-mapping.h
@@ -44,13 +44,8 @@ dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
44extern void 44extern void
45__dma_sync(dma_addr_t addr, size_t size, enum dma_data_direction dir); 45__dma_sync(dma_addr_t addr, size_t size, enum dma_data_direction dir);
46static inline void 46static inline void
47_dma_sync(dma_addr_t addr, size_t size, enum dma_data_direction dir) 47__dma_sync_inline(dma_addr_t addr, size_t size, enum dma_data_direction dir)
48{ 48{
49 if (!__builtin_constant_p(dir)) {
50 __dma_sync(addr, size, dir);
51 return;
52 }
53
54 switch (dir) { 49 switch (dir) {
55 case DMA_NONE: 50 case DMA_NONE:
56 BUG(); 51 BUG();
@@ -64,6 +59,14 @@ _dma_sync(dma_addr_t addr, size_t size, enum dma_data_direction dir)
64 break; 59 break;
65 } 60 }
66} 61}
62static inline void
63_dma_sync(dma_addr_t addr, size_t size, enum dma_data_direction dir)
64{
65 if (__builtin_constant_p(dir))
66 __dma_sync_inline(addr, size, dir);
67 else
68 __dma_sync(addr, size, dir);
69}
67 70
68/* 71/*
69 * Map a single buffer of the indicated size for DMA in streaming mode. 72 * Map a single buffer of the indicated size for DMA in streaming mode.