Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/external/bsd/drm2/dist/drm/ttm Simplify previous.



details:   https://anonhg.NetBSD.org/src/rev/fcdf5756b653
branches:  trunk
changeset: 331641:fcdf5756b653
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Mon Aug 18 02:43:27 2014 +0000

description:
Simplify previous.

diffstat:

 sys/external/bsd/drm2/dist/drm/ttm/ttm_bo.c |  29 ++++++++++++++---------------
 1 files changed, 14 insertions(+), 15 deletions(-)

diffs (54 lines):

diff -r e652f6fb1896 -r fcdf5756b653 sys/external/bsd/drm2/dist/drm/ttm/ttm_bo.c
--- a/sys/external/bsd/drm2/dist/drm/ttm/ttm_bo.c       Mon Aug 18 01:21:03 2014 +0000
+++ b/sys/external/bsd/drm2/dist/drm/ttm/ttm_bo.c       Mon Aug 18 02:43:27 2014 +0000
@@ -270,16 +270,6 @@
                                                      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 @@
                        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 @@
                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,



Home | Main Index | Thread Index | Old Index