From: Jérôme Glisse <jgli...@redhat.com>

We can not rely on swiotlb_nr_tbl() to know if swiotlb is in use or
not for our device. Use the new helper to determine that.

Signed-off-by: Jérôme Glisse <jglisse at redhat.com>
Cc: Konrad Rzeszutek Wilk <konrad.wilk at oracle.com>
Cc: Alex Deucher <alexander.deucher at amd.com>
Cc: Ben Skeggs <bskeggs at redhat.com>
Cc: Dave Airlie <airlied at redhat.com>
Cc: lkml at vger.kernel.org
Cc: Daniel Vetter <daniel.vetter at intel.com>
---
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c 
b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
index 620bb5c..a2b0ec0 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
@@ -517,10 +517,8 @@ static int vmw_dma_select_mode(struct vmw_private 
*dev_priv)

        if (dma_ops->sync_single_for_cpu)
                dev_priv->map_mode = vmw_dma_alloc_coherent;
-#ifdef CONFIG_SWIOTLB
-       if (swiotlb_nr_tbl() == 0)
+       if (!swiotlb_in_use(dev_priv->dev->dev))
                dev_priv->map_mode = vmw_dma_map_populate;
-#endif

 #ifdef CONFIG_INTEL_IOMMU
 out_fixup:
-- 
2.1.0

Reply via email to