I suspect dmabuf_obj_list_head and object_ids should be combined into a single xarray, but that's a job for later.
Signed-off-by: Matthew Wilcox <wi...@infradead.org> --- drivers/gpu/drm/i915/gvt/dmabuf.c | 7 +++---- drivers/gpu/drm/i915/gvt/gvt.h | 2 +- drivers/gpu/drm/i915/gvt/vgpu.c | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/i915/gvt/dmabuf.c b/drivers/gpu/drm/i915/gvt/dmabuf.c index 51ed99a37803..9fb60461affc 100644 --- a/drivers/gpu/drm/i915/gvt/dmabuf.c +++ b/drivers/gpu/drm/i915/gvt/dmabuf.c @@ -96,8 +96,7 @@ static void dmabuf_gem_object_free(struct kref *kref) struct intel_vgpu_dmabuf_obj, list); if (dmabuf_obj == obj) { intel_gvt_hypervisor_put_vfio_device(vgpu); - idr_remove(&vgpu->object_idr, - dmabuf_obj->dmabuf_id); + ida_free(&vgpu->object_ids, dmabuf_obj->dmabuf_id); kfree(dmabuf_obj->info); kfree(dmabuf_obj); list_del(pos); @@ -431,7 +430,7 @@ int intel_vgpu_query_plane(struct intel_vgpu *vgpu, void *args) dmabuf_obj->vgpu = vgpu; - ret = idr_alloc(&vgpu->object_idr, dmabuf_obj, 1, 0, GFP_NOWAIT); + ret = ida_alloc_min(&vgpu->object_ids, 1, GFP_NOWAIT); if (ret < 0) goto out_free_info; gfx_plane_info->dmabuf_id = ret; @@ -553,7 +552,7 @@ void intel_vgpu_dmabuf_cleanup(struct intel_vgpu *vgpu) list); dmabuf_obj->vgpu = NULL; - idr_remove(&vgpu->object_idr, dmabuf_obj->dmabuf_id); + ida_free(&vgpu->object_ids, dmabuf_obj->dmabuf_id); intel_gvt_hypervisor_put_vfio_device(vgpu); list_del(pos); diff --git a/drivers/gpu/drm/i915/gvt/gvt.h b/drivers/gpu/drm/i915/gvt/gvt.h index e5bf20dcdd7d..ffb181a086be 100644 --- a/drivers/gpu/drm/i915/gvt/gvt.h +++ b/drivers/gpu/drm/i915/gvt/gvt.h @@ -231,7 +231,7 @@ struct intel_vgpu { struct list_head dmabuf_obj_list_head; struct mutex dmabuf_lock; - struct idr object_idr; + struct ida object_ids; struct completion vblank_done; diff --git a/drivers/gpu/drm/i915/gvt/vgpu.c b/drivers/gpu/drm/i915/gvt/vgpu.c index 6ec5d16f4e06..c1db9a6a1281 100644 --- a/drivers/gpu/drm/i915/gvt/vgpu.c +++ b/drivers/gpu/drm/i915/gvt/vgpu.c @@ -383,7 +383,7 @@ static struct intel_vgpu *__intel_gvt_create_vgpu(struct intel_gvt *gvt, mutex_init(&vgpu->dmabuf_lock); INIT_LIST_HEAD(&vgpu->dmabuf_obj_list_head); xa_init(&vgpu->page_track); - idr_init(&vgpu->object_idr); + ida_init(&vgpu->object_ids); intel_vgpu_init_cfg_space(vgpu, param->primary); ret = intel_vgpu_init_mmio(vgpu); -- 2.20.1 _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel