diff options
author | Matthew Wilcox <willy@infradead.org> | 2018-10-30 09:53:52 -0700 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2018-11-14 12:50:34 +0100 |
commit | 2ae7f165c0b022a8ed1732f8ab2c11b2c173146e (patch) | |
tree | f60b615b1fad9053c153c51b02a9401304767513 /drivers/gpu/drm/virtio/virtgpu_kms.c | |
parent | 556c62e85f9b97139c1b3f6f1585fcee0bc3eb6a (diff) | |
download | linux-stable-2ae7f165c0b022a8ed1732f8ab2c11b2c173146e.tar.gz linux-stable-2ae7f165c0b022a8ed1732f8ab2c11b2c173146e.tar.bz2 linux-stable-2ae7f165c0b022a8ed1732f8ab2c11b2c173146e.zip |
drm/virtio: Use IDAs more efficiently
0-based IDAs are more efficient than any other base. Convert the
1-based IDAs to be 0-based.
Signed-off-by: Matthew Wilcox <willy@infradead.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20181030165352.13065-2-willy@infradead.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/virtio/virtgpu_kms.c')
-rw-r--r-- | drivers/gpu/drm/virtio/virtgpu_kms.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/gpu/drm/virtio/virtgpu_kms.c b/drivers/gpu/drm/virtio/virtgpu_kms.c index bf609dcae224..8118f10fde4a 100644 --- a/drivers/gpu/drm/virtio/virtgpu_kms.c +++ b/drivers/gpu/drm/virtio/virtgpu_kms.c @@ -55,10 +55,11 @@ static void virtio_gpu_config_changed_work_func(struct work_struct *work) static int virtio_gpu_context_create(struct virtio_gpu_device *vgdev, uint32_t nlen, const char *name) { - int handle = ida_alloc_min(&vgdev->ctx_id_ida, 1, GFP_KERNEL); + int handle = ida_alloc(&vgdev->ctx_id_ida, GFP_KERNEL); if (handle < 0) return handle; + handle += 1; virtio_gpu_cmd_context_create(vgdev, handle, nlen, name); return handle; } @@ -67,7 +68,7 @@ static void virtio_gpu_context_destroy(struct virtio_gpu_device *vgdev, uint32_t ctx_id) { virtio_gpu_cmd_context_destroy(vgdev, ctx_id); - ida_free(&vgdev->ctx_id_ida, ctx_id); + ida_free(&vgdev->ctx_id_ida, ctx_id - 1); } static void virtio_gpu_init_vq(struct virtio_gpu_queue *vgvq, |