mirror of
https://github.com/torvalds/linux.git
synced 2026-06-08 14:42:37 +02:00
UPSTREAM: drm: Use a normal idr allocation for the obj->name
Unlike the handle, the name table uses a sleeping mutex rather than a
spinlock. The allocation is in a normal context, and we can use the
simpler sleeping gfp_t, rather than have to take from the atomic
reserves.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1451902261-25380-3-git-send-email-chris@chris-wilson.co.uk
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
(cherry picked from commit 0f646425b9)
Change-Id: I5e087d086b0cd8efbc6bbca56d2dbe6f587ad63f
Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
This commit is contained in:
parent
330381b990
commit
3535f99a2d
|
|
@ -627,7 +627,6 @@ drm_gem_flink_ioctl(struct drm_device *dev, void *data,
|
|||
return -ENOENT;
|
||||
|
||||
mutex_lock(&dev->object_name_lock);
|
||||
idr_preload(GFP_KERNEL);
|
||||
/* prevent races with concurrent gem_close. */
|
||||
if (obj->handle_count == 0) {
|
||||
ret = -ENOENT;
|
||||
|
|
@ -635,7 +634,7 @@ drm_gem_flink_ioctl(struct drm_device *dev, void *data,
|
|||
}
|
||||
|
||||
if (!obj->name) {
|
||||
ret = idr_alloc(&dev->object_name_idr, obj, 1, 0, GFP_NOWAIT);
|
||||
ret = idr_alloc(&dev->object_name_idr, obj, 1, 0, GFP_KERNEL);
|
||||
if (ret < 0)
|
||||
goto err;
|
||||
|
||||
|
|
@ -646,7 +645,6 @@ drm_gem_flink_ioctl(struct drm_device *dev, void *data,
|
|||
ret = 0;
|
||||
|
||||
err:
|
||||
idr_preload_end();
|
||||
mutex_unlock(&dev->object_name_lock);
|
||||
drm_gem_object_unreference_unlocked(obj);
|
||||
return ret;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user