Commit bc9025bd authored by Luca Barbieri's avatar Luca Barbieri Committed by Dave Airlie

Use drm_gem_object_[handle_]unreference_unlocked where possible

Mostly obvious simplifications.

The i915 pread/pwrite ioctls, intel_overlay_put_image and
nouveau_gem_new were incorrectly using the locked versions
without locking: this is also fixed in this patch.
Signed-off-by: default avatarLuca Barbieri <luca@luca-barbieri.com>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent c3ae90c0
...@@ -192,9 +192,7 @@ drm_gem_handle_delete(struct drm_file *filp, u32 handle) ...@@ -192,9 +192,7 @@ drm_gem_handle_delete(struct drm_file *filp, u32 handle)
idr_remove(&filp->object_idr, handle); idr_remove(&filp->object_idr, handle);
spin_unlock(&filp->table_lock); spin_unlock(&filp->table_lock);
mutex_lock(&dev->struct_mutex); drm_gem_object_handle_unreference_unlocked(obj);
drm_gem_object_handle_unreference(obj);
mutex_unlock(&dev->struct_mutex);
return 0; return 0;
} }
...@@ -325,9 +323,7 @@ again: ...@@ -325,9 +323,7 @@ again:
} }
err: err:
mutex_lock(&dev->struct_mutex); drm_gem_object_unreference_unlocked(obj);
drm_gem_object_unreference(obj);
mutex_unlock(&dev->struct_mutex);
return ret; return ret;
} }
...@@ -358,9 +354,7 @@ drm_gem_open_ioctl(struct drm_device *dev, void *data, ...@@ -358,9 +354,7 @@ drm_gem_open_ioctl(struct drm_device *dev, void *data,
return -ENOENT; return -ENOENT;
ret = drm_gem_handle_create(file_priv, obj, &handle); ret = drm_gem_handle_create(file_priv, obj, &handle);
mutex_lock(&dev->struct_mutex); drm_gem_object_unreference_unlocked(obj);
drm_gem_object_unreference(obj);
mutex_unlock(&dev->struct_mutex);
if (ret) if (ret)
return ret; return ret;
...@@ -390,7 +384,7 @@ drm_gem_object_release_handle(int id, void *ptr, void *data) ...@@ -390,7 +384,7 @@ drm_gem_object_release_handle(int id, void *ptr, void *data)
{ {
struct drm_gem_object *obj = ptr; struct drm_gem_object *obj = ptr;
drm_gem_object_handle_unreference(obj); drm_gem_object_handle_unreference_unlocked(obj);
return 0; return 0;
} }
...@@ -403,12 +397,10 @@ drm_gem_object_release_handle(int id, void *ptr, void *data) ...@@ -403,12 +397,10 @@ drm_gem_object_release_handle(int id, void *ptr, void *data)
void void
drm_gem_release(struct drm_device *dev, struct drm_file *file_private) drm_gem_release(struct drm_device *dev, struct drm_file *file_private)
{ {
mutex_lock(&dev->struct_mutex);
idr_for_each(&file_private->object_idr, idr_for_each(&file_private->object_idr,
&drm_gem_object_release_handle, NULL); &drm_gem_object_release_handle, NULL);
idr_destroy(&file_private->object_idr); idr_destroy(&file_private->object_idr);
mutex_unlock(&dev->struct_mutex);
} }
static void static void
...@@ -516,11 +508,8 @@ EXPORT_SYMBOL(drm_gem_vm_open); ...@@ -516,11 +508,8 @@ EXPORT_SYMBOL(drm_gem_vm_open);
void drm_gem_vm_close(struct vm_area_struct *vma) void drm_gem_vm_close(struct vm_area_struct *vma)
{ {
struct drm_gem_object *obj = vma->vm_private_data; struct drm_gem_object *obj = vma->vm_private_data;
struct drm_device *dev = obj->dev;
mutex_lock(&dev->struct_mutex); drm_gem_object_unreference_unlocked(obj);
drm_gem_object_unreference(obj);
mutex_unlock(&dev->struct_mutex);
} }
EXPORT_SYMBOL(drm_gem_vm_close); EXPORT_SYMBOL(drm_gem_vm_close);
......
...@@ -128,9 +128,7 @@ i915_gem_create_ioctl(struct drm_device *dev, void *data, ...@@ -128,9 +128,7 @@ i915_gem_create_ioctl(struct drm_device *dev, void *data,
return -ENOMEM; return -ENOMEM;
ret = drm_gem_handle_create(file_priv, obj, &handle); ret = drm_gem_handle_create(file_priv, obj, &handle);
mutex_lock(&dev->struct_mutex); drm_gem_object_handle_unreference_unlocked(obj);
drm_gem_object_handle_unreference(obj);
mutex_unlock(&dev->struct_mutex);
if (ret) if (ret)
return ret; return ret;
...@@ -488,7 +486,7 @@ i915_gem_pread_ioctl(struct drm_device *dev, void *data, ...@@ -488,7 +486,7 @@ i915_gem_pread_ioctl(struct drm_device *dev, void *data,
*/ */
if (args->offset > obj->size || args->size > obj->size || if (args->offset > obj->size || args->size > obj->size ||
args->offset + args->size > obj->size) { args->offset + args->size > obj->size) {
drm_gem_object_unreference(obj); drm_gem_object_unreference_unlocked(obj);
return -EINVAL; return -EINVAL;
} }
...@@ -501,7 +499,7 @@ i915_gem_pread_ioctl(struct drm_device *dev, void *data, ...@@ -501,7 +499,7 @@ i915_gem_pread_ioctl(struct drm_device *dev, void *data,
file_priv); file_priv);
} }
drm_gem_object_unreference(obj); drm_gem_object_unreference_unlocked(obj);
return ret; return ret;
} }
...@@ -961,7 +959,7 @@ i915_gem_pwrite_ioctl(struct drm_device *dev, void *data, ...@@ -961,7 +959,7 @@ i915_gem_pwrite_ioctl(struct drm_device *dev, void *data,
*/ */
if (args->offset > obj->size || args->size > obj->size || if (args->offset > obj->size || args->size > obj->size ||
args->offset + args->size > obj->size) { args->offset + args->size > obj->size) {
drm_gem_object_unreference(obj); drm_gem_object_unreference_unlocked(obj);
return -EINVAL; return -EINVAL;
} }
...@@ -995,7 +993,7 @@ i915_gem_pwrite_ioctl(struct drm_device *dev, void *data, ...@@ -995,7 +993,7 @@ i915_gem_pwrite_ioctl(struct drm_device *dev, void *data,
DRM_INFO("pwrite failed %d\n", ret); DRM_INFO("pwrite failed %d\n", ret);
#endif #endif
drm_gem_object_unreference(obj); drm_gem_object_unreference_unlocked(obj);
return ret; return ret;
} }
...@@ -1138,9 +1136,7 @@ i915_gem_mmap_ioctl(struct drm_device *dev, void *data, ...@@ -1138,9 +1136,7 @@ i915_gem_mmap_ioctl(struct drm_device *dev, void *data,
PROT_READ | PROT_WRITE, MAP_SHARED, PROT_READ | PROT_WRITE, MAP_SHARED,
args->offset); args->offset);
up_write(&current->mm->mmap_sem); up_write(&current->mm->mmap_sem);
mutex_lock(&dev->struct_mutex); drm_gem_object_unreference_unlocked(obj);
drm_gem_object_unreference(obj);
mutex_unlock(&dev->struct_mutex);
if (IS_ERR((void *)addr)) if (IS_ERR((void *)addr))
return addr; return addr;
......
...@@ -438,9 +438,7 @@ i915_gem_set_tiling(struct drm_device *dev, void *data, ...@@ -438,9 +438,7 @@ i915_gem_set_tiling(struct drm_device *dev, void *data,
obj_priv = obj->driver_private; obj_priv = obj->driver_private;
if (!i915_tiling_ok(dev, args->stride, obj->size, args->tiling_mode)) { if (!i915_tiling_ok(dev, args->stride, obj->size, args->tiling_mode)) {
mutex_lock(&dev->struct_mutex); drm_gem_object_unreference_unlocked(obj);
drm_gem_object_unreference(obj);
mutex_unlock(&dev->struct_mutex);
return -EINVAL; return -EINVAL;
} }
......
...@@ -3434,11 +3434,10 @@ static int intel_crtc_cursor_set(struct drm_crtc *crtc, ...@@ -3434,11 +3434,10 @@ static int intel_crtc_cursor_set(struct drm_crtc *crtc,
intel_crtc->cursor_bo = bo; intel_crtc->cursor_bo = bo;
return 0; return 0;
fail:
mutex_lock(&dev->struct_mutex);
fail_locked: fail_locked:
drm_gem_object_unreference(bo);
mutex_unlock(&dev->struct_mutex); mutex_unlock(&dev->struct_mutex);
fail:
drm_gem_object_unreference_unlocked(bo);
return ret; return ret;
} }
...@@ -4351,9 +4350,7 @@ static void intel_user_framebuffer_destroy(struct drm_framebuffer *fb) ...@@ -4351,9 +4350,7 @@ static void intel_user_framebuffer_destroy(struct drm_framebuffer *fb)
intelfb_remove(dev, fb); intelfb_remove(dev, fb);
drm_framebuffer_cleanup(fb); drm_framebuffer_cleanup(fb);
mutex_lock(&dev->struct_mutex); drm_gem_object_unreference_unlocked(intel_fb->obj);
drm_gem_object_unreference(intel_fb->obj);
mutex_unlock(&dev->struct_mutex);
kfree(intel_fb); kfree(intel_fb);
} }
...@@ -4416,9 +4413,7 @@ intel_user_framebuffer_create(struct drm_device *dev, ...@@ -4416,9 +4413,7 @@ intel_user_framebuffer_create(struct drm_device *dev,
ret = intel_framebuffer_create(dev, mode_cmd, &fb, obj); ret = intel_framebuffer_create(dev, mode_cmd, &fb, obj);
if (ret) { if (ret) {
mutex_lock(&dev->struct_mutex); drm_gem_object_unreference_unlocked(obj);
drm_gem_object_unreference(obj);
mutex_unlock(&dev->struct_mutex);
return NULL; return NULL;
} }
......
...@@ -1179,7 +1179,7 @@ int intel_overlay_put_image(struct drm_device *dev, void *data, ...@@ -1179,7 +1179,7 @@ int intel_overlay_put_image(struct drm_device *dev, void *data,
out_unlock: out_unlock:
mutex_unlock(&dev->struct_mutex); mutex_unlock(&dev->struct_mutex);
mutex_unlock(&dev->mode_config.mutex); mutex_unlock(&dev->mode_config.mutex);
drm_gem_object_unreference(new_bo); drm_gem_object_unreference_unlocked(new_bo);
kfree(params); kfree(params);
return ret; return ret;
......
...@@ -39,11 +39,8 @@ nouveau_user_framebuffer_destroy(struct drm_framebuffer *drm_fb) ...@@ -39,11 +39,8 @@ nouveau_user_framebuffer_destroy(struct drm_framebuffer *drm_fb)
if (drm_fb->fbdev) if (drm_fb->fbdev)
nouveau_fbcon_remove(dev, drm_fb); nouveau_fbcon_remove(dev, drm_fb);
if (fb->nvbo) { if (fb->nvbo)
mutex_lock(&dev->struct_mutex); drm_gem_object_unreference_unlocked(fb->nvbo->gem);
drm_gem_object_unreference(fb->nvbo->gem);
mutex_unlock(&dev->struct_mutex);
}
drm_framebuffer_cleanup(drm_fb); drm_framebuffer_cleanup(drm_fb);
kfree(fb); kfree(fb);
......
...@@ -401,10 +401,8 @@ nouveau_fbcon_remove(struct drm_device *dev, struct drm_framebuffer *fb) ...@@ -401,10 +401,8 @@ nouveau_fbcon_remove(struct drm_device *dev, struct drm_framebuffer *fb)
unregister_framebuffer(info); unregister_framebuffer(info);
nouveau_bo_unmap(nouveau_fb->nvbo); nouveau_bo_unmap(nouveau_fb->nvbo);
mutex_lock(&dev->struct_mutex); drm_gem_object_unreference_unlocked(nouveau_fb->nvbo->gem);
drm_gem_object_unreference(nouveau_fb->nvbo->gem);
nouveau_fb->nvbo = NULL; nouveau_fb->nvbo = NULL;
mutex_unlock(&dev->struct_mutex);
if (par) if (par)
drm_fb_helper_free(&par->helper); drm_fb_helper_free(&par->helper);
framebuffer_release(info); framebuffer_release(info);
......
...@@ -167,12 +167,10 @@ nouveau_gem_ioctl_new(struct drm_device *dev, void *data, ...@@ -167,12 +167,10 @@ nouveau_gem_ioctl_new(struct drm_device *dev, void *data,
ret = drm_gem_handle_create(file_priv, nvbo->gem, &req->info.handle); ret = drm_gem_handle_create(file_priv, nvbo->gem, &req->info.handle);
out: out:
mutex_lock(&dev->struct_mutex); drm_gem_object_handle_unreference_unlocked(nvbo->gem);
drm_gem_object_handle_unreference(nvbo->gem);
mutex_unlock(&dev->struct_mutex);
if (ret) if (ret)
drm_gem_object_unreference(nvbo->gem); drm_gem_object_unreference_unlocked(nvbo->gem);
return ret; return ret;
} }
...@@ -865,9 +863,7 @@ nouveau_gem_ioctl_pin(struct drm_device *dev, void *data, ...@@ -865,9 +863,7 @@ nouveau_gem_ioctl_pin(struct drm_device *dev, void *data,
req->domain = NOUVEAU_GEM_DOMAIN_VRAM; req->domain = NOUVEAU_GEM_DOMAIN_VRAM;
out: out:
mutex_lock(&dev->struct_mutex); drm_gem_object_unreference_unlocked(gem);
drm_gem_object_unreference(gem);
mutex_unlock(&dev->struct_mutex);
return ret; return ret;
} }
...@@ -891,9 +887,7 @@ nouveau_gem_ioctl_unpin(struct drm_device *dev, void *data, ...@@ -891,9 +887,7 @@ nouveau_gem_ioctl_unpin(struct drm_device *dev, void *data,
ret = nouveau_bo_unpin(nouveau_gem_object(gem)); ret = nouveau_bo_unpin(nouveau_gem_object(gem));
mutex_lock(&dev->struct_mutex); drm_gem_object_unreference_unlocked(gem);
drm_gem_object_unreference(gem);
mutex_unlock(&dev->struct_mutex);
return ret; return ret;
} }
...@@ -935,9 +929,7 @@ nouveau_gem_ioctl_cpu_prep(struct drm_device *dev, void *data, ...@@ -935,9 +929,7 @@ nouveau_gem_ioctl_cpu_prep(struct drm_device *dev, void *data,
} }
out: out:
mutex_lock(&dev->struct_mutex); drm_gem_object_unreference_unlocked(gem);
drm_gem_object_unreference(gem);
mutex_unlock(&dev->struct_mutex);
return ret; return ret;
} }
...@@ -965,9 +957,7 @@ nouveau_gem_ioctl_cpu_fini(struct drm_device *dev, void *data, ...@@ -965,9 +957,7 @@ nouveau_gem_ioctl_cpu_fini(struct drm_device *dev, void *data,
ret = 0; ret = 0;
out: out:
mutex_lock(&dev->struct_mutex); drm_gem_object_unreference_unlocked(gem);
drm_gem_object_unreference(gem);
mutex_unlock(&dev->struct_mutex);
return ret; return ret;
} }
...@@ -986,9 +976,7 @@ nouveau_gem_ioctl_info(struct drm_device *dev, void *data, ...@@ -986,9 +976,7 @@ nouveau_gem_ioctl_info(struct drm_device *dev, void *data,
return -EINVAL; return -EINVAL;
ret = nouveau_gem_info(gem, req); ret = nouveau_gem_info(gem, req);
mutex_lock(&dev->struct_mutex); drm_gem_object_unreference_unlocked(gem);
drm_gem_object_unreference(gem);
mutex_unlock(&dev->struct_mutex);
return ret; return ret;
} }
...@@ -61,11 +61,8 @@ nouveau_notifier_init_channel(struct nouveau_channel *chan) ...@@ -61,11 +61,8 @@ nouveau_notifier_init_channel(struct nouveau_channel *chan)
chan->notifier_bo = ntfy; chan->notifier_bo = ntfy;
out_err: out_err:
if (ret) { if (ret)
mutex_lock(&dev->struct_mutex); drm_gem_object_unreference_unlocked(ntfy->gem);
drm_gem_object_unreference(ntfy->gem);
mutex_unlock(&dev->struct_mutex);
}
return ret; return ret;
} }
...@@ -81,8 +78,8 @@ nouveau_notifier_takedown_channel(struct nouveau_channel *chan) ...@@ -81,8 +78,8 @@ nouveau_notifier_takedown_channel(struct nouveau_channel *chan)
nouveau_bo_unmap(chan->notifier_bo); nouveau_bo_unmap(chan->notifier_bo);
mutex_lock(&dev->struct_mutex); mutex_lock(&dev->struct_mutex);
nouveau_bo_unpin(chan->notifier_bo); nouveau_bo_unpin(chan->notifier_bo);
drm_gem_object_unreference(chan->notifier_bo->gem);
mutex_unlock(&dev->struct_mutex); mutex_unlock(&dev->struct_mutex);
drm_gem_object_unreference_unlocked(chan->notifier_bo->gem);
nouveau_mem_takedown(&chan->notifier_heap); nouveau_mem_takedown(&chan->notifier_heap);
} }
......
...@@ -926,9 +926,7 @@ nv04_crtc_cursor_set(struct drm_crtc *crtc, struct drm_file *file_priv, ...@@ -926,9 +926,7 @@ nv04_crtc_cursor_set(struct drm_crtc *crtc, struct drm_file *file_priv,
nv_crtc->cursor.set_offset(nv_crtc, nv_crtc->cursor.offset); nv_crtc->cursor.set_offset(nv_crtc, nv_crtc->cursor.offset);
nv_crtc->cursor.show(nv_crtc, true); nv_crtc->cursor.show(nv_crtc, true);
out: out:
mutex_lock(&dev->struct_mutex); drm_gem_object_unreference_unlocked(gem);
drm_gem_object_unreference(gem);
mutex_unlock(&dev->struct_mutex);
return ret; return ret;
} }
......
...@@ -358,9 +358,7 @@ nv50_crtc_cursor_set(struct drm_crtc *crtc, struct drm_file *file_priv, ...@@ -358,9 +358,7 @@ nv50_crtc_cursor_set(struct drm_crtc *crtc, struct drm_file *file_priv,
nv_crtc->cursor.show(nv_crtc, true); nv_crtc->cursor.show(nv_crtc, true);
out: out:
mutex_lock(&dev->struct_mutex); drm_gem_object_unreference_unlocked(gem);
drm_gem_object_unreference(gem);
mutex_unlock(&dev->struct_mutex);
return ret; return ret;
} }
......
...@@ -196,11 +196,8 @@ static void radeon_cs_parser_fini(struct radeon_cs_parser *parser, int error) ...@@ -196,11 +196,8 @@ static void radeon_cs_parser_fini(struct radeon_cs_parser *parser, int error)
radeon_bo_list_unreserve(&parser->validated); radeon_bo_list_unreserve(&parser->validated);
} }
for (i = 0; i < parser->nrelocs; i++) { for (i = 0; i < parser->nrelocs; i++) {
if (parser->relocs[i].gobj) { if (parser->relocs[i].gobj)
mutex_lock(&parser->rdev->ddev->struct_mutex); drm_gem_object_unreference_unlocked(parser->relocs[i].gobj);
drm_gem_object_unreference(parser->relocs[i].gobj);
mutex_unlock(&parser->rdev->ddev->struct_mutex);
}
} }
kfree(parser->track); kfree(parser->track);
kfree(parser->relocs); kfree(parser->relocs);
......
...@@ -169,17 +169,13 @@ int radeon_crtc_cursor_set(struct drm_crtc *crtc, ...@@ -169,17 +169,13 @@ int radeon_crtc_cursor_set(struct drm_crtc *crtc,
unpin: unpin:
if (radeon_crtc->cursor_bo) { if (radeon_crtc->cursor_bo) {
radeon_gem_object_unpin(radeon_crtc->cursor_bo); radeon_gem_object_unpin(radeon_crtc->cursor_bo);
mutex_lock(&crtc->dev->struct_mutex); drm_gem_object_unreference_unlocked(radeon_crtc->cursor_bo);
drm_gem_object_unreference(radeon_crtc->cursor_bo);
mutex_unlock(&crtc->dev->struct_mutex);
} }
radeon_crtc->cursor_bo = obj; radeon_crtc->cursor_bo = obj;
return 0; return 0;
fail: fail:
mutex_lock(&crtc->dev->struct_mutex); drm_gem_object_unreference_unlocked(obj);
drm_gem_object_unreference(obj);
mutex_unlock(&crtc->dev->struct_mutex);
return 0; return 0;
} }
......
...@@ -679,11 +679,8 @@ static void radeon_user_framebuffer_destroy(struct drm_framebuffer *fb) ...@@ -679,11 +679,8 @@ static void radeon_user_framebuffer_destroy(struct drm_framebuffer *fb)
if (fb->fbdev) if (fb->fbdev)
radeonfb_remove(dev, fb); radeonfb_remove(dev, fb);
if (radeon_fb->obj) { if (radeon_fb->obj)
mutex_lock(&dev->struct_mutex); drm_gem_object_unreference_unlocked(radeon_fb->obj);
drm_gem_object_unreference(radeon_fb->obj);
mutex_unlock(&dev->struct_mutex);
}
drm_framebuffer_cleanup(fb); drm_framebuffer_cleanup(fb);
kfree(radeon_fb); kfree(radeon_fb);
} }
......
...@@ -69,9 +69,7 @@ int radeon_gem_object_create(struct radeon_device *rdev, int size, ...@@ -69,9 +69,7 @@ int radeon_gem_object_create(struct radeon_device *rdev, int size,
if (r != -ERESTARTSYS) if (r != -ERESTARTSYS)
DRM_ERROR("Failed to allocate GEM object (%d, %d, %u, %d)\n", DRM_ERROR("Failed to allocate GEM object (%d, %d, %u, %d)\n",
size, initial_domain, alignment, r); size, initial_domain, alignment, r);
mutex_lock(&rdev->ddev->struct_mutex); drm_gem_object_unreference_unlocked(gobj);
drm_gem_object_unreference(gobj);
mutex_unlock(&rdev->ddev->struct_mutex);
return r; return r;
} }
gobj->driver_private = robj; gobj->driver_private = robj;
...@@ -202,14 +200,10 @@ int radeon_gem_create_ioctl(struct drm_device *dev, void *data, ...@@ -202,14 +200,10 @@ int radeon_gem_create_ioctl(struct drm_device *dev, void *data,
} }
r = drm_gem_handle_create(filp, gobj, &handle); r = drm_gem_handle_create(filp, gobj, &handle);
if (r) { if (r) {
mutex_lock(&dev->struct_mutex); drm_gem_object_unreference_unlocked(gobj);
drm_gem_object_unreference(gobj);
mutex_unlock(&dev->struct_mutex);
return r; return r;
} }
mutex_lock(&dev->struct_mutex); drm_gem_object_handle_unreference_unlocked(gobj);
drm_gem_object_handle_unreference(gobj);
mutex_unlock(&dev->struct_mutex);
args->handle = handle; args->handle = handle;
return 0; return 0;
} }
...@@ -236,9 +230,7 @@ int radeon_gem_set_domain_ioctl(struct drm_device *dev, void *data, ...@@ -236,9 +230,7 @@ int radeon_gem_set_domain_ioctl(struct drm_device *dev, void *data,
r = radeon_gem_set_domain(gobj, args->read_domains, args->write_domain); r = radeon_gem_set_domain(gobj, args->read_domains, args->write_domain);
mutex_lock(&dev->struct_mutex); drm_gem_object_unreference_unlocked(gobj);
drm_gem_object_unreference(gobj);
mutex_unlock(&dev->struct_mutex);
return r; return r;
} }
...@@ -255,9 +247,7 @@ int radeon_gem_mmap_ioctl(struct drm_device *dev, void *data, ...@@ -255,9 +247,7 @@ int radeon_gem_mmap_ioctl(struct drm_device *dev, void *data,
} }
robj = gobj->driver_private; robj = gobj->driver_private;
args->addr_ptr = radeon_bo_mmap_offset(robj); args->addr_ptr = radeon_bo_mmap_offset(robj);
mutex_lock(&dev->struct_mutex); drm_gem_object_unreference_unlocked(gobj);
drm_gem_object_unreference(gobj);
mutex_unlock(&dev->struct_mutex);
return 0; return 0;
} }
...@@ -288,9 +278,7 @@ int radeon_gem_busy_ioctl(struct drm_device *dev, void *data, ...@@ -288,9 +278,7 @@ int radeon_gem_busy_ioctl(struct drm_device *dev, void *data,
default: default:
break; break;
} }
mutex_lock(&dev->struct_mutex); drm_gem_object_unreference_unlocked(gobj);
drm_gem_object_unreference(gobj);
mutex_unlock(&dev->struct_mutex);
return r; return r;
} }
...@@ -311,9 +299,7 @@ int radeon_gem_wait_idle_ioctl(struct drm_device *dev, void *data, ...@@ -311,9 +299,7 @@ int radeon_gem_wait_idle_ioctl(struct drm_device *dev, void *data,
/* callback hw specific functions if any */ /* callback hw specific functions if any */
if (robj->rdev->asic->ioctl_wait_idle) if (robj->rdev->asic->ioctl_wait_idle)
robj->rdev->asic->ioctl_wait_idle(robj->rdev, robj); robj->rdev->asic->ioctl_wait_idle(robj->rdev, robj);
mutex_lock(&dev->struct_mutex); drm_gem_object_unreference_unlocked(gobj);
drm_gem_object_unreference(gobj);
mutex_unlock(&dev->struct_mutex);
return r; return r;
} }
...@@ -331,9 +317,7 @@ int radeon_gem_set_tiling_ioctl(struct drm_device *dev, void *data, ...@@ -331,9 +317,7 @@ int radeon_gem_set_tiling_ioctl(struct drm_device *dev, void *data,
return -EINVAL; return -EINVAL;
robj = gobj->driver_private; robj = gobj->driver_private;
r = radeon_bo_set_tiling_flags(robj, args->tiling_flags, args->pitch); r = radeon_bo_set_tiling_flags(robj, args->tiling_flags, args->pitch);
mutex_lock(&dev->struct_mutex); drm_gem_object_unreference_unlocked(gobj);
drm_gem_object_unreference(gobj);
mutex_unlock(&dev->struct_mutex);
return r; return r;
} }
...@@ -356,8 +340,6 @@ int radeon_gem_get_tiling_ioctl(struct drm_device *dev, void *data, ...@@ -356,8 +340,6 @@ int radeon_gem_get_tiling_ioctl(struct drm_device *dev, void *data,
radeon_bo_get_tiling_flags(rbo, &args->tiling_flags, &args->pitch); radeon_bo_get_tiling_flags(rbo, &args->tiling_flags, &args->pitch);
radeon_bo_unreserve(rbo); radeon_bo_unreserve(rbo);
out: out:
mutex_lock(&dev->struct_mutex); drm_gem_object_unreference_unlocked(gobj);
drm_gem_object_unreference(gobj);
mutex_unlock(&dev->struct_mutex);
return r; return r;
} }
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