Commit f11fb66a authored by Emil Velikov's avatar Emil Velikov Committed by Emil Velikov

drm/radeon: remove _unlocked suffix in drm_gem_object_put_unlocked

Spelling out _unlocked for each and every driver is a annoying.
Especially if we consider how many drivers, do not know (or need to)
about the horror stories involving struct_mutex.

Just drop the suffix. It makes the API cleaner.

Done via the following script:

__from=drm_gem_object_put_unlocked
__to=drm_gem_object_put
for __file in $(git grep --name-only $__from); do
  sed -i  "s/$__from/$__to/g" $__file;
done

Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: "Christian König" <christian.koenig@amd.com>
Cc: "David (ChunMing) Zhou" <David1.Zhou@amd.com>
Signed-off-by: default avatarEmil Velikov <emil.velikov@collabora.com>
Acked-by: default avatarSam Ravnborg <sam@ravnborg.org>
Acked-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20200515095118.2743122-30-emil.l.velikov@gmail.com
parent 9c86fb18
...@@ -443,7 +443,7 @@ static void radeon_cs_parser_fini(struct radeon_cs_parser *parser, int error, bo ...@@ -443,7 +443,7 @@ static void radeon_cs_parser_fini(struct radeon_cs_parser *parser, int error, bo
if (bo == NULL) if (bo == NULL)
continue; continue;
drm_gem_object_put_unlocked(&bo->tbo.base); drm_gem_object_put(&bo->tbo.base);
} }
} }
kfree(parser->track); kfree(parser->track);
......
...@@ -309,7 +309,7 @@ int radeon_crtc_cursor_set2(struct drm_crtc *crtc, ...@@ -309,7 +309,7 @@ int radeon_crtc_cursor_set2(struct drm_crtc *crtc,
robj = gem_to_radeon_bo(obj); robj = gem_to_radeon_bo(obj);
ret = radeon_bo_reserve(robj, false); ret = radeon_bo_reserve(robj, false);
if (ret != 0) { if (ret != 0) {
drm_gem_object_put_unlocked(obj); drm_gem_object_put(obj);
return ret; return ret;
} }
/* Only 27 bit offset for legacy cursor */ /* Only 27 bit offset for legacy cursor */
...@@ -319,7 +319,7 @@ int radeon_crtc_cursor_set2(struct drm_crtc *crtc, ...@@ -319,7 +319,7 @@ int radeon_crtc_cursor_set2(struct drm_crtc *crtc,
radeon_bo_unreserve(robj); radeon_bo_unreserve(robj);
if (ret) { if (ret) {
DRM_ERROR("Failed to pin new cursor BO (%d)\n", ret); DRM_ERROR("Failed to pin new cursor BO (%d)\n", ret);
drm_gem_object_put_unlocked(obj); drm_gem_object_put(obj);
return ret; return ret;
} }
...@@ -354,7 +354,7 @@ int radeon_crtc_cursor_set2(struct drm_crtc *crtc, ...@@ -354,7 +354,7 @@ int radeon_crtc_cursor_set2(struct drm_crtc *crtc,
radeon_bo_unpin(robj); radeon_bo_unpin(robj);
radeon_bo_unreserve(robj); radeon_bo_unreserve(robj);
} }
drm_gem_object_put_unlocked(radeon_crtc->cursor_bo); drm_gem_object_put(radeon_crtc->cursor_bo);
} }
radeon_crtc->cursor_bo = obj; radeon_crtc->cursor_bo = obj;
......
...@@ -281,7 +281,7 @@ static void radeon_unpin_work_func(struct work_struct *__work) ...@@ -281,7 +281,7 @@ static void radeon_unpin_work_func(struct work_struct *__work)
} else } else
DRM_ERROR("failed to reserve buffer after flip\n"); DRM_ERROR("failed to reserve buffer after flip\n");
drm_gem_object_put_unlocked(&work->old_rbo->tbo.base); drm_gem_object_put(&work->old_rbo->tbo.base);
kfree(work); kfree(work);
} }
...@@ -613,7 +613,7 @@ static int radeon_crtc_page_flip_target(struct drm_crtc *crtc, ...@@ -613,7 +613,7 @@ static int radeon_crtc_page_flip_target(struct drm_crtc *crtc,
radeon_bo_unreserve(new_rbo); radeon_bo_unreserve(new_rbo);
cleanup: cleanup:
drm_gem_object_put_unlocked(&work->old_rbo->tbo.base); drm_gem_object_put(&work->old_rbo->tbo.base);
dma_fence_put(work->fence); dma_fence_put(work->fence);
kfree(work); kfree(work);
return r; return r;
...@@ -1337,14 +1337,14 @@ radeon_user_framebuffer_create(struct drm_device *dev, ...@@ -1337,14 +1337,14 @@ radeon_user_framebuffer_create(struct drm_device *dev,
fb = kzalloc(sizeof(*fb), GFP_KERNEL); fb = kzalloc(sizeof(*fb), GFP_KERNEL);
if (fb == NULL) { if (fb == NULL) {
drm_gem_object_put_unlocked(obj); drm_gem_object_put(obj);
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
} }
ret = radeon_framebuffer_init(dev, fb, mode_cmd, obj); ret = radeon_framebuffer_init(dev, fb, mode_cmd, obj);
if (ret) { if (ret) {
kfree(fb); kfree(fb);
drm_gem_object_put_unlocked(obj); drm_gem_object_put(obj);
return ERR_PTR(ret); return ERR_PTR(ret);
} }
......
...@@ -119,7 +119,7 @@ static void radeonfb_destroy_pinned_object(struct drm_gem_object *gobj) ...@@ -119,7 +119,7 @@ static void radeonfb_destroy_pinned_object(struct drm_gem_object *gobj)
radeon_bo_unpin(rbo); radeon_bo_unpin(rbo);
radeon_bo_unreserve(rbo); radeon_bo_unreserve(rbo);
} }
drm_gem_object_put_unlocked(gobj); drm_gem_object_put(gobj);
} }
static int radeonfb_create_pinned_object(struct radeon_fbdev *rfbdev, static int radeonfb_create_pinned_object(struct radeon_fbdev *rfbdev,
...@@ -298,7 +298,7 @@ static int radeonfb_create(struct drm_fb_helper *helper, ...@@ -298,7 +298,7 @@ static int radeonfb_create(struct drm_fb_helper *helper,
} }
if (fb && ret) { if (fb && ret) {
drm_gem_object_put_unlocked(gobj); drm_gem_object_put(gobj);
drm_framebuffer_unregister_private(fb); drm_framebuffer_unregister_private(fb);
drm_framebuffer_cleanup(fb); drm_framebuffer_cleanup(fb);
kfree(fb); kfree(fb);
......
...@@ -275,7 +275,7 @@ int radeon_gem_create_ioctl(struct drm_device *dev, void *data, ...@@ -275,7 +275,7 @@ 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);
/* drop reference from allocate - handle holds it now */ /* drop reference from allocate - handle holds it now */
drm_gem_object_put_unlocked(gobj); drm_gem_object_put(gobj);
if (r) { if (r) {
up_read(&rdev->exclusive_lock); up_read(&rdev->exclusive_lock);
r = radeon_gem_handle_lockup(rdev, r); r = radeon_gem_handle_lockup(rdev, r);
...@@ -359,7 +359,7 @@ int radeon_gem_userptr_ioctl(struct drm_device *dev, void *data, ...@@ -359,7 +359,7 @@ int radeon_gem_userptr_ioctl(struct drm_device *dev, void *data,
r = drm_gem_handle_create(filp, gobj, &handle); r = drm_gem_handle_create(filp, gobj, &handle);
/* drop reference from allocate - handle holds it now */ /* drop reference from allocate - handle holds it now */
drm_gem_object_put_unlocked(gobj); drm_gem_object_put(gobj);
if (r) if (r)
goto handle_lockup; goto handle_lockup;
...@@ -368,7 +368,7 @@ int radeon_gem_userptr_ioctl(struct drm_device *dev, void *data, ...@@ -368,7 +368,7 @@ int radeon_gem_userptr_ioctl(struct drm_device *dev, void *data,
return 0; return 0;
release_object: release_object:
drm_gem_object_put_unlocked(gobj); drm_gem_object_put(gobj);
handle_lockup: handle_lockup:
up_read(&rdev->exclusive_lock); up_read(&rdev->exclusive_lock);
...@@ -402,7 +402,7 @@ int radeon_gem_set_domain_ioctl(struct drm_device *dev, void *data, ...@@ -402,7 +402,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);
drm_gem_object_put_unlocked(gobj); drm_gem_object_put(gobj);
up_read(&rdev->exclusive_lock); up_read(&rdev->exclusive_lock);
r = radeon_gem_handle_lockup(robj->rdev, r); r = radeon_gem_handle_lockup(robj->rdev, r);
return r; return r;
...@@ -421,11 +421,11 @@ int radeon_mode_dumb_mmap(struct drm_file *filp, ...@@ -421,11 +421,11 @@ int radeon_mode_dumb_mmap(struct drm_file *filp,
} }
robj = gem_to_radeon_bo(gobj); robj = gem_to_radeon_bo(gobj);
if (radeon_ttm_tt_has_userptr(robj->tbo.ttm)) { if (radeon_ttm_tt_has_userptr(robj->tbo.ttm)) {
drm_gem_object_put_unlocked(gobj); drm_gem_object_put(gobj);
return -EPERM; return -EPERM;
} }
*offset_p = radeon_bo_mmap_offset(robj); *offset_p = radeon_bo_mmap_offset(robj);
drm_gem_object_put_unlocked(gobj); drm_gem_object_put(gobj);
return 0; return 0;
} }
...@@ -460,7 +460,7 @@ int radeon_gem_busy_ioctl(struct drm_device *dev, void *data, ...@@ -460,7 +460,7 @@ int radeon_gem_busy_ioctl(struct drm_device *dev, void *data,
cur_placement = READ_ONCE(robj->tbo.mem.mem_type); cur_placement = READ_ONCE(robj->tbo.mem.mem_type);
args->domain = radeon_mem_type_to_domain(cur_placement); args->domain = radeon_mem_type_to_domain(cur_placement);
drm_gem_object_put_unlocked(gobj); drm_gem_object_put(gobj);
return r; return r;
} }
...@@ -492,7 +492,7 @@ int radeon_gem_wait_idle_ioctl(struct drm_device *dev, void *data, ...@@ -492,7 +492,7 @@ int radeon_gem_wait_idle_ioctl(struct drm_device *dev, void *data,
if (rdev->asic->mmio_hdp_flush && if (rdev->asic->mmio_hdp_flush &&
radeon_mem_type_to_domain(cur_placement) == RADEON_GEM_DOMAIN_VRAM) radeon_mem_type_to_domain(cur_placement) == RADEON_GEM_DOMAIN_VRAM)
robj->rdev->asic->mmio_hdp_flush(rdev); robj->rdev->asic->mmio_hdp_flush(rdev);
drm_gem_object_put_unlocked(gobj); drm_gem_object_put(gobj);
r = radeon_gem_handle_lockup(rdev, r); r = radeon_gem_handle_lockup(rdev, r);
return r; return r;
} }
...@@ -511,7 +511,7 @@ int radeon_gem_set_tiling_ioctl(struct drm_device *dev, void *data, ...@@ -511,7 +511,7 @@ int radeon_gem_set_tiling_ioctl(struct drm_device *dev, void *data,
return -ENOENT; return -ENOENT;
robj = gem_to_radeon_bo(gobj); robj = gem_to_radeon_bo(gobj);
r = radeon_bo_set_tiling_flags(robj, args->tiling_flags, args->pitch); r = radeon_bo_set_tiling_flags(robj, args->tiling_flags, args->pitch);
drm_gem_object_put_unlocked(gobj); drm_gem_object_put(gobj);
return r; return r;
} }
...@@ -534,7 +534,7 @@ int radeon_gem_get_tiling_ioctl(struct drm_device *dev, void *data, ...@@ -534,7 +534,7 @@ 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:
drm_gem_object_put_unlocked(gobj); drm_gem_object_put(gobj);
return r; return r;
} }
...@@ -668,14 +668,14 @@ int radeon_gem_va_ioctl(struct drm_device *dev, void *data, ...@@ -668,14 +668,14 @@ int radeon_gem_va_ioctl(struct drm_device *dev, void *data,
r = radeon_bo_reserve(rbo, false); r = radeon_bo_reserve(rbo, false);
if (r) { if (r) {
args->operation = RADEON_VA_RESULT_ERROR; args->operation = RADEON_VA_RESULT_ERROR;
drm_gem_object_put_unlocked(gobj); drm_gem_object_put(gobj);
return r; return r;
} }
bo_va = radeon_vm_bo_find(&fpriv->vm, rbo); bo_va = radeon_vm_bo_find(&fpriv->vm, rbo);
if (!bo_va) { if (!bo_va) {
args->operation = RADEON_VA_RESULT_ERROR; args->operation = RADEON_VA_RESULT_ERROR;
radeon_bo_unreserve(rbo); radeon_bo_unreserve(rbo);
drm_gem_object_put_unlocked(gobj); drm_gem_object_put(gobj);
return -ENOENT; return -ENOENT;
} }
...@@ -702,7 +702,7 @@ int radeon_gem_va_ioctl(struct drm_device *dev, void *data, ...@@ -702,7 +702,7 @@ int radeon_gem_va_ioctl(struct drm_device *dev, void *data,
args->operation = RADEON_VA_RESULT_ERROR; args->operation = RADEON_VA_RESULT_ERROR;
} }
out: out:
drm_gem_object_put_unlocked(gobj); drm_gem_object_put(gobj);
return r; return r;
} }
...@@ -743,7 +743,7 @@ int radeon_gem_op_ioctl(struct drm_device *dev, void *data, ...@@ -743,7 +743,7 @@ int radeon_gem_op_ioctl(struct drm_device *dev, void *data,
radeon_bo_unreserve(robj); radeon_bo_unreserve(robj);
out: out:
drm_gem_object_put_unlocked(gobj); drm_gem_object_put(gobj);
return r; return r;
} }
...@@ -769,7 +769,7 @@ int radeon_mode_dumb_create(struct drm_file *file_priv, ...@@ -769,7 +769,7 @@ int radeon_mode_dumb_create(struct drm_file *file_priv,
r = drm_gem_handle_create(file_priv, gobj, &handle); r = drm_gem_handle_create(file_priv, gobj, &handle);
/* drop reference from allocate - handle holds it now */ /* drop reference from allocate - handle holds it now */
drm_gem_object_put_unlocked(gobj); drm_gem_object_put(gobj);
if (r) { if (r) {
return r; return r;
} }
......
...@@ -448,7 +448,7 @@ void radeon_bo_force_delete(struct radeon_device *rdev) ...@@ -448,7 +448,7 @@ void radeon_bo_force_delete(struct radeon_device *rdev)
list_del_init(&bo->list); list_del_init(&bo->list);
mutex_unlock(&bo->rdev->gem.mutex); mutex_unlock(&bo->rdev->gem.mutex);
/* this should unref the ttm bo */ /* this should unref the ttm bo */
drm_gem_object_put_unlocked(&bo->tbo.base); drm_gem_object_put(&bo->tbo.base);
} }
} }
......
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