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

drm/amd: 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-15-emil.l.velikov@gmail.com
parent be6ee102
...@@ -102,7 +102,7 @@ int amdgpu_bo_list_create(struct amdgpu_device *adev, struct drm_file *filp, ...@@ -102,7 +102,7 @@ int amdgpu_bo_list_create(struct amdgpu_device *adev, struct drm_file *filp,
} }
bo = amdgpu_bo_ref(gem_to_amdgpu_bo(gobj)); bo = amdgpu_bo_ref(gem_to_amdgpu_bo(gobj));
drm_gem_object_put_unlocked(gobj); drm_gem_object_put(gobj);
usermm = amdgpu_ttm_tt_get_usermm(bo->tbo.ttm); usermm = amdgpu_ttm_tt_get_usermm(bo->tbo.ttm);
if (usermm) { if (usermm) {
......
...@@ -57,7 +57,7 @@ static int amdgpu_cs_user_fence_chunk(struct amdgpu_cs_parser *p, ...@@ -57,7 +57,7 @@ static int amdgpu_cs_user_fence_chunk(struct amdgpu_cs_parser *p,
/* One for TTM and one for the CS job */ /* One for TTM and one for the CS job */
p->uf_entry.tv.num_shared = 2; p->uf_entry.tv.num_shared = 2;
drm_gem_object_put_unlocked(gobj); drm_gem_object_put(gobj);
size = amdgpu_bo_size(bo); size = amdgpu_bo_size(bo);
if (size != PAGE_SIZE || (data->offset + 8) > size) { if (size != PAGE_SIZE || (data->offset + 8) > size) {
......
...@@ -575,14 +575,14 @@ amdgpu_display_user_framebuffer_create(struct drm_device *dev, ...@@ -575,14 +575,14 @@ amdgpu_display_user_framebuffer_create(struct drm_device *dev,
amdgpu_fb = kzalloc(sizeof(*amdgpu_fb), GFP_KERNEL); amdgpu_fb = kzalloc(sizeof(*amdgpu_fb), GFP_KERNEL);
if (amdgpu_fb == NULL) { if (amdgpu_fb == NULL) {
drm_gem_object_put_unlocked(obj); drm_gem_object_put(obj);
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
} }
ret = amdgpu_display_framebuffer_init(dev, amdgpu_fb, mode_cmd, obj); ret = amdgpu_display_framebuffer_init(dev, amdgpu_fb, mode_cmd, obj);
if (ret) { if (ret) {
kfree(amdgpu_fb); kfree(amdgpu_fb);
drm_gem_object_put_unlocked(obj); drm_gem_object_put(obj);
return ERR_PTR(ret); return ERR_PTR(ret);
} }
......
...@@ -587,7 +587,7 @@ struct drm_gem_object *amdgpu_gem_prime_import(struct drm_device *dev, ...@@ -587,7 +587,7 @@ struct drm_gem_object *amdgpu_gem_prime_import(struct drm_device *dev,
attach = dma_buf_dynamic_attach(dma_buf, dev->dev, attach = dma_buf_dynamic_attach(dma_buf, dev->dev,
&amdgpu_dma_buf_attach_ops, obj); &amdgpu_dma_buf_attach_ops, obj);
if (IS_ERR(attach)) { if (IS_ERR(attach)) {
drm_gem_object_put_unlocked(obj); drm_gem_object_put(obj);
return ERR_CAST(attach); return ERR_CAST(attach);
} }
......
...@@ -114,7 +114,7 @@ static void amdgpufb_destroy_pinned_object(struct drm_gem_object *gobj) ...@@ -114,7 +114,7 @@ static void amdgpufb_destroy_pinned_object(struct drm_gem_object *gobj)
amdgpu_bo_unpin(abo); amdgpu_bo_unpin(abo);
amdgpu_bo_unreserve(abo); amdgpu_bo_unreserve(abo);
} }
drm_gem_object_put_unlocked(gobj); drm_gem_object_put(gobj);
} }
static int amdgpufb_create_pinned_object(struct amdgpu_fbdev *rfbdev, static int amdgpufb_create_pinned_object(struct amdgpu_fbdev *rfbdev,
...@@ -279,7 +279,7 @@ static int amdgpufb_create(struct drm_fb_helper *helper, ...@@ -279,7 +279,7 @@ static int amdgpufb_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);
......
...@@ -106,7 +106,7 @@ void amdgpu_gem_force_release(struct amdgpu_device *adev) ...@@ -106,7 +106,7 @@ void amdgpu_gem_force_release(struct amdgpu_device *adev)
spin_lock(&file->table_lock); spin_lock(&file->table_lock);
idr_for_each_entry(&file->object_idr, gobj, handle) { idr_for_each_entry(&file->object_idr, gobj, handle) {
WARN_ONCE(1, "And also active allocations!\n"); WARN_ONCE(1, "And also active allocations!\n");
drm_gem_object_put_unlocked(gobj); drm_gem_object_put(gobj);
} }
idr_destroy(&file->object_idr); idr_destroy(&file->object_idr);
spin_unlock(&file->table_lock); spin_unlock(&file->table_lock);
...@@ -272,7 +272,7 @@ int amdgpu_gem_create_ioctl(struct drm_device *dev, void *data, ...@@ -272,7 +272,7 @@ int amdgpu_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)
return r; return r;
...@@ -356,7 +356,7 @@ int amdgpu_gem_userptr_ioctl(struct drm_device *dev, void *data, ...@@ -356,7 +356,7 @@ int amdgpu_gem_userptr_ioctl(struct drm_device *dev, void *data,
amdgpu_ttm_tt_get_user_pages_done(bo->tbo.ttm); amdgpu_ttm_tt_get_user_pages_done(bo->tbo.ttm);
release_object: release_object:
drm_gem_object_put_unlocked(gobj); drm_gem_object_put(gobj);
return r; return r;
} }
...@@ -375,11 +375,11 @@ int amdgpu_mode_dumb_mmap(struct drm_file *filp, ...@@ -375,11 +375,11 @@ int amdgpu_mode_dumb_mmap(struct drm_file *filp,
robj = gem_to_amdgpu_bo(gobj); robj = gem_to_amdgpu_bo(gobj);
if (amdgpu_ttm_tt_get_usermm(robj->tbo.ttm) || if (amdgpu_ttm_tt_get_usermm(robj->tbo.ttm) ||
(robj->flags & AMDGPU_GEM_CREATE_NO_CPU_ACCESS)) { (robj->flags & AMDGPU_GEM_CREATE_NO_CPU_ACCESS)) {
drm_gem_object_put_unlocked(gobj); drm_gem_object_put(gobj);
return -EPERM; return -EPERM;
} }
*offset_p = amdgpu_bo_mmap_offset(robj); *offset_p = amdgpu_bo_mmap_offset(robj);
drm_gem_object_put_unlocked(gobj); drm_gem_object_put(gobj);
return 0; return 0;
} }
...@@ -449,7 +449,7 @@ int amdgpu_gem_wait_idle_ioctl(struct drm_device *dev, void *data, ...@@ -449,7 +449,7 @@ int amdgpu_gem_wait_idle_ioctl(struct drm_device *dev, void *data,
} else } else
r = ret; r = ret;
drm_gem_object_put_unlocked(gobj); drm_gem_object_put(gobj);
return r; return r;
} }
...@@ -492,7 +492,7 @@ int amdgpu_gem_metadata_ioctl(struct drm_device *dev, void *data, ...@@ -492,7 +492,7 @@ int amdgpu_gem_metadata_ioctl(struct drm_device *dev, void *data,
unreserve: unreserve:
amdgpu_bo_unreserve(robj); amdgpu_bo_unreserve(robj);
out: out:
drm_gem_object_put_unlocked(gobj); drm_gem_object_put(gobj);
return r; return r;
} }
...@@ -691,7 +691,7 @@ int amdgpu_gem_va_ioctl(struct drm_device *dev, void *data, ...@@ -691,7 +691,7 @@ int amdgpu_gem_va_ioctl(struct drm_device *dev, void *data,
ttm_eu_backoff_reservation(&ticket, &list); ttm_eu_backoff_reservation(&ticket, &list);
error_unref: error_unref:
drm_gem_object_put_unlocked(gobj); drm_gem_object_put(gobj);
return r; return r;
} }
...@@ -767,7 +767,7 @@ int amdgpu_gem_op_ioctl(struct drm_device *dev, void *data, ...@@ -767,7 +767,7 @@ int amdgpu_gem_op_ioctl(struct drm_device *dev, void *data,
} }
out: out:
drm_gem_object_put_unlocked(gobj); drm_gem_object_put(gobj);
return r; return r;
} }
...@@ -804,7 +804,7 @@ int amdgpu_mode_dumb_create(struct drm_file *file_priv, ...@@ -804,7 +804,7 @@ int amdgpu_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;
} }
......
...@@ -2404,7 +2404,7 @@ static int dce_v10_0_crtc_cursor_set2(struct drm_crtc *crtc, ...@@ -2404,7 +2404,7 @@ static int dce_v10_0_crtc_cursor_set2(struct drm_crtc *crtc,
aobj = gem_to_amdgpu_bo(obj); aobj = gem_to_amdgpu_bo(obj);
ret = amdgpu_bo_reserve(aobj, false); ret = amdgpu_bo_reserve(aobj, false);
if (ret != 0) { if (ret != 0) {
drm_gem_object_put_unlocked(obj); drm_gem_object_put(obj);
return ret; return ret;
} }
...@@ -2412,7 +2412,7 @@ static int dce_v10_0_crtc_cursor_set2(struct drm_crtc *crtc, ...@@ -2412,7 +2412,7 @@ static int dce_v10_0_crtc_cursor_set2(struct drm_crtc *crtc,
amdgpu_bo_unreserve(aobj); amdgpu_bo_unreserve(aobj);
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;
} }
amdgpu_crtc->cursor_addr = amdgpu_bo_gpu_offset(aobj); amdgpu_crtc->cursor_addr = amdgpu_bo_gpu_offset(aobj);
...@@ -2447,7 +2447,7 @@ static int dce_v10_0_crtc_cursor_set2(struct drm_crtc *crtc, ...@@ -2447,7 +2447,7 @@ static int dce_v10_0_crtc_cursor_set2(struct drm_crtc *crtc,
amdgpu_bo_unpin(aobj); amdgpu_bo_unpin(aobj);
amdgpu_bo_unreserve(aobj); amdgpu_bo_unreserve(aobj);
} }
drm_gem_object_put_unlocked(amdgpu_crtc->cursor_bo); drm_gem_object_put(amdgpu_crtc->cursor_bo);
} }
amdgpu_crtc->cursor_bo = obj; amdgpu_crtc->cursor_bo = obj;
......
...@@ -2483,7 +2483,7 @@ static int dce_v11_0_crtc_cursor_set2(struct drm_crtc *crtc, ...@@ -2483,7 +2483,7 @@ static int dce_v11_0_crtc_cursor_set2(struct drm_crtc *crtc,
aobj = gem_to_amdgpu_bo(obj); aobj = gem_to_amdgpu_bo(obj);
ret = amdgpu_bo_reserve(aobj, false); ret = amdgpu_bo_reserve(aobj, false);
if (ret != 0) { if (ret != 0) {
drm_gem_object_put_unlocked(obj); drm_gem_object_put(obj);
return ret; return ret;
} }
...@@ -2491,7 +2491,7 @@ static int dce_v11_0_crtc_cursor_set2(struct drm_crtc *crtc, ...@@ -2491,7 +2491,7 @@ static int dce_v11_0_crtc_cursor_set2(struct drm_crtc *crtc,
amdgpu_bo_unreserve(aobj); amdgpu_bo_unreserve(aobj);
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;
} }
amdgpu_crtc->cursor_addr = amdgpu_bo_gpu_offset(aobj); amdgpu_crtc->cursor_addr = amdgpu_bo_gpu_offset(aobj);
...@@ -2526,7 +2526,7 @@ static int dce_v11_0_crtc_cursor_set2(struct drm_crtc *crtc, ...@@ -2526,7 +2526,7 @@ static int dce_v11_0_crtc_cursor_set2(struct drm_crtc *crtc,
amdgpu_bo_unpin(aobj); amdgpu_bo_unpin(aobj);
amdgpu_bo_unreserve(aobj); amdgpu_bo_unreserve(aobj);
} }
drm_gem_object_put_unlocked(amdgpu_crtc->cursor_bo); drm_gem_object_put(amdgpu_crtc->cursor_bo);
} }
amdgpu_crtc->cursor_bo = obj; amdgpu_crtc->cursor_bo = obj;
......
...@@ -2299,7 +2299,7 @@ static int dce_v6_0_crtc_cursor_set2(struct drm_crtc *crtc, ...@@ -2299,7 +2299,7 @@ static int dce_v6_0_crtc_cursor_set2(struct drm_crtc *crtc,
aobj = gem_to_amdgpu_bo(obj); aobj = gem_to_amdgpu_bo(obj);
ret = amdgpu_bo_reserve(aobj, false); ret = amdgpu_bo_reserve(aobj, false);
if (ret != 0) { if (ret != 0) {
drm_gem_object_put_unlocked(obj); drm_gem_object_put(obj);
return ret; return ret;
} }
...@@ -2307,7 +2307,7 @@ static int dce_v6_0_crtc_cursor_set2(struct drm_crtc *crtc, ...@@ -2307,7 +2307,7 @@ static int dce_v6_0_crtc_cursor_set2(struct drm_crtc *crtc,
amdgpu_bo_unreserve(aobj); amdgpu_bo_unreserve(aobj);
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;
} }
amdgpu_crtc->cursor_addr = amdgpu_bo_gpu_offset(aobj); amdgpu_crtc->cursor_addr = amdgpu_bo_gpu_offset(aobj);
...@@ -2342,7 +2342,7 @@ static int dce_v6_0_crtc_cursor_set2(struct drm_crtc *crtc, ...@@ -2342,7 +2342,7 @@ static int dce_v6_0_crtc_cursor_set2(struct drm_crtc *crtc,
amdgpu_bo_unpin(aobj); amdgpu_bo_unpin(aobj);
amdgpu_bo_unreserve(aobj); amdgpu_bo_unreserve(aobj);
} }
drm_gem_object_put_unlocked(amdgpu_crtc->cursor_bo); drm_gem_object_put(amdgpu_crtc->cursor_bo);
} }
amdgpu_crtc->cursor_bo = obj; amdgpu_crtc->cursor_bo = obj;
......
...@@ -2305,7 +2305,7 @@ static int dce_v8_0_crtc_cursor_set2(struct drm_crtc *crtc, ...@@ -2305,7 +2305,7 @@ static int dce_v8_0_crtc_cursor_set2(struct drm_crtc *crtc,
aobj = gem_to_amdgpu_bo(obj); aobj = gem_to_amdgpu_bo(obj);
ret = amdgpu_bo_reserve(aobj, false); ret = amdgpu_bo_reserve(aobj, false);
if (ret != 0) { if (ret != 0) {
drm_gem_object_put_unlocked(obj); drm_gem_object_put(obj);
return ret; return ret;
} }
...@@ -2313,7 +2313,7 @@ static int dce_v8_0_crtc_cursor_set2(struct drm_crtc *crtc, ...@@ -2313,7 +2313,7 @@ static int dce_v8_0_crtc_cursor_set2(struct drm_crtc *crtc,
amdgpu_bo_unreserve(aobj); amdgpu_bo_unreserve(aobj);
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;
} }
amdgpu_crtc->cursor_addr = amdgpu_bo_gpu_offset(aobj); amdgpu_crtc->cursor_addr = amdgpu_bo_gpu_offset(aobj);
...@@ -2348,7 +2348,7 @@ static int dce_v8_0_crtc_cursor_set2(struct drm_crtc *crtc, ...@@ -2348,7 +2348,7 @@ static int dce_v8_0_crtc_cursor_set2(struct drm_crtc *crtc,
amdgpu_bo_unpin(aobj); amdgpu_bo_unpin(aobj);
amdgpu_bo_unreserve(aobj); amdgpu_bo_unreserve(aobj);
} }
drm_gem_object_put_unlocked(amdgpu_crtc->cursor_bo); drm_gem_object_put(amdgpu_crtc->cursor_bo);
} }
amdgpu_crtc->cursor_bo = obj; amdgpu_crtc->cursor_bo = obj;
......
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