diff mbox

[3/6] drm/nouveau: Use swiotlb_in_use() to know if swiotlb is enabled or not.

Message ID 1440615127-25834-4-git-send-email-jglisse@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jerome Glisse Aug. 26, 2015, 6:52 p.m. UTC
From: Jérôme Glisse <jglisse@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@redhat.com>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: Dave Airlie <airlied@redhat.com>
Cc: lkml@vger.kernel.org
Cc: Daniel Vetter <daniel.vetter@intel.com>
---
 drivers/gpu/drm/nouveau/nouveau_bo.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
diff mbox

Patch

diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c
index 6edcce1..f601049 100644
--- a/drivers/gpu/drm/nouveau/nouveau_bo.c
+++ b/drivers/gpu/drm/nouveau/nouveau_bo.c
@@ -28,7 +28,6 @@ 
  */
 
 #include <linux/dma-mapping.h>
-#include <linux/swiotlb.h>
 
 #include "nouveau_drm.h"
 #include "nouveau_dma.h"
@@ -1504,11 +1503,9 @@  nouveau_ttm_tt_populate(struct ttm_tt *ttm)
 	}
 #endif
 
-#ifdef CONFIG_SWIOTLB
-	if (swiotlb_nr_tbl()) {
+	if (swiotlb_in_use(pdev)) {
 		return ttm_dma_populate((void *)ttm, dev->dev);
 	}
-#endif
 
 	r = ttm_pool_populate(ttm);
 	if (r) {
@@ -1572,12 +1569,10 @@  nouveau_ttm_tt_unpopulate(struct ttm_tt *ttm)
 	}
 #endif
 
-#ifdef CONFIG_SWIOTLB
-	if (swiotlb_nr_tbl()) {
+	if (swiotlb_in_use(pdev)) {
 		ttm_dma_unpopulate((void *)ttm, dev->dev);
 		return;
 	}
-#endif
 
 	for (i = 0; i < ttm->num_pages; i++) {
 		if (ttm_dma->dma_address[i]) {