summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/virtio/virtgpu_object.c
diff options
context:
space:
mode:
authorMatthew Wilcox <willy@infradead.org>2018-10-30 17:53:52 +0100
committerGerd Hoffmann <kraxel@redhat.com>2018-11-14 12:50:34 +0100
commit2ae7f165c0b022a8ed1732f8ab2c11b2c173146e (patch)
treef60b615b1fad9053c153c51b02a9401304767513 /drivers/gpu/drm/virtio/virtgpu_object.c
parentdrm/virtio: Handle error from virtio_gpu_resource_id_get (diff)
downloadlinux-2ae7f165c0b022a8ed1732f8ab2c11b2c173146e.tar.xz
linux-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 '')
-rw-r--r--drivers/gpu/drm/virtio/virtgpu_object.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/gpu/drm/virtio/virtgpu_object.c b/drivers/gpu/drm/virtio/virtgpu_object.c
index 5ac42dded217..f39a183d59c2 100644
--- a/drivers/gpu/drm/virtio/virtgpu_object.c
+++ b/drivers/gpu/drm/virtio/virtgpu_object.c
@@ -28,18 +28,18 @@
static int virtio_gpu_resource_id_get(struct virtio_gpu_device *vgdev,
uint32_t *resid)
{
- int handle = ida_alloc_min(&vgdev->resource_ida, 1, GFP_KERNEL);
+ int handle = ida_alloc(&vgdev->resource_ida, GFP_KERNEL);
if (handle < 0)
return handle;
- *resid = handle;
+ *resid = handle + 1;
return 0;
}
static void virtio_gpu_resource_id_put(struct virtio_gpu_device *vgdev, uint32_t id)
{
- ida_free(&vgdev->resource_ida, id);
+ ida_free(&vgdev->resource_ida, id - 1);
}
static void virtio_gpu_ttm_bo_destroy(struct ttm_buffer_object *tbo)