Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
[muen/linux.git] / kernel / dma / mapping.c
index ef2aba503467efcf91fcc60c124893c308d03e75..c000906348c936162e1dc4cd7faa1147a57c6d8e 100644 (file)
@@ -360,3 +360,17 @@ void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
                ops->cache_sync(dev, vaddr, size, dir);
 }
 EXPORT_SYMBOL(dma_cache_sync);
+
+size_t dma_max_mapping_size(struct device *dev)
+{
+       const struct dma_map_ops *ops = get_dma_ops(dev);
+       size_t size = SIZE_MAX;
+
+       if (dma_is_direct(ops))
+               size = dma_direct_max_mapping_size(dev);
+       else if (ops && ops->max_mapping_size)
+               size = ops->max_mapping_size(dev);
+
+       return size;
+}
+EXPORT_SYMBOL_GPL(dma_max_mapping_size);