Commit ff512357 authored by Tejun Heo's avatar Tejun Heo Committed by Linus Torvalds

drm/sis: convert to idr_alloc()

Convert to the much saner new idr interface.
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
Acked-by: default avatarDavid Airlie <airlied@linux.ie>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent c8c470af
...@@ -128,17 +128,10 @@ static int sis_drm_alloc(struct drm_device *dev, struct drm_file *file, ...@@ -128,17 +128,10 @@ static int sis_drm_alloc(struct drm_device *dev, struct drm_file *file,
if (retval) if (retval)
goto fail_alloc; goto fail_alloc;
again: retval = idr_alloc(&dev_priv->object_idr, item, 1, 0, GFP_KERNEL);
if (idr_pre_get(&dev_priv->object_idr, GFP_KERNEL) == 0) { if (retval < 0)
retval = -ENOMEM;
goto fail_idr;
}
retval = idr_get_new_above(&dev_priv->object_idr, item, 1, &user_key);
if (retval == -EAGAIN)
goto again;
if (retval)
goto fail_idr; goto fail_idr;
user_key = retval;
list_add(&item->owner_list, &file_priv->obj_list); list_add(&item->owner_list, &file_priv->obj_list);
mutex_unlock(&dev->struct_mutex); mutex_unlock(&dev->struct_mutex);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment