Module Name:    src
Committed By:   riastradh
Date:           Mon Aug 18 02:43:27 UTC 2014

Modified Files:
        src/sys/external/bsd/drm2/dist/drm/ttm: ttm_bo.c

Log Message:
Simplify previous.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/external/bsd/drm2/dist/drm/ttm/ttm_bo.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/dist/drm/ttm/ttm_bo.c
diff -u src/sys/external/bsd/drm2/dist/drm/ttm/ttm_bo.c:1.5 src/sys/external/bsd/drm2/dist/drm/ttm/ttm_bo.c:1.6
--- src/sys/external/bsd/drm2/dist/drm/ttm/ttm_bo.c:1.5	Mon Aug 18 01:21:03 2014
+++ src/sys/external/bsd/drm2/dist/drm/ttm/ttm_bo.c	Mon Aug 18 02:43:27 2014
@@ -270,16 +270,6 @@ static int ttm_bo_add_ttm(struct ttm_buf
 						      page_flags, glob->dummy_read_page);
 		if (unlikely(bo->ttm == NULL))
 			ret = -ENOMEM;
-#ifdef __NetBSD__
-		/*
-		 * XXX This is gross.  We ought to do it the other way
-		 * around: set the uao to have the main uvm object's
-		 * lock.  However, uvm_obj_setlock is not safe on
-		 * uvm_aobjs.
-		 */
-		mutex_obj_hold(bo->ttm->swap_storage->vmobjlock);
-		uvm_obj_setlock(&bo->uvmobj, bo->ttm->swap_storage->vmobjlock);
-#endif
 		break;
 	case ttm_bo_type_sg:
 		bo->ttm = bdev->driver->ttm_tt_create(bdev, bo->num_pages << PAGE_SHIFT,
@@ -290,11 +280,6 @@ static int ttm_bo_add_ttm(struct ttm_buf
 			break;
 		}
 		bo->ttm->sg = bo->sg;
-#ifdef __NetBSD__
-		/* XXX This is gross too -- see above.  */
-		mutex_obj_hold(bo->ttm->swap_storage->vmobjlock);
-		uvm_obj_setlock(&bo->uvmobj, bo->ttm->swap_storage->vmobjlock);
-#endif
 		break;
 	default:
 		pr_err("Illegal buffer object type\n");
@@ -302,7 +287,21 @@ static int ttm_bo_add_ttm(struct ttm_buf
 		break;
 	}
 
+#ifdef __NetBSD__
+	if (ret)
+		return ret;
+
+	/*
+	 * XXX This is gross.  We ought to do it the other way around:
+	 * set the uao to have the main uvm object's lock.  However,
+	 * uvm_obj_setlock is not safe on uvm_aobjs.
+	 */
+	mutex_obj_hold(bo->ttm->swap_storage->vmobjlock);
+	uvm_obj_setlock(&bo->uvmobj, bo->ttm->swap_storage->vmobjlock);
+	return 0;
+#else
 	return ret;
+#endif
 }
 
 static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo,

Reply via email to