@@ -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,