summaryrefslogtreecommitdiffstats
path: root/include/linux/dma-direct.h
diff options
context:
space:
mode:
authorChristoph Hellwig2018-09-20 14:04:08 +0200
committerChristoph Hellwig2018-10-01 16:28:03 +0200
commitb4ebe6063204da58e48600b810a97c29ae9e5d12 (patch)
tree5bf1cf53eeaa87f1bf0d89e8f55cf27d720599b9 /include/linux/dma-direct.h
parentdma-direct: refine dma_direct_alloc zone selection (diff)
downloadkernel-qcow2-linux-b4ebe6063204da58e48600b810a97c29ae9e5d12.tar.gz
kernel-qcow2-linux-b4ebe6063204da58e48600b810a97c29ae9e5d12.tar.xz
kernel-qcow2-linux-b4ebe6063204da58e48600b810a97c29ae9e5d12.zip
dma-direct: implement complete bus_dma_mask handling
Instead of rejecting devices with a too small bus_dma_mask we can handle by taking the bus dma_mask into account for allocations and bounce buffering decisions. Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'include/linux/dma-direct.h')
-rw-r--r--include/linux/dma-direct.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/include/linux/dma-direct.h b/include/linux/dma-direct.h
index b79496d8c75b..fbca184ff5a0 100644
--- a/include/linux/dma-direct.h
+++ b/include/linux/dma-direct.h
@@ -27,7 +27,8 @@ static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size)
if (!dev->dma_mask)
return false;
- return addr + size - 1 <= *dev->dma_mask;
+ return addr + size - 1 <=
+ min_not_zero(*dev->dma_mask, dev->bus_dma_mask);
}
#endif /* !CONFIG_ARCH_HAS_PHYS_TO_DMA */