aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/qxl/qxl_cmd.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2013-05-03 10:37:20 +1000
committerDave Airlie <airlied@redhat.com>2013-05-03 10:37:20 +1000
commit307b9c022720f9de90d58e51743e01e9a42aec59 (patch)
treedb95e7a54bf4826aa629f405c19511ba3bb1450b /drivers/gpu/drm/qxl/qxl_cmd.c
parentMerge branch 'server-fixes' into drm-next (diff)
downloadlinux-dev-307b9c022720f9de90d58e51743e01e9a42aec59.tar.xz
linux-dev-307b9c022720f9de90d58e51743e01e9a42aec59.zip
qxl: update to new idr interfaces.
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/qxl/qxl_cmd.c')
-rw-r--r--drivers/gpu/drm/qxl/qxl_cmd.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/drivers/gpu/drm/qxl/qxl_cmd.c b/drivers/gpu/drm/qxl/qxl_cmd.c
index 736365e6ca80..08b0823c93d5 100644
--- a/drivers/gpu/drm/qxl/qxl_cmd.c
+++ b/drivers/gpu/drm/qxl/qxl_cmd.c
@@ -435,22 +435,18 @@ void qxl_io_monitors_config(struct qxl_device *qdev)
int qxl_surface_id_alloc(struct qxl_device *qdev,
struct qxl_bo *surf)
{
- uint32_t handle = -ENOMEM;
+ uint32_t handle;
int idr_ret;
int count = 0;
again:
- if (idr_pre_get(&qdev->surf_id_idr, GFP_ATOMIC) == 0) {
- DRM_ERROR("Out of memory for surf idr\n");
- kfree(surf);
- goto alloc_fail;
- }
-
+ idr_preload(GFP_ATOMIC);
spin_lock(&qdev->surf_id_idr_lock);
- idr_ret = idr_get_new_above(&qdev->surf_id_idr, NULL, 1, &handle);
+ idr_ret = idr_alloc(&qdev->surf_id_idr, NULL, 1, 0, GFP_NOWAIT);
spin_unlock(&qdev->surf_id_idr_lock);
-
- if (idr_ret == -EAGAIN)
- goto again;
+ idr_preload_end();
+ if (idr_ret < 0)
+ return idr_ret;
+ handle = idr_ret;
if (handle >= qdev->rom->n_surfaces) {
count++;
@@ -465,7 +461,6 @@ again:
spin_lock(&qdev->surf_id_idr_lock);
qdev->last_alloced_surf_id = handle;
spin_unlock(&qdev->surf_id_idr_lock);
- alloc_fail:
return 0;
}