summaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-omap/include/mach/memory.h
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2008-08-10 12:10:49 +0100
committerRussell King <rmk+kernel@arm.linux.org.uk>2008-08-10 12:10:49 +0100
commit98ed7d4b1a4eebc1ac25929b6968673bef4d54c3 (patch)
treeb9c0e29f20666f433d346c80b557ef0f055336eb /arch/arm/plat-omap/include/mach/memory.h
parent492c71dd545a54dc62df8780bd8d233d771748df (diff)
downloadtalos-obmc-linux-98ed7d4b1a4eebc1ac25929b6968673bef4d54c3.tar.gz
talos-obmc-linux-98ed7d4b1a4eebc1ac25929b6968673bef4d54c3.zip
[ARM] dma-mapping: improve type-safeness of DMA translations
OMAP at least gets the return type(s) for the DMA translation functions wrong, which can lead to subtle errors. Avoid this by moving the DMA translation functions to asm/dma-mapping.h, and converting them to inline functions. Fix the OMAP DMA translation macros to use the correct argument and result types. Also, remove the unnecessary casts in dmabounce.c. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/plat-omap/include/mach/memory.h')
-rw-r--r--arch/arm/plat-omap/include/mach/memory.h15
1 files changed, 8 insertions, 7 deletions
diff --git a/arch/arm/plat-omap/include/mach/memory.h b/arch/arm/plat-omap/include/mach/memory.h
index 037486c5f4a4..a325caf80d04 100644
--- a/arch/arm/plat-omap/include/mach/memory.h
+++ b/arch/arm/plat-omap/include/mach/memory.h
@@ -76,13 +76,14 @@
(dma_addr_t)virt_to_lbus(page_address(page)) : \
(dma_addr_t)__virt_to_bus(page_address(page));})
-#define __arch_dma_to_virt(dev, addr) ({is_lbus_device(dev) ? \
- lbus_to_virt(addr) : \
- __bus_to_virt(addr);})
-
-#define __arch_virt_to_dma(dev, addr) ({is_lbus_device(dev) ? \
- virt_to_lbus(addr) : \
- __virt_to_bus(addr);})
+#define __arch_dma_to_virt(dev, addr) ({ (void *) (is_lbus_device(dev) ? \
+ lbus_to_virt(addr) : \
+ __bus_to_virt(addr)); })
+
+#define __arch_virt_to_dma(dev, addr) ({ unsigned long __addr = (unsigned long)(addr); \
+ (dma_addr_t) (is_lbus_device(dev) ? \
+ virt_to_lbus(__addr) : \
+ __virt_to_bus(__addr)); })
#endif /* CONFIG_ARCH_OMAP15XX */
OpenPOWER on IntegriCloud