Re: [PATCH v3 04/28] drm/ast: switch to drm_*_get(), drm_*_put() helpers

From: Sean Paul
Date: Fri Aug 11 2017 - 12:02:12 EST


On Fri, Aug 11, 2017 at 03:32:50PM +0300, Cihangir Akturk wrote:
> Use drm_*_get() and drm_*_put() helpers instead of drm_*_reference()
> and drm_*_unreference() 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.
>
> Generated by: scripts/coccinelle/api/drm-get-put.cocci
>
> Signed-off-by: Cihangir Akturk <cakturk@xxxxxxxxx>
> Acked-by: Joel Stanley <joel@xxxxxxxxx>

Applied to drm-misc-next, thank you!

Sean

> ---
> drivers/gpu/drm/ast/ast_fb.c | 2 +-
> drivers/gpu/drm/ast/ast_main.c | 10 +++++-----
> drivers/gpu/drm/ast/ast_mode.c | 6 +++---
> 3 files changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/ast/ast_fb.c b/drivers/gpu/drm/ast/ast_fb.c
> index 9052ebe..0cd827e 100644
> --- a/drivers/gpu/drm/ast/ast_fb.c
> +++ b/drivers/gpu/drm/ast/ast_fb.c
> @@ -266,7 +266,7 @@ static void ast_fbdev_destroy(struct drm_device *dev,
> drm_fb_helper_unregister_fbi(&afbdev->helper);
>
> if (afb->obj) {
> - drm_gem_object_unreference_unlocked(afb->obj);
> + drm_gem_object_put_unlocked(afb->obj);
> afb->obj = NULL;
> }
> drm_fb_helper_fini(&afbdev->helper);
> diff --git a/drivers/gpu/drm/ast/ast_main.c b/drivers/gpu/drm/ast/ast_main.c
> index 262c2c0..cb05e8e 100644
> --- a/drivers/gpu/drm/ast/ast_main.c
> +++ b/drivers/gpu/drm/ast/ast_main.c
> @@ -387,7 +387,7 @@ static void ast_user_framebuffer_destroy(struct drm_framebuffer *fb)
> {
> struct ast_framebuffer *ast_fb = to_ast_framebuffer(fb);
>
> - drm_gem_object_unreference_unlocked(ast_fb->obj);
> + drm_gem_object_put_unlocked(ast_fb->obj);
> drm_framebuffer_cleanup(fb);
> kfree(fb);
> }
> @@ -429,13 +429,13 @@ ast_user_framebuffer_create(struct drm_device *dev,
>
> ast_fb = kzalloc(sizeof(*ast_fb), GFP_KERNEL);
> if (!ast_fb) {
> - drm_gem_object_unreference_unlocked(obj);
> + drm_gem_object_put_unlocked(obj);
> return ERR_PTR(-ENOMEM);
> }
>
> ret = ast_framebuffer_init(dev, ast_fb, mode_cmd, obj);
> if (ret) {
> - drm_gem_object_unreference_unlocked(obj);
> + drm_gem_object_put_unlocked(obj);
> kfree(ast_fb);
> return ERR_PTR(ret);
> }
> @@ -627,7 +627,7 @@ int ast_dumb_create(struct drm_file *file,
> return ret;
>
> ret = drm_gem_handle_create(file, gobj, &handle);
> - drm_gem_object_unreference_unlocked(gobj);
> + drm_gem_object_put_unlocked(gobj);
> if (ret)
> return ret;
>
> @@ -675,7 +675,7 @@ ast_dumb_mmap_offset(struct drm_file *file,
> bo = gem_to_ast_bo(obj);
> *offset = ast_bo_mmap_offset(bo);
>
> - drm_gem_object_unreference_unlocked(obj);
> + drm_gem_object_put_unlocked(obj);
>
> return 0;
>
> diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c
> index 724c16b..fea790b 100644
> --- a/drivers/gpu/drm/ast/ast_mode.c
> +++ b/drivers/gpu/drm/ast/ast_mode.c
> @@ -934,7 +934,7 @@ static void ast_cursor_fini(struct drm_device *dev)
> {
> struct ast_private *ast = dev->dev_private;
> ttm_bo_kunmap(&ast->cache_kmap);
> - drm_gem_object_unreference_unlocked(ast->cursor_cache);
> + drm_gem_object_put_unlocked(ast->cursor_cache);
> }
>
> int ast_mode_init(struct drm_device *dev)
> @@ -1199,10 +1199,10 @@ static int ast_cursor_set(struct drm_crtc *crtc,
>
> ast_show_cursor(crtc);
>
> - drm_gem_object_unreference_unlocked(obj);
> + drm_gem_object_put_unlocked(obj);
> return 0;
> fail:
> - drm_gem_object_unreference_unlocked(obj);
> + drm_gem_object_put_unlocked(obj);
> return ret;
> }
>
> --
> 2.7.4
>

--
Sean Paul, Software Engineer, Google / Chromium OS