Merge tag 'iommu-updates-v4.12' of git://git.kernel.org/pub/scm/linux/kernel/git...
[platform/kernel/linux-rpi.git] / arch / arm / mm / dma-mapping.c
index 0268584..c742dfd 100644 (file)
@@ -2408,6 +2408,15 @@ void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
        const struct dma_map_ops *dma_ops;
 
        dev->archdata.dma_coherent = coherent;
+
+       /*
+        * Don't override the dma_ops if they have already been set. Ideally
+        * this should be the only location where dma_ops are set, remove this
+        * check when all other callers of set_dma_ops will have disappeared.
+        */
+       if (dev->dma_ops)
+               return;
+
        if (arm_setup_iommu_dma_ops(dev, dma_base, size, iommu))
                dma_ops = arm_get_iommu_dma_map_ops(coherent);
        else