summaryrefslogtreecommitdiff
path: root/sys/dev/pci/drm/ttm/ttm_bo_vm.c
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2021-10-12 18:22:05 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2021-10-12 18:22:05 +0000
commit406aa5410c6cd6073f7fd56d96e23e321a782d84 (patch)
treec6da58ecd20b7d66af6498e85c7d318427d91459 /sys/dev/pci/drm/ttm/ttm_bo_vm.c
parentb506776769d4df7495472132b6069e7327cc7886 (diff)
Remove misleading uvm reference counting that isn't actually used.
Make sure uvm_obj_init() is only called once. Call uvm_obj_destroy() when we release the GEM object that wraps an uvm object for which we called uvm_obj_init(). ok mpi@, jsg@
Diffstat (limited to 'sys/dev/pci/drm/ttm/ttm_bo_vm.c')
-rw-r--r--sys/dev/pci/drm/ttm/ttm_bo_vm.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/sys/dev/pci/drm/ttm/ttm_bo_vm.c b/sys/dev/pci/drm/ttm/ttm_bo_vm.c
index a2d27de6e3d..b78a807e27c 100644
--- a/sys/dev/pci/drm/ttm/ttm_bo_vm.c
+++ b/sys/dev/pci/drm/ttm/ttm_bo_vm.c
@@ -852,7 +852,6 @@ ttm_bo_vm_reference(struct uvm_object *uobj)
(struct ttm_buffer_object *)uobj;
ttm_bo_get(bo);
- uobj->uo_refs++;
}
void
@@ -860,7 +859,6 @@ ttm_bo_vm_detach(struct uvm_object *uobj)
{
struct ttm_buffer_object *bo = (struct ttm_buffer_object *)uobj;
- uobj->uo_refs--;
ttm_bo_put(bo);
}
@@ -971,7 +969,8 @@ ttm_bo_mmap(struct file *filp, voff_t off, vsize_t size,
if (unlikely(ret != 0))
goto out_unref;
- uvm_obj_init(&bo->base.uobj, &ttm_bo_vm_ops, 1);
+ if (bo->base.uobj.pgops == NULL)
+ uvm_obj_init(&bo->base.uobj, &ttm_bo_vm_ops, 1);
return &bo->base.uobj;
out_unref:
ttm_bo_put(bo);