Merge tag 'xtensa-20181228' of git://github.com/jcmvbkbc/linux-xtensa
[sfrench/cifs-2.6.git] / arch / arm / mm / dma-mapping-nommu.c
index 712416ecd8e6c8e6dd721a8247fe5d56d61d8877..f304b10e23a4cbfa9c3c89335dd917418f82c45f 100644 (file)
@@ -22,7 +22,7 @@
 #include "dma.h"
 
 /*
- *  dma_direct_ops is used if
+ *  The generic direct mapping code is used if
  *   - MMU/MPU is off
  *   - cpu is v7m w/o cache support
  *   - device is coherent
@@ -209,16 +209,9 @@ const struct dma_map_ops arm_nommu_dma_ops = {
 };
 EXPORT_SYMBOL(arm_nommu_dma_ops);
 
-static const struct dma_map_ops *arm_nommu_get_dma_map_ops(bool coherent)
-{
-       return coherent ? &dma_direct_ops : &arm_nommu_dma_ops;
-}
-
 void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
                        const struct iommu_ops *iommu, bool coherent)
 {
-       const struct dma_map_ops *dma_ops;
-
        if (IS_ENABLED(CONFIG_CPU_V7M)) {
                /*
                 * Cache support for v7m is optional, so can be treated as
@@ -234,7 +227,6 @@ void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
                dev->archdata.dma_coherent = (get_cr() & CR_M) ? coherent : true;
        }
 
-       dma_ops = arm_nommu_get_dma_map_ops(dev->archdata.dma_coherent);
-
-       set_dma_ops(dev, dma_ops);
+       if (!dev->archdata.dma_coherent)
+               set_dma_ops(dev, &arm_nommu_dma_ops);
 }