Commit 7664b2fa authored by Cihangir Akturk's avatar Cihangir Akturk Committed by Thierry Reding

drm/tegra: switch to drm_*_get(), drm_*_put() helpers

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: default avatarCihangir Akturk <cakturk@gmail.com>
Signed-off-by: default avatarThierry Reding <treding@nvidia.com>
parent 788ff4b6
...@@ -304,7 +304,7 @@ host1x_bo_lookup(struct drm_file *file, u32 handle) ...@@ -304,7 +304,7 @@ host1x_bo_lookup(struct drm_file *file, u32 handle)
if (!gem) if (!gem)
return NULL; return NULL;
drm_gem_object_unreference_unlocked(gem); drm_gem_object_put_unlocked(gem);
bo = to_tegra_bo(gem); bo = to_tegra_bo(gem);
return &bo->base; return &bo->base;
...@@ -591,7 +591,7 @@ static int tegra_gem_mmap(struct drm_device *drm, void *data, ...@@ -591,7 +591,7 @@ static int tegra_gem_mmap(struct drm_device *drm, void *data,
args->offset = drm_vma_node_offset_addr(&bo->gem.vma_node); args->offset = drm_vma_node_offset_addr(&bo->gem.vma_node);
drm_gem_object_unreference_unlocked(gem); drm_gem_object_put_unlocked(gem);
return 0; return 0;
} }
...@@ -858,7 +858,7 @@ static int tegra_gem_set_tiling(struct drm_device *drm, void *data, ...@@ -858,7 +858,7 @@ static int tegra_gem_set_tiling(struct drm_device *drm, void *data,
bo->tiling.mode = mode; bo->tiling.mode = mode;
bo->tiling.value = value; bo->tiling.value = value;
drm_gem_object_unreference_unlocked(gem); drm_gem_object_put_unlocked(gem);
return 0; return 0;
} }
...@@ -898,7 +898,7 @@ static int tegra_gem_get_tiling(struct drm_device *drm, void *data, ...@@ -898,7 +898,7 @@ static int tegra_gem_get_tiling(struct drm_device *drm, void *data,
break; break;
} }
drm_gem_object_unreference_unlocked(gem); drm_gem_object_put_unlocked(gem);
return err; return err;
} }
...@@ -923,7 +923,7 @@ static int tegra_gem_set_flags(struct drm_device *drm, void *data, ...@@ -923,7 +923,7 @@ static int tegra_gem_set_flags(struct drm_device *drm, void *data,
if (args->flags & DRM_TEGRA_GEM_BOTTOM_UP) if (args->flags & DRM_TEGRA_GEM_BOTTOM_UP)
bo->flags |= TEGRA_BO_BOTTOM_UP; bo->flags |= TEGRA_BO_BOTTOM_UP;
drm_gem_object_unreference_unlocked(gem); drm_gem_object_put_unlocked(gem);
return 0; return 0;
} }
...@@ -945,7 +945,7 @@ static int tegra_gem_get_flags(struct drm_device *drm, void *data, ...@@ -945,7 +945,7 @@ static int tegra_gem_get_flags(struct drm_device *drm, void *data,
if (bo->flags & TEGRA_BO_BOTTOM_UP) if (bo->flags & TEGRA_BO_BOTTOM_UP)
args->flags |= DRM_TEGRA_GEM_BOTTOM_UP; args->flags |= DRM_TEGRA_GEM_BOTTOM_UP;
drm_gem_object_unreference_unlocked(gem); drm_gem_object_put_unlocked(gem);
return 0; return 0;
} }
......
...@@ -88,7 +88,7 @@ static void tegra_fb_destroy(struct drm_framebuffer *framebuffer) ...@@ -88,7 +88,7 @@ static void tegra_fb_destroy(struct drm_framebuffer *framebuffer)
if (bo->pages) if (bo->pages)
vunmap(bo->vaddr); vunmap(bo->vaddr);
drm_gem_object_unreference_unlocked(&bo->gem); drm_gem_object_put_unlocked(&bo->gem);
} }
} }
...@@ -195,7 +195,7 @@ struct drm_framebuffer *tegra_fb_create(struct drm_device *drm, ...@@ -195,7 +195,7 @@ struct drm_framebuffer *tegra_fb_create(struct drm_device *drm,
unreference: unreference:
while (i--) while (i--)
drm_gem_object_unreference_unlocked(&planes[i]->gem); drm_gem_object_put_unlocked(&planes[i]->gem);
return ERR_PTR(err); return ERR_PTR(err);
} }
...@@ -242,7 +242,7 @@ static int tegra_fbdev_probe(struct drm_fb_helper *helper, ...@@ -242,7 +242,7 @@ static int tegra_fbdev_probe(struct drm_fb_helper *helper,
info = drm_fb_helper_alloc_fbi(helper); info = drm_fb_helper_alloc_fbi(helper);
if (IS_ERR(info)) { if (IS_ERR(info)) {
dev_err(drm->dev, "failed to allocate framebuffer info\n"); dev_err(drm->dev, "failed to allocate framebuffer info\n");
drm_gem_object_unreference_unlocked(&bo->gem); drm_gem_object_put_unlocked(&bo->gem);
return PTR_ERR(info); return PTR_ERR(info);
} }
...@@ -251,7 +251,7 @@ static int tegra_fbdev_probe(struct drm_fb_helper *helper, ...@@ -251,7 +251,7 @@ static int tegra_fbdev_probe(struct drm_fb_helper *helper,
err = PTR_ERR(fbdev->fb); err = PTR_ERR(fbdev->fb);
dev_err(drm->dev, "failed to allocate DRM framebuffer: %d\n", dev_err(drm->dev, "failed to allocate DRM framebuffer: %d\n",
err); err);
drm_gem_object_unreference_unlocked(&bo->gem); drm_gem_object_put_unlocked(&bo->gem);
return PTR_ERR(fbdev->fb); return PTR_ERR(fbdev->fb);
} }
......
...@@ -24,7 +24,7 @@ static void tegra_bo_put(struct host1x_bo *bo) ...@@ -24,7 +24,7 @@ static void tegra_bo_put(struct host1x_bo *bo)
{ {
struct tegra_bo *obj = host1x_to_tegra_bo(bo); struct tegra_bo *obj = host1x_to_tegra_bo(bo);
drm_gem_object_unreference_unlocked(&obj->gem); drm_gem_object_put_unlocked(&obj->gem);
} }
static dma_addr_t tegra_bo_pin(struct host1x_bo *bo, struct sg_table **sgt) static dma_addr_t tegra_bo_pin(struct host1x_bo *bo, struct sg_table **sgt)
...@@ -95,7 +95,7 @@ static struct host1x_bo *tegra_bo_get(struct host1x_bo *bo) ...@@ -95,7 +95,7 @@ static struct host1x_bo *tegra_bo_get(struct host1x_bo *bo)
{ {
struct tegra_bo *obj = host1x_to_tegra_bo(bo); struct tegra_bo *obj = host1x_to_tegra_bo(bo);
drm_gem_object_reference(&obj->gem); drm_gem_object_get(&obj->gem);
return bo; return bo;
} }
...@@ -325,7 +325,7 @@ struct tegra_bo *tegra_bo_create_with_handle(struct drm_file *file, ...@@ -325,7 +325,7 @@ struct tegra_bo *tegra_bo_create_with_handle(struct drm_file *file,
return ERR_PTR(err); return ERR_PTR(err);
} }
drm_gem_object_unreference_unlocked(&bo->gem); drm_gem_object_put_unlocked(&bo->gem);
return bo; return bo;
} }
...@@ -439,7 +439,7 @@ int tegra_bo_dumb_map_offset(struct drm_file *file, struct drm_device *drm, ...@@ -439,7 +439,7 @@ int tegra_bo_dumb_map_offset(struct drm_file *file, struct drm_device *drm,
*offset = drm_vma_node_offset_addr(&bo->gem.vma_node); *offset = drm_vma_node_offset_addr(&bo->gem.vma_node);
drm_gem_object_unreference_unlocked(gem); drm_gem_object_put_unlocked(gem);
return 0; return 0;
} }
...@@ -654,7 +654,7 @@ struct drm_gem_object *tegra_gem_prime_import(struct drm_device *drm, ...@@ -654,7 +654,7 @@ struct drm_gem_object *tegra_gem_prime_import(struct drm_device *drm,
struct drm_gem_object *gem = buf->priv; struct drm_gem_object *gem = buf->priv;
if (gem->dev == drm) { if (gem->dev == drm) {
drm_gem_object_reference(gem); drm_gem_object_get(gem);
return gem; return gem;
} }
} }
......
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