Module Name:    src
Committed By:   maya
Date:           Thu Mar  9 07:50:50 UTC 2017

Modified Files:
        src/sys/external/bsd/drm2/ttm: ttm_bus_dma.c

Log Message:
Remove redundant handling for tt_unbound case, and assert that it is the
unpopulated case.

All callers of ttm_bus_dma_populate (ttm_agp_tt_populate,
radeon_ttm_tt_populate, nouveau_ttm_tt_populate) return early if it isn't
unpopulated.

from riastradh@


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/external/bsd/drm2/ttm/ttm_bus_dma.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/drm2/ttm/ttm_bus_dma.c
diff -u src/sys/external/bsd/drm2/ttm/ttm_bus_dma.c:1.3 src/sys/external/bsd/drm2/ttm/ttm_bus_dma.c:1.4
--- src/sys/external/bsd/drm2/ttm/ttm_bus_dma.c:1.3	Thu Mar  9 07:42:36 2017
+++ src/sys/external/bsd/drm2/ttm/ttm_bus_dma.c	Thu Mar  9 07:50:50 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ttm_bus_dma.c,v 1.3 2017/03/09 07:42:36 maya Exp $	*/
+/*	$NetBSD: ttm_bus_dma.c,v 1.4 2017/03/09 07:50:50 maya Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ttm_bus_dma.c,v 1.3 2017/03/09 07:42:36 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ttm_bus_dma.c,v 1.4 2017/03/09 07:50:50 maya Exp $");
 
 #include <sys/bus.h>
 
@@ -55,23 +55,12 @@ ttm_bus_dma_populate(struct ttm_dma_tt *
 {
 	int ret;
 
-	KASSERT(ttm_dma->ttm.state != tt_bound);
+	KASSERT(ttm_dma->ttm.state == tt_unpopulated);
 
-	/* Check the current state.  */
-	if (ttm_dma->ttm.state == tt_unbound) {
-		/*
-		 * If it's populated, then if the pages are wired and
-		 * loaded already, nothing to do.
-		 */
-		if (!ISSET(ttm_dma->ttm.page_flags, TTM_PAGE_FLAG_SWAPPED))
-			return 0;
-	} else if (ttm_dma->ttm.state == tt_unpopulated) {
-		/* If it's unpopulated, it can't be swapped.  */
-		KASSERT(!ISSET(ttm_dma->ttm.page_flags,
-			TTM_PAGE_FLAG_SWAPPED));
-		/* Pretend it is now, for the sake of ttm_tt_wire.  */
-		ttm_dma->ttm.page_flags |= TTM_PAGE_FLAG_SWAPPED;
-	}
+	/* If it's unpopulated, it can't be swapped.  */
+	KASSERT(!ISSET(ttm_dma->ttm.page_flags, TTM_PAGE_FLAG_SWAPPED));
+	/* Pretend it is now, for the sake of ttm_tt_wire.  */
+	ttm_dma->ttm.page_flags |= TTM_PAGE_FLAG_SWAPPED;
 
 	/* Wire the uvm pages and fill the ttm page array.  */
 	ret = ttm_tt_wire(&ttm_dma->ttm);

Reply via email to