提交 36888db2 编写于 作者: T Tejun Heo 提交者: Linus Torvalds

drm/via: convert to idr_alloc()

Convert to the much saner new idr interface.
Signed-off-by: NTejun Heo <tj@kernel.org>
Acked-by: NDavid Airlie <airlied@linux.ie>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 ff512357
...@@ -148,17 +148,10 @@ int via_mem_alloc(struct drm_device *dev, void *data, ...@@ -148,17 +148,10 @@ int via_mem_alloc(struct drm_device *dev, void *data,
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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册