Blackfin: dma-mapping: fix thinko in constant optimization
authorSonic Zhang <sonic.zhang@analog.com>
Wed, 16 Dec 2009 07:52:52 +0000 (07:52 +0000)
committerMike Frysinger <vapier@gentoo.org>
Tue, 9 Mar 2010 05:30:46 +0000 (00:30 -0500)
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>
arch/blackfin/include/asm/dma-mapping.h
arch/blackfin/kernel/dma-mapping.c

index f9172ff30e5c1e327574bd92d36eb6592c554ffc..e63f6d9fdab88de6d2c6cac1777f25cd37b5eeb0 100644 (file)
@@ -44,13 +44,8 @@ dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
 extern void
 __dma_sync(dma_addr_t addr, size_t size, enum dma_data_direction dir);
 static inline void
-_dma_sync(dma_addr_t addr, size_t size, enum dma_data_direction dir)
+__dma_sync_inline(dma_addr_t addr, size_t size, enum dma_data_direction dir)
 {
-       if (!__builtin_constant_p(dir)) {
-               __dma_sync(addr, size, dir);
-               return;
-       }
-
        switch (dir) {
        case DMA_NONE:
                BUG();
@@ -64,6 +59,14 @@ _dma_sync(dma_addr_t addr, size_t size, enum dma_data_direction dir)
                break;
        }
 }
+static inline void
+_dma_sync(dma_addr_t addr, size_t size, enum dma_data_direction dir)
+{
+       if (__builtin_constant_p(dir))
+               __dma_sync_inline(addr, size, dir);
+       else
+               __dma_sync(addr, size, dir);
+}
 
 /*
  * Map a single buffer of the indicated size for DMA in streaming mode.
index e937f323d82c6f61dd4dc4309eabcb413fc99f76..04ddcfeb798140a3ffb465157948395577874ebd 100644 (file)
@@ -116,7 +116,7 @@ EXPORT_SYMBOL(dma_free_coherent);
 void __dma_sync(dma_addr_t addr, size_t size,
                enum dma_data_direction dir)
 {
-       _dma_sync(addr, size, dir);
+       __dma_sync_inline(addr, size, dir);
 }
 EXPORT_SYMBOL(__dma_sync);