[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>
This commit is contained in:
committed by
Russell King
parent
492c71dd54
commit
98ed7d4b1a
@ -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_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) ({is_lbus_device(dev) ? \
|
||||
virt_to_lbus(addr) : \
|
||||
__virt_to_bus(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 */
|
||||
|
||||
|
Reference in New Issue
Block a user