]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - include/linux/dma-mapping.h
Merge tag 'armsoc-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc
[linux.git] / include / linux / dma-mapping.h
index 8d13e28a8e0751fb34b49e2c21af5db04600e2da..f7d1eea32c78b21ee9e1f02d20d8dd22ec35cc01 100644 (file)
@@ -679,6 +679,20 @@ static inline int dma_coerce_mask_and_coherent(struct device *dev, u64 mask)
        return dma_set_mask_and_coherent(dev, mask);
 }
 
+/**
+ * dma_addressing_limited - return if the device is addressing limited
+ * @dev:       device to check
+ *
+ * Return %true if the devices DMA mask is too small to address all memory in
+ * the system, else %false.  Lack of addressing bits is the prime reason for
+ * bounce buffering, but might not be the only one.
+ */
+static inline bool dma_addressing_limited(struct device *dev)
+{
+       return min_not_zero(dma_get_mask(dev), dev->bus_dma_mask) <
+                           dma_get_required_mask(dev);
+}
+
 #ifdef CONFIG_ARCH_HAS_SETUP_DMA_OPS
 void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
                const struct iommu_ops *iommu, bool coherent);