Patchwork [5/10] ARM: fix DMA-bounce code to allow sync from_device and to_device with bidirectional mappings.

login
register
mail settings
Submitter Krzysztof Halasa
Date Sept. 20, 2012, 8:19 p.m.
Message ID <m3ipb830rn.fsf@intrepid.localdomain>
Download mbox | patch
Permalink /patch/185486/
State New
Headers show

Comments

Krzysztof Halasa - Sept. 20, 2012, 8:19 p.m.
Signed-off-by: Krzysztof HaƂasa <khc@pm.waw.pl>

Patch

--- a/arch/arm/common/dmabounce.c
+++ b/arch/arm/common/dmabounce.c
@@ -375,7 +375,7 @@  static int __dmabounce_sync_for_cpu(struct device *dev, dma_addr_t addr,
 
 	off = addr - buf->safe_dma_addr;
 
-	BUG_ON(buf->direction != dir);
+	BUG_ON(buf->direction != dir && buf->direction != DMA_BIDIRECTIONAL);
 
 	dev_dbg(dev, "%s: unsafe buffer %p (dma=%#x off=%#lx) mapped to %p (dma=%#x)\n",
 		__func__, buf->ptr, virt_to_dma(dev, buf->ptr), off,
@@ -415,7 +415,7 @@  static int __dmabounce_sync_for_device(struct device *dev, dma_addr_t addr,
 
 	off = addr - buf->safe_dma_addr;
 
-	BUG_ON(buf->direction != dir);
+	BUG_ON(buf->direction != dir && buf->direction != DMA_BIDIRECTIONAL);
 
 	dev_dbg(dev, "%s: unsafe buffer %p (dma=%#x off=%#lx) mapped to %p (dma=%#x)\n",
 		__func__, buf->ptr, virt_to_dma(dev, buf->ptr), off,