From: kettenis Date: Thu, 2 Sep 2021 19:12:29 +0000 (+0000) Subject: Initialize the uvm object when we actually need it such that we can X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=951f4dd61fccad97b6204ac347ace9c9270202c7;p=openbsd Initialize the uvm object when we actually need it such that we can use uvm_obj_init() to initialize the pager ops and initial reference count. This will help future uvm unlocking diffs. ok mpi@, jsg@ --- diff --git a/sys/dev/pci/drm/ttm/ttm_bo.c b/sys/dev/pci/drm/ttm/ttm_bo.c index c2abe4a6cae..83bfa2ea2e9 100644 --- a/sys/dev/pci/drm/ttm/ttm_bo.c +++ b/sys/dev/pci/drm/ttm/ttm_bo.c @@ -1167,7 +1167,6 @@ int ttm_bo_init_reserved(struct ttm_bo_device *bdev, } bo->destroy = destroy ? destroy : ttm_bo_default_destroy; - uvm_obj_init(&bo->base.uobj, NULL, 0); kref_init(&bo->kref); INIT_LIST_HEAD(&bo->lru); INIT_LIST_HEAD(&bo->ddestroy); diff --git a/sys/dev/pci/drm/ttm/ttm_bo_vm.c b/sys/dev/pci/drm/ttm/ttm_bo_vm.c index 94beca6e476..cd70004f7b3 100644 --- a/sys/dev/pci/drm/ttm/ttm_bo_vm.c +++ b/sys/dev/pci/drm/ttm/ttm_bo_vm.c @@ -971,8 +971,7 @@ ttm_bo_mmap(struct file *filp, voff_t off, vsize_t size, if (unlikely(ret != 0)) goto out_unref; - bo->base.uobj.pgops = &ttm_bo_vm_ops; - bo->base.uobj.uo_refs++; + uvm_obj_init(&bo->base.uobj, &ttm_bo_vm_ops, 1); return &bo->base.uobj; out_unref: ttm_bo_put(bo);