Commit a3a6a590 authored by Sonic Zhang's avatar Sonic Zhang Committed by Mike Frysinger

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: default avatarSonic Zhang <sonic.zhang@analog.com>
Signed-off-by: default avatarMike Frysinger <vapier@gentoo.org>
parent 0c270807
...@@ -44,13 +44,8 @@ dma_mapping_error(struct device *dev, dma_addr_t dma_addr) ...@@ -44,13 +44,8 @@ dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
extern void extern void
__dma_sync(dma_addr_t addr, size_t size, enum dma_data_direction dir); __dma_sync(dma_addr_t addr, size_t size, enum dma_data_direction dir);
static inline void 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) { switch (dir) {
case DMA_NONE: case DMA_NONE:
BUG(); BUG();
...@@ -64,6 +59,14 @@ _dma_sync(dma_addr_t addr, size_t size, enum dma_data_direction dir) ...@@ -64,6 +59,14 @@ _dma_sync(dma_addr_t addr, size_t size, enum dma_data_direction dir)
break; 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. * Map a single buffer of the indicated size for DMA in streaming mode.
......
...@@ -116,7 +116,7 @@ EXPORT_SYMBOL(dma_free_coherent); ...@@ -116,7 +116,7 @@ EXPORT_SYMBOL(dma_free_coherent);
void __dma_sync(dma_addr_t addr, size_t size, void __dma_sync(dma_addr_t addr, size_t size,
enum dma_data_direction dir) enum dma_data_direction dir)
{ {
_dma_sync(addr, size, dir); __dma_sync_inline(addr, size, dir);
} }
EXPORT_SYMBOL(__dma_sync); EXPORT_SYMBOL(__dma_sync);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment