diff options
author | Matthew Wilcox <willy@infradead.org> | 2018-09-26 09:00:28 -0700 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2018-10-29 22:50:55 +0100 |
commit | 1938d1ae32fefa172288e3a9245ae126640c5c10 (patch) | |
tree | 595d3ca8cb753851752d02fe6430ea95651cfc8d /drivers/gpu/drm/virtio/virtgpu_object.c | |
parent | 6c1cd97bdaffa2ae1dbdc8a0857931308ac647cd (diff) |
drm/virtio: Replace IDRs with IDAs
These IDRs were only being used to allocate unique numbers, not to look
up pointers, so they can use the more space-efficient IDA instead.
Signed-off-by: Matthew Wilcox <willy@infradead.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20180926160031.15721-2-willy@infradead.org
[ kraxel: resolve conflict ]
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/virtio/virtgpu_object.c')
-rw-r--r-- | drivers/gpu/drm/virtio/virtgpu_object.c | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/drivers/gpu/drm/virtio/virtgpu_object.c b/drivers/gpu/drm/virtio/virtgpu_object.c index 8bd1ebe13b62..77eac4eb06b1 100644 --- a/drivers/gpu/drm/virtio/virtgpu_object.c +++ b/drivers/gpu/drm/virtio/virtgpu_object.c @@ -28,21 +28,13 @@ static void virtio_gpu_resource_id_get(struct virtio_gpu_device *vgdev, uint32_t *resid) { - int handle; - - idr_preload(GFP_KERNEL); - spin_lock(&vgdev->resource_idr_lock); - handle = idr_alloc(&vgdev->resource_idr, NULL, 1, 0, GFP_NOWAIT); - spin_unlock(&vgdev->resource_idr_lock); - idr_preload_end(); + int handle = ida_alloc_min(&vgdev->resource_ida, 1, GFP_KERNEL); *resid = handle; } static void virtio_gpu_resource_id_put(struct virtio_gpu_device *vgdev, uint32_t id) { - spin_lock(&vgdev->resource_idr_lock); - idr_remove(&vgdev->resource_idr, id); - spin_unlock(&vgdev->resource_idr_lock); + ida_free(&vgdev->resource_ida, id); } static void virtio_gpu_ttm_bo_destroy(struct ttm_buffer_object *tbo) |