From: Russell King Date: Fri, 6 Dec 2013 12:30:42 +0000 (+0000) Subject: ARM: another fix for the DMA mapping checks X-Git-Tag: next-20131210~111^2 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=e36056f5200085d8474de86c52c6a1973fb30190;p=karo-tx-linux.git ARM: another fix for the DMA mapping checks Peter reports that OMAP audio broke with the recent fix for these checks, caused by OMAP audio using a 64-bit DMA mask. We should allow 64-bit DMA masks even with 32-bit dma_addr_t if we can be sure the amount of RAM we have won't allow the 32-bit dma_addr_t to overflow. Unfortunately, the checks to detect overflow were not correct. Tested-by: Peter Ujfalusi Signed-off-by: Russell King --- diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index f6b6bfa88ecf..c143a7bb681b 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c @@ -185,7 +185,7 @@ static u64 get_coherent_dma_mask(struct device *dev) */ if (sizeof(mask) != sizeof(dma_addr_t) && mask > (dma_addr_t)~0 && - dma_to_pfn(dev, ~0) > max_dma_pfn) { + dma_to_pfn(dev, ~0) < max_dma_pfn) { dev_warn(dev, "Coherent DMA mask %#llx is larger than dma_addr_t allows\n", mask); dev_warn(dev, "Driver did not use or check the return value from dma_set_coherent_mask()?\n"); @@ -1041,7 +1041,7 @@ int dma_supported(struct device *dev, u64 mask) */ if (sizeof(mask) != sizeof(dma_addr_t) && mask > (dma_addr_t)~0 && - dma_to_pfn(dev, ~0) > arm_dma_pfn_limit) + dma_to_pfn(dev, ~0) < min(max_pfn, arm_dma_pfn_limit)) return 0; /*