drm/amdgpu: switch to drm_*{get,put} helpers
authorCihangir Akturk <cakturk@gmail.com>
Thu, 3 Aug 2017 11:58:16 +0000 (14:58 +0300)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 15 Aug 2017 18:46:12 +0000 (14:46 -0400)
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: Christian König <christian.koenig@amd.com>
Signed-off-by: Cihangir Akturk <cakturk@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
drivers/gpu/drm/amd/amdgpu/dce_v8_0.c

index ccd7697792ab46d40fcd6e259b9b8088106fc262..75c6107eaccf5d5ab36dd4943e2bad7ab18a709d 100644 (file)
@@ -136,7 +136,7 @@ static int amdgpu_bo_list_set(struct amdgpu_device *adev,
                }
 
                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);
                if (usermm) {
index 381b4f99648d1caceb0875e206a9dcfe75df4d1c..da8209945ef2c7ac0e0cd97cfac059c0f4e08ae1 100644 (file)
@@ -54,7 +54,7 @@ static int amdgpu_cs_user_fence_chunk(struct amdgpu_cs_parser *p,
 
        *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)) {
                amdgpu_bo_unref(&p->uf_entry.robj);
index cdf2ab20166a2f1b86beb7a2d84e7d68cb2b5d6c..6ad243293a78b163f0c0269ad2eba78623a60811 100644 (file)
@@ -482,7 +482,7 @@ static void amdgpu_user_framebuffer_destroy(struct drm_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);
        kfree(amdgpu_fb);
 }
@@ -542,14 +542,14 @@ amdgpu_user_framebuffer_create(struct drm_device *dev,
 
        amdgpu_fb = kzalloc(sizeof(*amdgpu_fb), GFP_KERNEL);
        if (amdgpu_fb == NULL) {
-               drm_gem_object_unreference_unlocked(obj);
+               drm_gem_object_put_unlocked(obj);
                return ERR_PTR(-ENOMEM);
        }
 
        ret = amdgpu_framebuffer_init(dev, amdgpu_fb, mode_cmd, obj);
        if (ret) {
                kfree(amdgpu_fb);
-               drm_gem_object_unreference_unlocked(obj);
+               drm_gem_object_put_unlocked(obj);
                return ERR_PTR(ret);
        }
 
index cd95574705ee630773b4b186d96dedc1d202e9ab..9afa9c097e1f1012d93fa2fcd89e9fb5c8d3cffd 100644 (file)
@@ -118,7 +118,7 @@ static void amdgpufb_destroy_pinned_object(struct drm_gem_object *gobj)
                amdgpu_bo_unpin(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,
@@ -280,7 +280,7 @@ out:
 
        }
        if (fb && ret) {
-               drm_gem_object_unreference_unlocked(gobj);
+               drm_gem_object_put_unlocked(gobj);
                drm_framebuffer_unregister_private(fb);
                drm_framebuffer_cleanup(fb);
                kfree(fb);
index a227d34d38521ab714650b3c77efca4231449f73..86a88a025b17c3555c5e611fb7435b51405e64c9 100644 (file)
@@ -91,7 +91,7 @@ void amdgpu_gem_force_release(struct amdgpu_device *adev)
                spin_lock(&file->table_lock);
                idr_for_each_entry(&file->object_idr, gobj, handle) {
                        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);
                spin_unlock(&file->table_lock);
@@ -263,7 +263,7 @@ int amdgpu_gem_create_ioctl(struct drm_device *dev, void *data,
 
        r = drm_gem_handle_create(filp, gobj, &handle);
        /* drop reference from allocate - handle holds it now */
-       drm_gem_object_unreference_unlocked(gobj);
+       drm_gem_object_put_unlocked(gobj);
        if (r)
                return r;
 
@@ -341,7 +341,7 @@ int amdgpu_gem_userptr_ioctl(struct drm_device *dev, void *data,
 
        r = drm_gem_handle_create(filp, gobj, &handle);
        /* drop reference from allocate - handle holds it now */
-       drm_gem_object_unreference_unlocked(gobj);
+       drm_gem_object_put_unlocked(gobj);
        if (r)
                return r;
 
@@ -355,7 +355,7 @@ unlock_mmap_sem:
        up_read(&current->mm->mmap_sem);
 
 release_object:
-       drm_gem_object_unreference_unlocked(gobj);
+       drm_gem_object_put_unlocked(gobj);
 
        return r;
 }
@@ -374,11 +374,11 @@ int amdgpu_mode_dumb_mmap(struct drm_file *filp,
        robj = gem_to_amdgpu_bo(gobj);
        if (amdgpu_ttm_tt_get_usermm(robj->tbo.ttm) ||
            (robj->flags & AMDGPU_GEM_CREATE_NO_CPU_ACCESS)) {
-               drm_gem_object_unreference_unlocked(gobj);
+               drm_gem_object_put_unlocked(gobj);
                return -EPERM;
        }
        *offset_p = amdgpu_bo_mmap_offset(robj);
-       drm_gem_object_unreference_unlocked(gobj);
+       drm_gem_object_put_unlocked(gobj);
        return 0;
 }
 
@@ -448,7 +448,7 @@ int amdgpu_gem_wait_idle_ioctl(struct drm_device *dev, void *data,
        } else
                r = ret;
 
-       drm_gem_object_unreference_unlocked(gobj);
+       drm_gem_object_put_unlocked(gobj);
        return r;
 }
 
@@ -491,7 +491,7 @@ int amdgpu_gem_metadata_ioctl(struct drm_device *dev, void *data,
 unreserve:
        amdgpu_bo_unreserve(robj);
 out:
-       drm_gem_object_unreference_unlocked(gobj);
+       drm_gem_object_put_unlocked(gobj);
        return r;
 }
 
@@ -664,7 +664,7 @@ error_backoff:
        ttm_eu_backoff_reservation(&ticket, &list);
 
 error_unref:
-       drm_gem_object_unreference_unlocked(gobj);
+       drm_gem_object_put_unlocked(gobj);
        return r;
 }
 
@@ -726,7 +726,7 @@ int amdgpu_gem_op_ioctl(struct drm_device *dev, void *data,
        }
 
 out:
-       drm_gem_object_unreference_unlocked(gobj);
+       drm_gem_object_put_unlocked(gobj);
        return r;
 }
 
@@ -754,7 +754,7 @@ int amdgpu_mode_dumb_create(struct drm_file *file_priv,
 
        r = drm_gem_handle_create(file_priv, gobj, &handle);
        /* drop reference from allocate - handle holds it now */
-       drm_gem_object_unreference_unlocked(gobj);
+       drm_gem_object_put_unlocked(gobj);
        if (r) {
                return r;
        }
index 490e84944851efae302b6d9699ace14b90a9f291..4e519dc4291616912ed0622698cb8720fb89aa40 100644 (file)
@@ -2431,7 +2431,7 @@ static int dce_v10_0_crtc_cursor_set2(struct drm_crtc *crtc,
        aobj = gem_to_amdgpu_bo(obj);
        ret = amdgpu_bo_reserve(aobj, false);
        if (ret != 0) {
-               drm_gem_object_unreference_unlocked(obj);
+               drm_gem_object_put_unlocked(obj);
                return ret;
        }
 
@@ -2439,7 +2439,7 @@ static int dce_v10_0_crtc_cursor_set2(struct drm_crtc *crtc,
        amdgpu_bo_unreserve(aobj);
        if (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;
        }
 
@@ -2473,7 +2473,7 @@ unpin:
                        amdgpu_bo_unpin(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;
index 921c6f772f11d3636bba41ae3d028ce5e88a231d..11edc75edaa99603c40d6986caf3fa8a5b94ff25 100644 (file)
@@ -2506,7 +2506,7 @@ static int dce_v11_0_crtc_cursor_set2(struct drm_crtc *crtc,
        aobj = gem_to_amdgpu_bo(obj);
        ret = amdgpu_bo_reserve(aobj, false);
        if (ret != 0) {
-               drm_gem_object_unreference_unlocked(obj);
+               drm_gem_object_put_unlocked(obj);
                return ret;
        }
 
@@ -2514,7 +2514,7 @@ static int dce_v11_0_crtc_cursor_set2(struct drm_crtc *crtc,
        amdgpu_bo_unreserve(aobj);
        if (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;
        }
 
@@ -2548,7 +2548,7 @@ unpin:
                        amdgpu_bo_unpin(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;
index 8ad0a659f789ae7ef482bc8539a211a6b3c117d1..a51e35f824a1a3211a0a6ccc5029dec78cdccff5 100644 (file)
@@ -2322,7 +2322,7 @@ static int dce_v6_0_crtc_cursor_set2(struct drm_crtc *crtc,
        aobj = gem_to_amdgpu_bo(obj);
        ret = amdgpu_bo_reserve(aobj, false);
        if (ret != 0) {
-               drm_gem_object_unreference_unlocked(obj);
+               drm_gem_object_put_unlocked(obj);
                return ret;
        }
 
@@ -2330,7 +2330,7 @@ static int dce_v6_0_crtc_cursor_set2(struct drm_crtc *crtc,
        amdgpu_bo_unreserve(aobj);
        if (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;
        }
 
@@ -2364,7 +2364,7 @@ unpin:
                        amdgpu_bo_unpin(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;
index 609438fe8584d17598d9e11013ab9b95e44a8825..9cf14b8b2db9b594ccd36085e29632ca511f4137 100644 (file)
@@ -2335,7 +2335,7 @@ static int dce_v8_0_crtc_cursor_set2(struct drm_crtc *crtc,
        aobj = gem_to_amdgpu_bo(obj);
        ret = amdgpu_bo_reserve(aobj, false);
        if (ret != 0) {
-               drm_gem_object_unreference_unlocked(obj);
+               drm_gem_object_put_unlocked(obj);
                return ret;
        }
 
@@ -2343,7 +2343,7 @@ static int dce_v8_0_crtc_cursor_set2(struct drm_crtc *crtc,
        amdgpu_bo_unreserve(aobj);
        if (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;
        }
 
@@ -2377,7 +2377,7 @@ unpin:
                        amdgpu_bo_unpin(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;