Commit f62facc2 authored by Cihangir Akturk's avatar Cihangir Akturk Committed by Alex Deucher

drm/amdgpu: switch to drm_*{get,put} helpers

drm_*_reference() and drm_*_unreference() functions are just
compatibility alias for drm_*_get() and drm_*_put() and should not be
used by new code. So convert all users of compatibility functions to use
the new APIs.
Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
Signed-off-by: default avatarCihangir Akturk <cakturk@gmail.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent d45aec05
...@@ -136,7 +136,7 @@ static int amdgpu_bo_list_set(struct amdgpu_device *adev, ...@@ -136,7 +136,7 @@ static int amdgpu_bo_list_set(struct amdgpu_device *adev,
} }
bo = amdgpu_bo_ref(gem_to_amdgpu_bo(gobj)); bo = amdgpu_bo_ref(gem_to_amdgpu_bo(gobj));
drm_gem_object_unreference_unlocked(gobj); drm_gem_object_put_unlocked(gobj);
usermm = amdgpu_ttm_tt_get_usermm(bo->tbo.ttm); usermm = amdgpu_ttm_tt_get_usermm(bo->tbo.ttm);
if (usermm) { if (usermm) {
......
...@@ -54,7 +54,7 @@ static int amdgpu_cs_user_fence_chunk(struct amdgpu_cs_parser *p, ...@@ -54,7 +54,7 @@ static int amdgpu_cs_user_fence_chunk(struct amdgpu_cs_parser *p,
*offset = data->offset; *offset = data->offset;
drm_gem_object_unreference_unlocked(gobj); drm_gem_object_put_unlocked(gobj);
if (amdgpu_ttm_tt_get_usermm(p->uf_entry.robj->tbo.ttm)) { if (amdgpu_ttm_tt_get_usermm(p->uf_entry.robj->tbo.ttm)) {
amdgpu_bo_unref(&p->uf_entry.robj); amdgpu_bo_unref(&p->uf_entry.robj);
......
...@@ -482,7 +482,7 @@ static void amdgpu_user_framebuffer_destroy(struct drm_framebuffer *fb) ...@@ -482,7 +482,7 @@ static void amdgpu_user_framebuffer_destroy(struct drm_framebuffer *fb)
{ {
struct amdgpu_framebuffer *amdgpu_fb = to_amdgpu_framebuffer(fb); struct amdgpu_framebuffer *amdgpu_fb = to_amdgpu_framebuffer(fb);
drm_gem_object_unreference_unlocked(amdgpu_fb->obj); drm_gem_object_put_unlocked(amdgpu_fb->obj);
drm_framebuffer_cleanup(fb); drm_framebuffer_cleanup(fb);
kfree(amdgpu_fb); kfree(amdgpu_fb);
} }
...@@ -542,14 +542,14 @@ amdgpu_user_framebuffer_create(struct drm_device *dev, ...@@ -542,14 +542,14 @@ amdgpu_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_unreference_unlocked(obj); drm_gem_object_put_unlocked(obj);
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
} }
ret = amdgpu_framebuffer_init(dev, amdgpu_fb, mode_cmd, obj); ret = amdgpu_framebuffer_init(dev, amdgpu_fb, mode_cmd, obj);
if (ret) { if (ret) {
kfree(amdgpu_fb); kfree(amdgpu_fb);
drm_gem_object_unreference_unlocked(obj); drm_gem_object_put_unlocked(obj);
return ERR_PTR(ret); return ERR_PTR(ret);
} }
......
...@@ -118,7 +118,7 @@ static void amdgpufb_destroy_pinned_object(struct drm_gem_object *gobj) ...@@ -118,7 +118,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_unreference_unlocked(gobj); drm_gem_object_put_unlocked(gobj);
} }
static int amdgpufb_create_pinned_object(struct amdgpu_fbdev *rfbdev, static int amdgpufb_create_pinned_object(struct amdgpu_fbdev *rfbdev,
...@@ -280,7 +280,7 @@ static int amdgpufb_create(struct drm_fb_helper *helper, ...@@ -280,7 +280,7 @@ static int amdgpufb_create(struct drm_fb_helper *helper,
} }
if (fb && ret) { if (fb && ret) {
drm_gem_object_unreference_unlocked(gobj); drm_gem_object_put_unlocked(gobj);
drm_framebuffer_unregister_private(fb); drm_framebuffer_unregister_private(fb);
drm_framebuffer_cleanup(fb); drm_framebuffer_cleanup(fb);
kfree(fb); kfree(fb);
......
...@@ -91,7 +91,7 @@ void amdgpu_gem_force_release(struct amdgpu_device *adev) ...@@ -91,7 +91,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_unreference_unlocked(gobj); drm_gem_object_put_unlocked(gobj);
} }
idr_destroy(&file->object_idr); idr_destroy(&file->object_idr);
spin_unlock(&file->table_lock); spin_unlock(&file->table_lock);
...@@ -263,7 +263,7 @@ int amdgpu_gem_create_ioctl(struct drm_device *dev, void *data, ...@@ -263,7 +263,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_unreference_unlocked(gobj); drm_gem_object_put_unlocked(gobj);
if (r) if (r)
return r; return r;
...@@ -341,7 +341,7 @@ int amdgpu_gem_userptr_ioctl(struct drm_device *dev, void *data, ...@@ -341,7 +341,7 @@ int amdgpu_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_unreference_unlocked(gobj); drm_gem_object_put_unlocked(gobj);
if (r) if (r)
return r; return r;
...@@ -355,7 +355,7 @@ int amdgpu_gem_userptr_ioctl(struct drm_device *dev, void *data, ...@@ -355,7 +355,7 @@ int amdgpu_gem_userptr_ioctl(struct drm_device *dev, void *data,
up_read(&current->mm->mmap_sem); up_read(&current->mm->mmap_sem);
release_object: release_object:
drm_gem_object_unreference_unlocked(gobj); drm_gem_object_put_unlocked(gobj);
return r; return r;
} }
...@@ -374,11 +374,11 @@ int amdgpu_mode_dumb_mmap(struct drm_file *filp, ...@@ -374,11 +374,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_unreference_unlocked(gobj); drm_gem_object_put_unlocked(gobj);
return -EPERM; return -EPERM;
} }
*offset_p = amdgpu_bo_mmap_offset(robj); *offset_p = amdgpu_bo_mmap_offset(robj);
drm_gem_object_unreference_unlocked(gobj); drm_gem_object_put_unlocked(gobj);
return 0; return 0;
} }
...@@ -448,7 +448,7 @@ int amdgpu_gem_wait_idle_ioctl(struct drm_device *dev, void *data, ...@@ -448,7 +448,7 @@ int amdgpu_gem_wait_idle_ioctl(struct drm_device *dev, void *data,
} else } else
r = ret; r = ret;
drm_gem_object_unreference_unlocked(gobj); drm_gem_object_put_unlocked(gobj);
return r; return r;
} }
...@@ -491,7 +491,7 @@ int amdgpu_gem_metadata_ioctl(struct drm_device *dev, void *data, ...@@ -491,7 +491,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_unreference_unlocked(gobj); drm_gem_object_put_unlocked(gobj);
return r; return r;
} }
...@@ -664,7 +664,7 @@ int amdgpu_gem_va_ioctl(struct drm_device *dev, void *data, ...@@ -664,7 +664,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_unreference_unlocked(gobj); drm_gem_object_put_unlocked(gobj);
return r; return r;
} }
...@@ -726,7 +726,7 @@ int amdgpu_gem_op_ioctl(struct drm_device *dev, void *data, ...@@ -726,7 +726,7 @@ int amdgpu_gem_op_ioctl(struct drm_device *dev, void *data,
} }
out: out:
drm_gem_object_unreference_unlocked(gobj); drm_gem_object_put_unlocked(gobj);
return r; return r;
} }
...@@ -754,7 +754,7 @@ int amdgpu_mode_dumb_create(struct drm_file *file_priv, ...@@ -754,7 +754,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_unreference_unlocked(gobj); drm_gem_object_put_unlocked(gobj);
if (r) { if (r) {
return r; return r;
} }
......
...@@ -2431,7 +2431,7 @@ static int dce_v10_0_crtc_cursor_set2(struct drm_crtc *crtc, ...@@ -2431,7 +2431,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_unreference_unlocked(obj); drm_gem_object_put_unlocked(obj);
return ret; return ret;
} }
...@@ -2439,7 +2439,7 @@ static int dce_v10_0_crtc_cursor_set2(struct drm_crtc *crtc, ...@@ -2439,7 +2439,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_unreference_unlocked(obj); drm_gem_object_put_unlocked(obj);
return ret; return ret;
} }
...@@ -2473,7 +2473,7 @@ static int dce_v10_0_crtc_cursor_set2(struct drm_crtc *crtc, ...@@ -2473,7 +2473,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_unreference_unlocked(amdgpu_crtc->cursor_bo); drm_gem_object_put_unlocked(amdgpu_crtc->cursor_bo);
} }
amdgpu_crtc->cursor_bo = obj; amdgpu_crtc->cursor_bo = obj;
......
...@@ -2506,7 +2506,7 @@ static int dce_v11_0_crtc_cursor_set2(struct drm_crtc *crtc, ...@@ -2506,7 +2506,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_unreference_unlocked(obj); drm_gem_object_put_unlocked(obj);
return ret; return ret;
} }
...@@ -2514,7 +2514,7 @@ static int dce_v11_0_crtc_cursor_set2(struct drm_crtc *crtc, ...@@ -2514,7 +2514,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_unreference_unlocked(obj); drm_gem_object_put_unlocked(obj);
return ret; return ret;
} }
...@@ -2548,7 +2548,7 @@ static int dce_v11_0_crtc_cursor_set2(struct drm_crtc *crtc, ...@@ -2548,7 +2548,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_unreference_unlocked(amdgpu_crtc->cursor_bo); drm_gem_object_put_unlocked(amdgpu_crtc->cursor_bo);
} }
amdgpu_crtc->cursor_bo = obj; amdgpu_crtc->cursor_bo = obj;
......
...@@ -2322,7 +2322,7 @@ static int dce_v6_0_crtc_cursor_set2(struct drm_crtc *crtc, ...@@ -2322,7 +2322,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_unreference_unlocked(obj); drm_gem_object_put_unlocked(obj);
return ret; return ret;
} }
...@@ -2330,7 +2330,7 @@ static int dce_v6_0_crtc_cursor_set2(struct drm_crtc *crtc, ...@@ -2330,7 +2330,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_unreference_unlocked(obj); drm_gem_object_put_unlocked(obj);
return ret; return ret;
} }
...@@ -2364,7 +2364,7 @@ static int dce_v6_0_crtc_cursor_set2(struct drm_crtc *crtc, ...@@ -2364,7 +2364,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_unreference_unlocked(amdgpu_crtc->cursor_bo); drm_gem_object_put_unlocked(amdgpu_crtc->cursor_bo);
} }
amdgpu_crtc->cursor_bo = obj; amdgpu_crtc->cursor_bo = obj;
......
...@@ -2335,7 +2335,7 @@ static int dce_v8_0_crtc_cursor_set2(struct drm_crtc *crtc, ...@@ -2335,7 +2335,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_unreference_unlocked(obj); drm_gem_object_put_unlocked(obj);
return ret; return ret;
} }
...@@ -2343,7 +2343,7 @@ static int dce_v8_0_crtc_cursor_set2(struct drm_crtc *crtc, ...@@ -2343,7 +2343,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_unreference_unlocked(obj); drm_gem_object_put_unlocked(obj);
return ret; return ret;
} }
...@@ -2377,7 +2377,7 @@ static int dce_v8_0_crtc_cursor_set2(struct drm_crtc *crtc, ...@@ -2377,7 +2377,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_unreference_unlocked(amdgpu_crtc->cursor_bo); drm_gem_object_put_unlocked(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