2017-08-11 12:33:35

by Cihangir Akturk

[permalink] [raw]
Subject: [PATCH v3 00/28] DRM API Conversions

Changes since v2:

- Patch series is based on *drm-misc-next* as suggested by Sean Paul.

- Dropped patch 05 (drm/atmel-hlcdc) and patch 25 (drm/vc4) from v2,
since they were already pulled in the drm-misc-next

Changes since v1:

- This time patches were generated with coccinelle instead of my own
script, as suggested by Daniel Vetter.

- Fixed the typo in commit messages. s/adn/and

Note: I've included r-b, a-b tags, as these patches are identical to v1
except for the file: drivers/gpu/drm/i915/i915_gem_object.h

This patch set replaces the occurrences of drm_*_reference() and
drm_*_unreference() with the new drm_*_get() and drm_*_put() functions.
All patches in the series do the same thing, converting to the new APIs.
I created patches per DRM driver as suggested by Daniel Vetter.

This patch set was generated by scripts/coccinelle/api/drm-get-put.cocci

Previous thread can be reached at:
https://marc.info/?l=dri-devel&m=150178288816047

Background:

In the kernel, reference counting APIs use *_get(), *_put() style naming
to reference-count the objects. But DRM subsystem uses a different
naming for them such as *_reference(), *_unreference() which is
inconsistent with the other reference counting APIs in the kernel. To
solve this consistency issue, Thierry Reding introduced a couple of
functions and compatibility aliases in the following commits for them.

commit 020a218f95bd3ceff7dd1022ff7ebc0497bc7bf9
Author: Thierry Reding <[email protected]>
Date: Tue Feb 28 15:46:38 2017 +0100

drm: Introduce drm_mode_object_{get,put}()

commit ad09360750afa18a0a0ce0253d6ea6033abc22e7
Author: Thierry Reding <[email protected]>
Date: Tue Feb 28 15:46:39 2017 +0100

drm: Introduce drm_connector_{get,put}()

commit a4a69da06bc11a937a6e417938b1bb698ee1fa46
Author: Thierry Reding <[email protected]>
Date: Tue Feb 28 15:46:40 2017 +0100

drm: Introduce drm_framebuffer_{get,put}()

commit e6b62714e87c8811d5564b6a0738dcde63a51774
Author: Thierry Reding <[email protected]>
Date: Tue Feb 28 15:46:41 2017 +0100

drm: Introduce drm_gem_object_{get,put}()

commit 6472e5090be7c78749a3c279b4faae87ab835c40
Author: Thierry Reding <[email protected]>
Date: Tue Feb 28 15:46:42 2017 +0100

drm: Introduce drm_property_blob_{get,put}()

Cihangir Akturk (28):
drm/amdgpu: switch to drm_*_get(), drm_*_put() helpers
drm: mali-dp: switch to drm_*_get(), drm_*_put() helpers
drm/armada: switch to drm_*_get(), drm_*_put() helpers
drm/ast: switch to drm_*_get(), drm_*_put() helpers
drm/bochs: switch to drm_*_get(), drm_*_put() helpers
drm/cirrus: switch to drm_*_get(), drm_*_put() helpers
drm/etnaviv: switch to drm_*_get(), drm_*_put() helpers
drm/exynos: switch to drm_*_get(), drm_*_put() helpers
drm/gma500: switch to drm_*_get(), drm_*_put() helpers
drm/hisilicon: switch to drm_*_get(), drm_*_put() helpers
drm/i915: switch to drm_*_get(), drm_*_put() helpers
drm/imx: switch to drm_*_get(), drm_*_put() helpers
drm/mediatek: switch to drm_*_get(), drm_*_put() helpers
drm/mgag200: switch to drm_*_get(), drm_*_put() helpers
drm/msm: switch to drm_*_get(), drm_*_put() helpers
drm/nouveau: switch to drm_*_get(), drm_*_put() helpers
drm/omapdrm: switch to drm_*_get(), drm_*_put() helpers
drm/qxl: switch to drm_*_get(), drm_*_put() helpers
drm/radeon: switch to drm_*_get(), drm_*_put() helpers
drm/rockchip: switch to drm_*_get(), drm_*_put() helpers
drm/tegra: switch to drm_*_get(), drm_*_put() helpers
drm/tilcdc: switch to drm_*_get(), drm_*_put() helpers
drm/udl: switch to drm_*_get(), drm_*_put() helpers
drm/vc4: switch to drm_*_get(), drm_*_put() helpers
drm/vgem: switch to drm_*_get(), drm_*_put() helpers
drm/virtio: switch to drm_*_get(), drm_*_put() helpers
drm/vmwgfx: switch to drm_*_get(), drm_*_put() helpers
drm: vboxvideo: switch to drm_*_get(), drm_*_put() helpers

drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c | 2 +-
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 2 +-
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 6 ++---
drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c | 4 +--
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 22 ++++++++---------
drivers/gpu/drm/amd/amdgpu/dce_v10_0.c | 6 ++---
drivers/gpu/drm/amd/amdgpu/dce_v11_0.c | 6 ++---
drivers/gpu/drm/amd/amdgpu/dce_v6_0.c | 6 ++---
drivers/gpu/drm/amd/amdgpu/dce_v8_0.c | 6 ++---
drivers/gpu/drm/arm/malidp_planes.c | 2 +-
drivers/gpu/drm/armada/armada_crtc.c | 22 ++++++++---------
drivers/gpu/drm/armada/armada_drv.c | 2 +-
drivers/gpu/drm/armada/armada_fb.c | 8 +++---
drivers/gpu/drm/armada/armada_fbdev.c | 6 ++---
drivers/gpu/drm/armada/armada_gem.c | 14 +++++------
drivers/gpu/drm/armada/armada_overlay.c | 4 +--
drivers/gpu/drm/ast/ast_fb.c | 2 +-
drivers/gpu/drm/ast/ast_main.c | 10 ++++----
drivers/gpu/drm/ast/ast_mode.c | 6 ++---
drivers/gpu/drm/bochs/bochs_fbdev.c | 2 +-
drivers/gpu/drm/bochs/bochs_mm.c | 10 ++++----
drivers/gpu/drm/cirrus/cirrus_fbdev.c | 2 +-
drivers/gpu/drm/cirrus/cirrus_main.c | 10 ++++----
drivers/gpu/drm/etnaviv/etnaviv_drv.c | 8 +++---
drivers/gpu/drm/etnaviv/etnaviv_gem.c | 20 +++++++--------
drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c | 2 +-
drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c | 4 +--
drivers/gpu/drm/exynos/exynos_drm_fb.c | 4 +--
drivers/gpu/drm/exynos/exynos_drm_gem.c | 12 ++++-----
drivers/gpu/drm/exynos/exynos_drm_plane.c | 2 +-
drivers/gpu/drm/gma500/framebuffer.c | 4 +--
drivers/gpu/drm/gma500/gem.c | 4 +--
drivers/gpu/drm/gma500/gma_display.c | 6 ++---
drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_fbdev.c | 4 +--
drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c | 8 +++---
drivers/gpu/drm/i915/i915_gem_object.h | 4 +--
drivers/gpu/drm/i915/intel_display.c | 24 +++++++++---------
drivers/gpu/drm/i915/intel_dp_mst.c | 2 +-
drivers/gpu/drm/i915/intel_fbdev.c | 4 +--
drivers/gpu/drm/imx/ipuv3-crtc.c | 2 +-
drivers/gpu/drm/mediatek/mtk_drm_fb.c | 4 +--
drivers/gpu/drm/mediatek/mtk_drm_gem.c | 2 +-
drivers/gpu/drm/mgag200/mgag200_cursor.c | 2 +-
drivers/gpu/drm/mgag200/mgag200_fb.c | 4 +--
drivers/gpu/drm/mgag200/mgag200_main.c | 10 ++++----
drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 10 ++++----
drivers/gpu/drm/msm/adreno/a5xx_power.c | 2 +-
drivers/gpu/drm/msm/adreno/adreno_gpu.c | 2 +-
drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c | 6 ++---
drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c | 2 +-
drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c | 2 +-
drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c | 4 +--
drivers/gpu/drm/msm/msm_drv.c | 8 +++---
drivers/gpu/drm/msm/msm_fb.c | 4 +--
drivers/gpu/drm/msm/msm_fbdev.c | 2 +-
drivers/gpu/drm/msm/msm_gem.c | 8 +++---
drivers/gpu/drm/msm/msm_gem_submit.c | 4 +--
drivers/gpu/drm/msm/msm_gpu.c | 4 +--
drivers/gpu/drm/msm/msm_ringbuffer.c | 2 +-
drivers/gpu/drm/nouveau/dispnv04/crtc.c | 2 +-
drivers/gpu/drm/nouveau/nouveau_abi16.c | 2 +-
drivers/gpu/drm/nouveau/nouveau_display.c | 8 +++---
drivers/gpu/drm/nouveau/nouveau_fbcon.c | 2 +-
drivers/gpu/drm/nouveau/nouveau_gem.c | 14 +++++------
drivers/gpu/drm/nouveau/nv50_display.c | 2 +-
drivers/gpu/drm/omapdrm/omap_drv.c | 2 +-
drivers/gpu/drm/omapdrm/omap_fb.c | 4 +--
drivers/gpu/drm/omapdrm/omap_fbdev.c | 2 +-
drivers/gpu/drm/omapdrm/omap_gem.c | 4 +--
drivers/gpu/drm/omapdrm/omap_gem_dmabuf.c | 2 +-
drivers/gpu/drm/qxl/qxl_display.c | 4 +--
drivers/gpu/drm/qxl/qxl_dumb.c | 2 +-
drivers/gpu/drm/qxl/qxl_fb.c | 6 ++---
drivers/gpu/drm/qxl/qxl_gem.c | 2 +-
drivers/gpu/drm/qxl/qxl_ioctl.c | 4 +--
drivers/gpu/drm/qxl/qxl_object.c | 6 ++---
drivers/gpu/drm/radeon/radeon_cs.c | 2 +-
drivers/gpu/drm/radeon/radeon_cursor.c | 6 ++---
drivers/gpu/drm/radeon/radeon_display.c | 12 ++++-----
drivers/gpu/drm/radeon/radeon_fb.c | 4 +--
drivers/gpu/drm/radeon/radeon_gem.c | 30 +++++++++++------------
drivers/gpu/drm/radeon/radeon_object.c | 2 +-
drivers/gpu/drm/rockchip/rockchip_drm_fb.c | 6 ++---
drivers/gpu/drm/rockchip/rockchip_drm_fbdev.c | 2 +-
drivers/gpu/drm/rockchip/rockchip_drm_gem.c | 2 +-
drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 4 +--
drivers/gpu/drm/tegra/drm.c | 12 ++++-----
drivers/gpu/drm/tegra/fb.c | 8 +++---
drivers/gpu/drm/tegra/gem.c | 10 ++++----
drivers/gpu/drm/tilcdc/tilcdc_crtc.c | 6 ++---
drivers/gpu/drm/udl/udl_fb.c | 6 ++---
drivers/gpu/drm/udl/udl_gem.c | 4 +--
drivers/gpu/drm/vc4/vc4_bo.c | 2 +-
drivers/gpu/drm/vgem/vgem_drv.c | 4 +--
drivers/gpu/drm/vgem/vgem_fence.c | 2 +-
drivers/gpu/drm/virtio/virtgpu_display.c | 4 +--
drivers/gpu/drm/virtio/virtgpu_gem.c | 4 +--
drivers/gpu/drm/virtio/virtgpu_ioctl.c | 14 +++++------
drivers/gpu/drm/vmwgfx/vmwgfx_fb.c | 2 +-
drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c | 4 +--
drivers/staging/vboxvideo/vbox_fb.c | 2 +-
drivers/staging/vboxvideo/vbox_main.c | 8 +++---
drivers/staging/vboxvideo/vbox_mode.c | 2 +-
103 files changed, 294 insertions(+), 294 deletions(-)

--
2.7.4


2017-08-11 12:33:50

by Cihangir Akturk

[permalink] [raw]
Subject: [PATCH v3 01/28] drm/amdgpu: 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: Cihangir Akturk <[email protected]>
Reviewed-by: Christian König <[email protected]>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c | 2 +-
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 2 +-
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 6 +++---
drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c | 4 ++--
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 22 +++++++++++-----------
drivers/gpu/drm/amd/amdgpu/dce_v10_0.c | 6 +++---
drivers/gpu/drm/amd/amdgpu/dce_v11_0.c | 6 +++---
drivers/gpu/drm/amd/amdgpu/dce_v6_0.c | 6 +++---
drivers/gpu/drm/amd/amdgpu/dce_v8_0.c | 6 +++---
9 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c
index f621ee1..2cf465f 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c
@@ -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) {
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
index 5599c01..0b8406c 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
@@ -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);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
index cdf2ab2..6ad2432 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
@@ -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);
}

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
index 0a8ee24..4565c22 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
@@ -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 @@ static int amdgpufb_create(struct drm_fb_helper *helper,

}
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);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
index 621f739..2181cf1 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
@@ -103,7 +103,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);
@@ -275,7 +275,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;

@@ -353,7 +353,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;

@@ -367,7 +367,7 @@ int amdgpu_gem_userptr_ioctl(struct drm_device *dev, void *data,
up_read(&current->mm->mmap_sem);

release_object:
- drm_gem_object_unreference_unlocked(gobj);
+ drm_gem_object_put_unlocked(gobj);

return r;
}
@@ -386,11 +386,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;
}

@@ -460,7 +460,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;
}

@@ -503,7 +503,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;
}

@@ -676,7 +676,7 @@ int amdgpu_gem_va_ioctl(struct drm_device *dev, void *data,
ttm_eu_backoff_reservation(&ticket, &list);

error_unref:
- drm_gem_object_unreference_unlocked(gobj);
+ drm_gem_object_put_unlocked(gobj);
return r;
}

@@ -738,7 +738,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;
}

@@ -766,7 +766,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;
}
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
index 162d761..0e12efc 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
@@ -2559,7 +2559,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;
}

@@ -2567,7 +2567,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;
}

@@ -2601,7 +2601,7 @@ static int dce_v10_0_crtc_cursor_set2(struct drm_crtc *crtc,
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;
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
index f420e58..d4b573d 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
@@ -2579,7 +2579,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;
}

@@ -2587,7 +2587,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;
}

@@ -2621,7 +2621,7 @@ static int dce_v11_0_crtc_cursor_set2(struct drm_crtc *crtc,
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;
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
index f3c422e..cc6f7b9 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
@@ -2432,7 +2432,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;
}

@@ -2440,7 +2440,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;
}

@@ -2474,7 +2474,7 @@ static int dce_v6_0_crtc_cursor_set2(struct drm_crtc *crtc,
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;
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
index b19aa39..1b5b253 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
@@ -2410,7 +2410,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;
}

@@ -2418,7 +2418,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;
}

@@ -2452,7 +2452,7 @@ static int dce_v8_0_crtc_cursor_set2(struct drm_crtc *crtc,
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;
--
2.7.4

2017-08-11 12:33:55

by Cihangir Akturk

[permalink] [raw]
Subject: [PATCH v3 03/28] drm/armada: 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: Cihangir Akturk <[email protected]>
---
drivers/gpu/drm/armada/armada_crtc.c | 22 +++++++++++-----------
drivers/gpu/drm/armada/armada_drv.c | 2 +-
drivers/gpu/drm/armada/armada_fb.c | 8 ++++----
drivers/gpu/drm/armada/armada_fbdev.c | 6 +++---
drivers/gpu/drm/armada/armada_gem.c | 14 +++++++-------
drivers/gpu/drm/armada/armada_overlay.c | 4 ++--
6 files changed, 28 insertions(+), 28 deletions(-)

diff --git a/drivers/gpu/drm/armada/armada_crtc.c b/drivers/gpu/drm/armada/armada_crtc.c
index 2a4d163..2e065fa 100644
--- a/drivers/gpu/drm/armada/armada_crtc.c
+++ b/drivers/gpu/drm/armada/armada_crtc.c
@@ -298,7 +298,7 @@ static void armada_drm_crtc_finish_fb(struct armada_crtc *dcrtc,

if (force) {
/* Display is disabled, so just drop the old fb */
- drm_framebuffer_unreference(fb);
+ drm_framebuffer_put(fb);
return;
}

@@ -321,7 +321,7 @@ static void armada_drm_crtc_finish_fb(struct armada_crtc *dcrtc,
* the best. The worst that will happen is the buffer gets
* reused before it has finished being displayed.
*/
- drm_framebuffer_unreference(fb);
+ drm_framebuffer_put(fb);
}

static void armada_drm_vblank_off(struct armada_crtc *dcrtc)
@@ -577,7 +577,7 @@ static int armada_drm_crtc_mode_set(struct drm_crtc *crtc,
unsigned i;
bool interlaced;

- drm_framebuffer_reference(crtc->primary->fb);
+ drm_framebuffer_get(crtc->primary->fb);

interlaced = !!(adj->flags & DRM_MODE_FLAG_INTERLACE);

@@ -718,7 +718,7 @@ static int armada_drm_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,
MAX_SCHEDULE_TIMEOUT);

/* Take a reference to the new fb as we're using it */
- drm_framebuffer_reference(crtc->primary->fb);
+ drm_framebuffer_get(crtc->primary->fb);

/* Update the base in the CRTC */
armada_drm_crtc_update_regs(dcrtc, regs);
@@ -742,7 +742,7 @@ void armada_drm_crtc_plane_disable(struct armada_crtc *dcrtc,
* primary plane.
*/
if (plane->fb)
- drm_framebuffer_unreference(plane->fb);
+ drm_framebuffer_put(plane->fb);

/* Power down the Y/U/V FIFOs */
sram_para1 = CFG_PDWN16x66 | CFG_PDWN32x66;
@@ -947,13 +947,13 @@ static int armada_drm_crtc_cursor_set(struct drm_crtc *crtc,

/* Must be a kernel-mapped object */
if (!obj->addr) {
- drm_gem_object_unreference_unlocked(&obj->obj);
+ drm_gem_object_put_unlocked(&obj->obj);
return -EINVAL;
}

if (obj->obj.size < w * h * 4) {
DRM_ERROR("buffer is too small\n");
- drm_gem_object_unreference_unlocked(&obj->obj);
+ drm_gem_object_put_unlocked(&obj->obj);
return -ENOMEM;
}
}
@@ -961,7 +961,7 @@ static int armada_drm_crtc_cursor_set(struct drm_crtc *crtc,
if (dcrtc->cursor_obj) {
dcrtc->cursor_obj->update = NULL;
dcrtc->cursor_obj->update_data = NULL;
- drm_gem_object_unreference_unlocked(&dcrtc->cursor_obj->obj);
+ drm_gem_object_put_unlocked(&dcrtc->cursor_obj->obj);
}
dcrtc->cursor_obj = obj;
dcrtc->cursor_w = w;
@@ -997,7 +997,7 @@ static void armada_drm_crtc_destroy(struct drm_crtc *crtc)
struct armada_private *priv = crtc->dev->dev_private;

if (dcrtc->cursor_obj)
- drm_gem_object_unreference_unlocked(&dcrtc->cursor_obj->obj);
+ drm_gem_object_put_unlocked(&dcrtc->cursor_obj->obj);

priv->dcrtc[dcrtc->num] = NULL;
drm_crtc_cleanup(&dcrtc->crtc);
@@ -1045,12 +1045,12 @@ static int armada_drm_crtc_page_flip(struct drm_crtc *crtc,
* Ensure that we hold a reference on the new framebuffer.
* This has to match the behaviour in mode_set.
*/
- drm_framebuffer_reference(fb);
+ drm_framebuffer_get(fb);

ret = armada_drm_crtc_queue_frame_work(dcrtc, work);
if (ret) {
/* Undo our reference above */
- drm_framebuffer_unreference(fb);
+ drm_framebuffer_put(fb);
kfree(work);
return ret;
}
diff --git a/drivers/gpu/drm/armada/armada_drv.c b/drivers/gpu/drm/armada/armada_drv.c
index 0b3227c..c993bcc 100644
--- a/drivers/gpu/drm/armada/armada_drv.c
+++ b/drivers/gpu/drm/armada/armada_drv.c
@@ -26,7 +26,7 @@ static void armada_drm_unref_work(struct work_struct *work)
struct drm_framebuffer *fb;

while (kfifo_get(&priv->fb_unref, &fb))
- drm_framebuffer_unreference(fb);
+ drm_framebuffer_put(fb);
}

/* Must be called with dev->event_lock held */
diff --git a/drivers/gpu/drm/armada/armada_fb.c b/drivers/gpu/drm/armada/armada_fb.c
index 92e6b08..51839c1 100644
--- a/drivers/gpu/drm/armada/armada_fb.c
+++ b/drivers/gpu/drm/armada/armada_fb.c
@@ -18,7 +18,7 @@ static void armada_fb_destroy(struct drm_framebuffer *fb)
struct armada_framebuffer *dfb = drm_fb_to_armada_fb(fb);

drm_framebuffer_cleanup(&dfb->fb);
- drm_gem_object_unreference_unlocked(&dfb->obj->obj);
+ drm_gem_object_put_unlocked(&dfb->obj->obj);
kfree(dfb);
}

@@ -95,7 +95,7 @@ struct armada_framebuffer *armada_framebuffer_create(struct drm_device *dev,
* the above call, but the caller will drop their reference
* to it. Hence we need to take our own reference.
*/
- drm_gem_object_reference(&obj->obj);
+ drm_gem_object_get(&obj->obj);

return dfb;
}
@@ -144,12 +144,12 @@ static struct drm_framebuffer *armada_fb_create(struct drm_device *dev,
goto err;
}

- drm_gem_object_unreference_unlocked(&obj->obj);
+ drm_gem_object_put_unlocked(&obj->obj);

return &dfb->fb;

err_unref:
- drm_gem_object_unreference_unlocked(&obj->obj);
+ drm_gem_object_put_unlocked(&obj->obj);
err:
DRM_ERROR("failed to initialize framebuffer: %d\n", ret);
return ERR_PTR(ret);
diff --git a/drivers/gpu/drm/armada/armada_fbdev.c b/drivers/gpu/drm/armada/armada_fbdev.c
index 29c7d04..cf6bad1 100644
--- a/drivers/gpu/drm/armada/armada_fbdev.c
+++ b/drivers/gpu/drm/armada/armada_fbdev.c
@@ -52,13 +52,13 @@ static int armada_fb_create(struct drm_fb_helper *fbh,

ret = armada_gem_linear_back(dev, obj);
if (ret) {
- drm_gem_object_unreference_unlocked(&obj->obj);
+ drm_gem_object_put_unlocked(&obj->obj);
return ret;
}

ptr = armada_gem_map_object(dev, obj);
if (!ptr) {
- drm_gem_object_unreference_unlocked(&obj->obj);
+ drm_gem_object_put_unlocked(&obj->obj);
return -ENOMEM;
}

@@ -68,7 +68,7 @@ static int armada_fb_create(struct drm_fb_helper *fbh,
* A reference is now held by the framebuffer object if
* successful, otherwise this drops the ref for the error path.
*/
- drm_gem_object_unreference_unlocked(&obj->obj);
+ drm_gem_object_put_unlocked(&obj->obj);

if (IS_ERR(dfb))
return PTR_ERR(dfb);
diff --git a/drivers/gpu/drm/armada/armada_gem.c b/drivers/gpu/drm/armada/armada_gem.c
index a76ca21..49d40aa 100644
--- a/drivers/gpu/drm/armada/armada_gem.c
+++ b/drivers/gpu/drm/armada/armada_gem.c
@@ -266,7 +266,7 @@ int armada_gem_dumb_create(struct drm_file *file, struct drm_device *dev,
/* drop reference from allocate - handle holds it now */
DRM_DEBUG_DRIVER("obj %p size %zu handle %#x\n", dobj, size, handle);
err:
- drm_gem_object_unreference_unlocked(&dobj->obj);
+ drm_gem_object_put_unlocked(&dobj->obj);
return ret;
}

@@ -295,7 +295,7 @@ int armada_gem_dumb_map_offset(struct drm_file *file, struct drm_device *dev,
}

err_unref:
- drm_gem_object_unreference_unlocked(&obj->obj);
+ drm_gem_object_put_unlocked(&obj->obj);

return ret;
}
@@ -334,7 +334,7 @@ int armada_gem_create_ioctl(struct drm_device *dev, void *data,
/* drop reference from allocate - handle holds it now */
DRM_DEBUG_DRIVER("obj %p size %zu handle %#x\n", dobj, size, handle);
err:
- drm_gem_object_unreference_unlocked(&dobj->obj);
+ drm_gem_object_put_unlocked(&dobj->obj);
return ret;
}

@@ -351,13 +351,13 @@ int armada_gem_mmap_ioctl(struct drm_device *dev, void *data,
return -ENOENT;

if (!dobj->obj.filp) {
- drm_gem_object_unreference_unlocked(&dobj->obj);
+ drm_gem_object_put_unlocked(&dobj->obj);
return -EINVAL;
}

addr = vm_mmap(dobj->obj.filp, 0, args->size, PROT_READ | PROT_WRITE,
MAP_SHARED, args->offset);
- drm_gem_object_unreference_unlocked(&dobj->obj);
+ drm_gem_object_put_unlocked(&dobj->obj);
if (IS_ERR_VALUE(addr))
return addr;

@@ -412,7 +412,7 @@ int armada_gem_pwrite_ioctl(struct drm_device *dev, void *data,
}

unref:
- drm_gem_object_unreference_unlocked(&dobj->obj);
+ drm_gem_object_put_unlocked(&dobj->obj);
return ret;
}

@@ -561,7 +561,7 @@ armada_gem_prime_import(struct drm_device *dev, struct dma_buf *buf)
* Importing our own dmabuf(s) increases the
* refcount on the gem object itself.
*/
- drm_gem_object_reference(obj);
+ drm_gem_object_get(obj);
return obj;
}
}
diff --git a/drivers/gpu/drm/armada/armada_overlay.c b/drivers/gpu/drm/armada/armada_overlay.c
index edc4491..b411b60 100644
--- a/drivers/gpu/drm/armada/armada_overlay.c
+++ b/drivers/gpu/drm/armada/armada_overlay.c
@@ -177,7 +177,7 @@ armada_ovl_plane_update(struct drm_plane *plane, struct drm_crtc *crtc,
* Take a reference on the new framebuffer - we want to
* hold on to it while the hardware is displaying it.
*/
- drm_framebuffer_reference(fb);
+ drm_framebuffer_get(fb);

if (plane->fb)
armada_ovl_retire_fb(dplane, plane->fb);
@@ -278,7 +278,7 @@ static int armada_ovl_plane_disable(struct drm_plane *plane,

fb = xchg(&dplane->old_fb, NULL);
if (fb)
- drm_framebuffer_unreference(fb);
+ drm_framebuffer_put(fb);

return 0;
}
--
2.7.4

2017-08-11 12:34:01

by Cihangir Akturk

[permalink] [raw]
Subject: [PATCH v3 05/28] drm/bochs: 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: Cihangir Akturk <[email protected]>
---
drivers/gpu/drm/bochs/bochs_fbdev.c | 2 +-
drivers/gpu/drm/bochs/bochs_mm.c | 10 +++++-----
2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/bochs/bochs_fbdev.c b/drivers/gpu/drm/bochs/bochs_fbdev.c
index 14eb8d0..6f0cf36 100644
--- a/drivers/gpu/drm/bochs/bochs_fbdev.c
+++ b/drivers/gpu/drm/bochs/bochs_fbdev.c
@@ -144,7 +144,7 @@ static int bochs_fbdev_destroy(struct bochs_device *bochs)
drm_fb_helper_unregister_fbi(&bochs->fb.helper);

if (gfb->obj) {
- drm_gem_object_unreference_unlocked(gfb->obj);
+ drm_gem_object_put_unlocked(gfb->obj);
gfb->obj = NULL;
}

diff --git a/drivers/gpu/drm/bochs/bochs_mm.c b/drivers/gpu/drm/bochs/bochs_mm.c
index c4cadb6..881b784 100644
--- a/drivers/gpu/drm/bochs/bochs_mm.c
+++ b/drivers/gpu/drm/bochs/bochs_mm.c
@@ -417,7 +417,7 @@ int bochs_dumb_create(struct drm_file *file, struct drm_device *dev,
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;

@@ -457,7 +457,7 @@ int bochs_dumb_mmap_offset(struct drm_file *file, struct drm_device *dev,
bo = gem_to_bochs_bo(obj);
*offset = bochs_bo_mmap_offset(bo);

- drm_gem_object_unreference_unlocked(obj);
+ drm_gem_object_put_unlocked(obj);
return 0;
}

@@ -467,7 +467,7 @@ static void bochs_user_framebuffer_destroy(struct drm_framebuffer *fb)
{
struct bochs_framebuffer *bochs_fb = to_bochs_framebuffer(fb);

- drm_gem_object_unreference_unlocked(bochs_fb->obj);
+ drm_gem_object_put_unlocked(bochs_fb->obj);
drm_framebuffer_cleanup(fb);
kfree(fb);
}
@@ -518,13 +518,13 @@ bochs_user_framebuffer_create(struct drm_device *dev,

bochs_fb = kzalloc(sizeof(*bochs_fb), GFP_KERNEL);
if (!bochs_fb) {
- drm_gem_object_unreference_unlocked(obj);
+ drm_gem_object_put_unlocked(obj);
return ERR_PTR(-ENOMEM);
}

ret = bochs_framebuffer_init(dev, bochs_fb, mode_cmd, obj);
if (ret) {
- drm_gem_object_unreference_unlocked(obj);
+ drm_gem_object_put_unlocked(obj);
kfree(bochs_fb);
return ERR_PTR(ret);
}
--
2.7.4

2017-08-11 12:34:03

by Cihangir Akturk

[permalink] [raw]
Subject: [PATCH v3 04/28] drm/ast: 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: Cihangir Akturk <[email protected]>
Acked-by: Joel Stanley <[email protected]>
---
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

2017-08-11 12:34:12

by Cihangir Akturk

[permalink] [raw]
Subject: [PATCH v3 07/28] drm/etnaviv: 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: Cihangir Akturk <[email protected]>
---
drivers/gpu/drm/etnaviv/etnaviv_drv.c | 8 ++++----
drivers/gpu/drm/etnaviv/etnaviv_gem.c | 20 ++++++++++----------
drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c | 2 +-
drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c | 4 ++--
4 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/drivers/gpu/drm/etnaviv/etnaviv_drv.c b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
index 91e17ae..2cb4773 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_drv.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
@@ -316,7 +316,7 @@ static int etnaviv_ioctl_gem_cpu_prep(struct drm_device *dev, void *data,

ret = etnaviv_gem_cpu_prep(obj, args->op, &TS(args->timeout));

- drm_gem_object_unreference_unlocked(obj);
+ drm_gem_object_put_unlocked(obj);

return ret;
}
@@ -337,7 +337,7 @@ static int etnaviv_ioctl_gem_cpu_fini(struct drm_device *dev, void *data,

ret = etnaviv_gem_cpu_fini(obj);

- drm_gem_object_unreference_unlocked(obj);
+ drm_gem_object_put_unlocked(obj);

return ret;
}
@@ -357,7 +357,7 @@ static int etnaviv_ioctl_gem_info(struct drm_device *dev, void *data,
return -ENOENT;

ret = etnaviv_gem_mmap_offset(obj, &args->offset);
- drm_gem_object_unreference_unlocked(obj);
+ drm_gem_object_put_unlocked(obj);

return ret;
}
@@ -446,7 +446,7 @@ static int etnaviv_ioctl_gem_wait(struct drm_device *dev, void *data,

ret = etnaviv_gem_wait_bo(gpu, obj, timeout);

- drm_gem_object_unreference_unlocked(obj);
+ drm_gem_object_put_unlocked(obj);

return ret;
}
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem.c b/drivers/gpu/drm/etnaviv/etnaviv_gem.c
index 9a3bea7..e36fbb9 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_gem.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_gem.c
@@ -265,7 +265,7 @@ void etnaviv_gem_mapping_reference(struct etnaviv_vram_mapping *mapping)
{
struct etnaviv_gem_object *etnaviv_obj = mapping->object;

- drm_gem_object_reference(&etnaviv_obj->base);
+ drm_gem_object_get(&etnaviv_obj->base);

mutex_lock(&etnaviv_obj->lock);
WARN_ON(mapping->use == 0);
@@ -282,7 +282,7 @@ void etnaviv_gem_mapping_unreference(struct etnaviv_vram_mapping *mapping)
mapping->use -= 1;
mutex_unlock(&etnaviv_obj->lock);

- drm_gem_object_unreference_unlocked(&etnaviv_obj->base);
+ drm_gem_object_put_unlocked(&etnaviv_obj->base);
}

struct etnaviv_vram_mapping *etnaviv_gem_mapping_get(
@@ -358,7 +358,7 @@ struct etnaviv_vram_mapping *etnaviv_gem_mapping_get(
return ERR_PTR(ret);

/* Take a reference on the object */
- drm_gem_object_reference(obj);
+ drm_gem_object_get(obj);
return mapping;
}

@@ -671,7 +671,7 @@ static struct drm_gem_object *__etnaviv_gem_new(struct drm_device *dev,
return obj;

fail:
- drm_gem_object_unreference_unlocked(obj);
+ drm_gem_object_put_unlocked(obj);
return ERR_PTR(ret);
}

@@ -688,14 +688,14 @@ int etnaviv_gem_new_handle(struct drm_device *dev, struct drm_file *file,

ret = etnaviv_gem_obj_add(dev, obj);
if (ret < 0) {
- drm_gem_object_unreference_unlocked(obj);
+ drm_gem_object_put_unlocked(obj);
return ret;
}

ret = drm_gem_handle_create(file, obj, handle);

/* drop reference from allocate - handle holds it now */
- drm_gem_object_unreference_unlocked(obj);
+ drm_gem_object_put_unlocked(obj);

return ret;
}
@@ -712,7 +712,7 @@ struct drm_gem_object *etnaviv_gem_new(struct drm_device *dev,

ret = etnaviv_gem_obj_add(dev, obj);
if (ret < 0) {
- drm_gem_object_unreference_unlocked(obj);
+ drm_gem_object_put_unlocked(obj);
return ERR_PTR(ret);
}

@@ -800,7 +800,7 @@ static void __etnaviv_gem_userptr_get_pages(struct work_struct *_work)
}

mutex_unlock(&etnaviv_obj->lock);
- drm_gem_object_unreference_unlocked(&etnaviv_obj->base);
+ drm_gem_object_put_unlocked(&etnaviv_obj->base);

mmput(work->mm);
put_task_struct(work->task);
@@ -858,7 +858,7 @@ static int etnaviv_gem_userptr_get_pages(struct etnaviv_gem_object *etnaviv_obj)
}

get_task_struct(current);
- drm_gem_object_reference(&etnaviv_obj->base);
+ drm_gem_object_get(&etnaviv_obj->base);

work->mm = mm;
work->task = current;
@@ -924,6 +924,6 @@ int etnaviv_gem_new_userptr(struct drm_device *dev, struct drm_file *file,
ret = drm_gem_handle_create(file, &etnaviv_obj->base, handle);
unreference:
/* drop reference from allocate - handle holds it now */
- drm_gem_object_unreference_unlocked(&etnaviv_obj->base);
+ drm_gem_object_put_unlocked(&etnaviv_obj->base);
return ret;
}
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c b/drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c
index e5da4f23..ae88472 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c
@@ -146,7 +146,7 @@ struct drm_gem_object *etnaviv_gem_prime_import_sg_table(struct drm_device *dev,
return &etnaviv_obj->base;

fail:
- drm_gem_object_unreference_unlocked(&etnaviv_obj->base);
+ drm_gem_object_put_unlocked(&etnaviv_obj->base);

return ERR_PTR(ret);
}
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
index 5bd9316..d456a6b 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
@@ -88,7 +88,7 @@ static int submit_lookup_objects(struct etnaviv_gem_submit *submit,
* Take a refcount on the object. The file table lock
* prevents the object_idr's refcount on this being dropped.
*/
- drm_gem_object_reference(obj);
+ drm_gem_object_get(obj);

submit->bos[i].obj = to_etnaviv_bo(obj);
}
@@ -291,7 +291,7 @@ static void submit_cleanup(struct etnaviv_gem_submit *submit)
struct etnaviv_gem_object *etnaviv_obj = submit->bos[i].obj;

submit_unlock_object(submit, i);
- drm_gem_object_unreference_unlocked(&etnaviv_obj->base);
+ drm_gem_object_put_unlocked(&etnaviv_obj->base);
}

ww_acquire_fini(&submit->ticket);
--
2.7.4

2017-08-11 12:34:22

by Cihangir Akturk

[permalink] [raw]
Subject: [PATCH v3 12/28] drm/imx: 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: Cihangir Akturk <[email protected]>
---
drivers/gpu/drm/imx/ipuv3-crtc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/imx/ipuv3-crtc.c b/drivers/gpu/drm/imx/ipuv3-crtc.c
index 53e0b24..9a99618 100644
--- a/drivers/gpu/drm/imx/ipuv3-crtc.c
+++ b/drivers/gpu/drm/imx/ipuv3-crtc.c
@@ -115,7 +115,7 @@ static void imx_drm_crtc_reset(struct drm_crtc *crtc)

if (crtc->state) {
if (crtc->state->mode_blob)
- drm_property_unreference_blob(crtc->state->mode_blob);
+ drm_property_blob_put(crtc->state->mode_blob);

state = to_imx_crtc_state(crtc->state);
memset(state, 0, sizeof(*state));
--
2.7.4

2017-08-11 12:34:29

by Cihangir Akturk

[permalink] [raw]
Subject: [PATCH v3 14/28] drm/mgag200: 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: Cihangir Akturk <[email protected]>
---
drivers/gpu/drm/mgag200/mgag200_cursor.c | 2 +-
drivers/gpu/drm/mgag200/mgag200_fb.c | 4 ++--
drivers/gpu/drm/mgag200/mgag200_main.c | 10 +++++-----
3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/mgag200/mgag200_cursor.c b/drivers/gpu/drm/mgag200/mgag200_cursor.c
index 2ac3fcb..968e203 100644
--- a/drivers/gpu/drm/mgag200/mgag200_cursor.c
+++ b/drivers/gpu/drm/mgag200/mgag200_cursor.c
@@ -248,7 +248,7 @@ int mga_crtc_cursor_set(struct drm_crtc *crtc,
out_unreserve1:
mgag200_bo_unreserve(pixels_2);
out_unref:
- drm_gem_object_unreference_unlocked(obj);
+ drm_gem_object_put_unlocked(obj);

return ret;
}
diff --git a/drivers/gpu/drm/mgag200/mgag200_fb.c b/drivers/gpu/drm/mgag200/mgag200_fb.c
index 9d914ca..30726c9 100644
--- a/drivers/gpu/drm/mgag200/mgag200_fb.c
+++ b/drivers/gpu/drm/mgag200/mgag200_fb.c
@@ -232,7 +232,7 @@ static int mgag200fb_create(struct drm_fb_helper *helper,
err_alloc_fbi:
vfree(sysram);
err_sysram:
- drm_gem_object_unreference_unlocked(gobj);
+ drm_gem_object_put_unlocked(gobj);

return ret;
}
@@ -245,7 +245,7 @@ static int mga_fbdev_destroy(struct drm_device *dev,
drm_fb_helper_unregister_fbi(&mfbdev->helper);

if (mfb->obj) {
- drm_gem_object_unreference_unlocked(mfb->obj);
+ drm_gem_object_put_unlocked(mfb->obj);
mfb->obj = NULL;
}
drm_fb_helper_fini(&mfbdev->helper);
diff --git a/drivers/gpu/drm/mgag200/mgag200_main.c b/drivers/gpu/drm/mgag200/mgag200_main.c
index dce8a3e..780f983 100644
--- a/drivers/gpu/drm/mgag200/mgag200_main.c
+++ b/drivers/gpu/drm/mgag200/mgag200_main.c
@@ -18,7 +18,7 @@ static void mga_user_framebuffer_destroy(struct drm_framebuffer *fb)
{
struct mga_framebuffer *mga_fb = to_mga_framebuffer(fb);

- drm_gem_object_unreference_unlocked(mga_fb->obj);
+ drm_gem_object_put_unlocked(mga_fb->obj);
drm_framebuffer_cleanup(fb);
kfree(fb);
}
@@ -59,13 +59,13 @@ mgag200_user_framebuffer_create(struct drm_device *dev,

mga_fb = kzalloc(sizeof(*mga_fb), GFP_KERNEL);
if (!mga_fb) {
- drm_gem_object_unreference_unlocked(obj);
+ drm_gem_object_put_unlocked(obj);
return ERR_PTR(-ENOMEM);
}

ret = mgag200_framebuffer_init(dev, mga_fb, mode_cmd, obj);
if (ret) {
- drm_gem_object_unreference_unlocked(obj);
+ drm_gem_object_put_unlocked(obj);
kfree(mga_fb);
return ERR_PTR(ret);
}
@@ -317,7 +317,7 @@ int mgag200_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;

@@ -366,6 +366,6 @@ mgag200_dumb_mmap_offset(struct drm_file *file,
bo = gem_to_mga_bo(obj);
*offset = mgag200_bo_mmap_offset(bo);

- drm_gem_object_unreference_unlocked(obj);
+ drm_gem_object_put_unlocked(obj);
return 0;
}
--
2.7.4

2017-08-11 12:34:46

by Cihangir Akturk

[permalink] [raw]
Subject: [PATCH v3 15/28] drm/msm: 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: Cihangir Akturk <[email protected]>
---
drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 10 +++++-----
drivers/gpu/drm/msm/adreno/a5xx_power.c | 2 +-
drivers/gpu/drm/msm/adreno/adreno_gpu.c | 2 +-
drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c | 6 +++---
drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c | 2 +-
drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c | 2 +-
drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c | 4 ++--
drivers/gpu/drm/msm/msm_drv.c | 8 ++++----
drivers/gpu/drm/msm/msm_fb.c | 4 ++--
drivers/gpu/drm/msm/msm_fbdev.c | 2 +-
drivers/gpu/drm/msm/msm_gem.c | 8 ++++----
drivers/gpu/drm/msm/msm_gem_submit.c | 4 ++--
drivers/gpu/drm/msm/msm_gpu.c | 4 ++--
drivers/gpu/drm/msm/msm_ringbuffer.c | 2 +-
14 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
index b4b54f1..12d0f9c 100644
--- a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
@@ -303,7 +303,7 @@ static struct drm_gem_object *a5xx_ucode_load_bo(struct msm_gpu *gpu,

ptr = msm_gem_get_vaddr(bo);
if (!ptr) {
- drm_gem_object_unreference(bo);
+ drm_gem_object_put(bo);
return ERR_PTR(-ENOMEM);
}

@@ -311,7 +311,7 @@ static struct drm_gem_object *a5xx_ucode_load_bo(struct msm_gpu *gpu,
int ret = msm_gem_get_iova(bo, gpu->aspace, iova);

if (ret) {
- drm_gem_object_unreference(bo);
+ drm_gem_object_put(bo);
return ERR_PTR(ret);
}
}
@@ -697,19 +697,19 @@ static void a5xx_destroy(struct msm_gpu *gpu)
if (a5xx_gpu->pm4_bo) {
if (a5xx_gpu->pm4_iova)
msm_gem_put_iova(a5xx_gpu->pm4_bo, gpu->aspace);
- drm_gem_object_unreference_unlocked(a5xx_gpu->pm4_bo);
+ drm_gem_object_put_unlocked(a5xx_gpu->pm4_bo);
}

if (a5xx_gpu->pfp_bo) {
if (a5xx_gpu->pfp_iova)
msm_gem_put_iova(a5xx_gpu->pfp_bo, gpu->aspace);
- drm_gem_object_unreference_unlocked(a5xx_gpu->pfp_bo);
+ drm_gem_object_put_unlocked(a5xx_gpu->pfp_bo);
}

if (a5xx_gpu->gpmu_bo) {
if (a5xx_gpu->gpmu_iova)
msm_gem_put_iova(a5xx_gpu->gpmu_bo, gpu->aspace);
- drm_gem_object_unreference_unlocked(a5xx_gpu->gpmu_bo);
+ drm_gem_object_put_unlocked(a5xx_gpu->gpmu_bo);
}

adreno_gpu_cleanup(adreno_gpu);
diff --git a/drivers/gpu/drm/msm/adreno/a5xx_power.c b/drivers/gpu/drm/msm/adreno/a5xx_power.c
index 87af6ee..3333620 100644
--- a/drivers/gpu/drm/msm/adreno/a5xx_power.c
+++ b/drivers/gpu/drm/msm/adreno/a5xx_power.c
@@ -330,7 +330,7 @@ void a5xx_gpmu_ucode_init(struct msm_gpu *gpu)
if (a5xx_gpu->gpmu_iova)
msm_gem_put_iova(a5xx_gpu->gpmu_bo, gpu->aspace);
if (a5xx_gpu->gpmu_bo)
- drm_gem_object_unreference(a5xx_gpu->gpmu_bo);
+ drm_gem_object_put(a5xx_gpu->gpmu_bo);

a5xx_gpu->gpmu_bo = NULL;
a5xx_gpu->gpmu_iova = 0;
diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.c b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
index f1ab270..15de821 100644
--- a/drivers/gpu/drm/msm/adreno/adreno_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
@@ -433,7 +433,7 @@ void adreno_gpu_cleanup(struct adreno_gpu *adreno_gpu)
if (adreno_gpu->memptrs_iova)
msm_gem_put_iova(adreno_gpu->memptrs_bo, gpu->aspace);

- drm_gem_object_unreference_unlocked(adreno_gpu->memptrs_bo);
+ drm_gem_object_put_unlocked(adreno_gpu->memptrs_bo);
}
release_firmware(adreno_gpu->pm4);
release_firmware(adreno_gpu->pfp);
diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c
index 47fa2ab..5d4aba1 100644
--- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c
+++ b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c
@@ -129,7 +129,7 @@ static void unref_cursor_worker(struct drm_flip_work *work, void *val)
struct msm_kms *kms = &mdp4_kms->base.base;

msm_gem_put_iova(val, kms->aspace);
- drm_gem_object_unreference_unlocked(val);
+ drm_gem_object_put_unlocked(val);
}

static void mdp4_crtc_destroy(struct drm_crtc *crtc)
@@ -375,7 +375,7 @@ static void update_cursor(struct drm_crtc *crtc)

if (next_bo) {
/* take a obj ref + iova ref when we start scanning out: */
- drm_gem_object_reference(next_bo);
+ drm_gem_object_get(next_bo);
msm_gem_get_iova(next_bo, kms->aspace, &iova);

/* enable cursor: */
@@ -460,7 +460,7 @@ static int mdp4_crtc_cursor_set(struct drm_crtc *crtc,
return 0;

fail:
- drm_gem_object_unreference_unlocked(cursor_bo);
+ drm_gem_object_put_unlocked(cursor_bo);
return ret;
}

diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c
index f7f0874..4b646bf 100644
--- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c
+++ b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c
@@ -164,7 +164,7 @@ static void mdp4_destroy(struct msm_kms *kms)

if (mdp4_kms->blank_cursor_iova)
msm_gem_put_iova(mdp4_kms->blank_cursor_bo, kms->aspace);
- drm_gem_object_unreference_unlocked(mdp4_kms->blank_cursor_bo);
+ drm_gem_object_put_unlocked(mdp4_kms->blank_cursor_bo);

if (aspace) {
aspace->mmu->funcs->detach(aspace->mmu,
diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c
index 5e3bc72..7aa4241 100644
--- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c
+++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c
@@ -163,7 +163,7 @@ static void unref_cursor_worker(struct drm_flip_work *work, void *val)
struct msm_kms *kms = &mdp5_kms->base.base;

msm_gem_put_iova(val, kms->aspace);
- drm_gem_object_unreference_unlocked(val);
+ drm_gem_object_put_unlocked(val);
}

static void mdp5_crtc_destroy(struct drm_crtc *crtc)
diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
index 818244a..cf4d63e 100644
--- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
+++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
@@ -194,7 +194,7 @@ static void mdp5_plane_reset(struct drm_plane *plane)
struct mdp5_plane_state *mdp5_state;

if (plane->state && plane->state->fb)
- drm_framebuffer_unreference(plane->state->fb);
+ drm_framebuffer_put(plane->state->fb);

kfree(to_mdp5_plane_state(plane->state));
mdp5_state = kzalloc(sizeof(*mdp5_state), GFP_KERNEL);
@@ -237,7 +237,7 @@ static void mdp5_plane_destroy_state(struct drm_plane *plane,
struct mdp5_plane_state *pstate = to_mdp5_plane_state(state);

if (state->fb)
- drm_framebuffer_unreference(state->fb);
+ drm_framebuffer_put(state->fb);

kfree(pstate);
}
diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
index f49f6ac..ba3c581 100644
--- a/drivers/gpu/drm/msm/msm_drv.c
+++ b/drivers/gpu/drm/msm/msm_drv.c
@@ -664,7 +664,7 @@ static int msm_ioctl_gem_cpu_prep(struct drm_device *dev, void *data,

ret = msm_gem_cpu_prep(obj, args->op, &timeout);

- drm_gem_object_unreference_unlocked(obj);
+ drm_gem_object_put_unlocked(obj);

return ret;
}
@@ -682,7 +682,7 @@ static int msm_ioctl_gem_cpu_fini(struct drm_device *dev, void *data,

ret = msm_gem_cpu_fini(obj);

- drm_gem_object_unreference_unlocked(obj);
+ drm_gem_object_put_unlocked(obj);

return ret;
}
@@ -722,7 +722,7 @@ static int msm_ioctl_gem_info(struct drm_device *dev, void *data,
args->offset = msm_gem_mmap_offset(obj);
}

- drm_gem_object_unreference_unlocked(obj);
+ drm_gem_object_put_unlocked(obj);

return ret;
}
@@ -776,7 +776,7 @@ static int msm_ioctl_gem_madvise(struct drm_device *dev, void *data,
ret = 0;
}

- drm_gem_object_unreference(obj);
+ drm_gem_object_put(obj);

unlock:
mutex_unlock(&dev->struct_mutex);
diff --git a/drivers/gpu/drm/msm/msm_fb.c b/drivers/gpu/drm/msm/msm_fb.c
index 6ecb7b1..0a2b4bb 100644
--- a/drivers/gpu/drm/msm/msm_fb.c
+++ b/drivers/gpu/drm/msm/msm_fb.c
@@ -50,7 +50,7 @@ static void msm_framebuffer_destroy(struct drm_framebuffer *fb)
for (i = 0; i < n; i++) {
struct drm_gem_object *bo = msm_fb->planes[i];

- drm_gem_object_unreference_unlocked(bo);
+ drm_gem_object_put_unlocked(bo);
}

kfree(msm_fb);
@@ -157,7 +157,7 @@ struct drm_framebuffer *msm_framebuffer_create(struct drm_device *dev,

out_unref:
for (i = 0; i < n; i++)
- drm_gem_object_unreference_unlocked(bos[i]);
+ drm_gem_object_put_unlocked(bos[i]);
return ERR_PTR(ret);
}

diff --git a/drivers/gpu/drm/msm/msm_fbdev.c b/drivers/gpu/drm/msm/msm_fbdev.c
index 9c00fed..d959064 100644
--- a/drivers/gpu/drm/msm/msm_fbdev.c
+++ b/drivers/gpu/drm/msm/msm_fbdev.c
@@ -112,7 +112,7 @@ static int msm_fbdev_create(struct drm_fb_helper *helper,
/* note: if fb creation failed, we can't rely on fb destroy
* to unref the bo:
*/
- drm_gem_object_unreference_unlocked(fbdev->bo);
+ drm_gem_object_put_unlocked(fbdev->bo);
ret = PTR_ERR(fb);
goto fail;
}
diff --git a/drivers/gpu/drm/msm/msm_gem.c b/drivers/gpu/drm/msm/msm_gem.c
index 65f3554..98dbf22 100644
--- a/drivers/gpu/drm/msm/msm_gem.c
+++ b/drivers/gpu/drm/msm/msm_gem.c
@@ -462,7 +462,7 @@ int msm_gem_dumb_map_offset(struct drm_file *file, struct drm_device *dev,

*offset = msm_gem_mmap_offset(obj);

- drm_gem_object_unreference_unlocked(obj);
+ drm_gem_object_put_unlocked(obj);

fail:
return ret;
@@ -839,7 +839,7 @@ int msm_gem_new_handle(struct drm_device *dev, struct drm_file *file,
ret = drm_gem_handle_create(file, obj, handle);

/* drop reference from allocate - handle holds it now */
- drm_gem_object_unreference_unlocked(obj);
+ drm_gem_object_put_unlocked(obj);

return ret;
}
@@ -955,7 +955,7 @@ static struct drm_gem_object *_msm_gem_new(struct drm_device *dev,
return obj;

fail:
- drm_gem_object_unreference_unlocked(obj);
+ drm_gem_object_put_unlocked(obj);
return ERR_PTR(ret);
}

@@ -1015,6 +1015,6 @@ struct drm_gem_object *msm_gem_import(struct drm_device *dev,
return obj;

fail:
- drm_gem_object_unreference_unlocked(obj);
+ drm_gem_object_put_unlocked(obj);
return ERR_PTR(ret);
}
diff --git a/drivers/gpu/drm/msm/msm_gem_submit.c b/drivers/gpu/drm/msm/msm_gem_submit.c
index 6bfca74..59982cf 100644
--- a/drivers/gpu/drm/msm/msm_gem_submit.c
+++ b/drivers/gpu/drm/msm/msm_gem_submit.c
@@ -139,7 +139,7 @@ static int submit_lookup_objects(struct msm_gem_submit *submit,
goto out_unlock;
}

- drm_gem_object_reference(obj);
+ drm_gem_object_get(obj);

submit->bos[i].obj = msm_obj;

@@ -375,7 +375,7 @@ static void submit_cleanup(struct msm_gem_submit *submit)
struct msm_gem_object *msm_obj = submit->bos[i].obj;
submit_unlock_unpin_bo(submit, i);
list_del_init(&msm_obj->submit_entry);
- drm_gem_object_unreference(&msm_obj->base);
+ drm_gem_object_put(&msm_obj->base);
}

ww_acquire_fini(&submit->ticket);
diff --git a/drivers/gpu/drm/msm/msm_gpu.c b/drivers/gpu/drm/msm/msm_gpu.c
index 9f3dbc2..0d7c58b 100644
--- a/drivers/gpu/drm/msm/msm_gpu.c
+++ b/drivers/gpu/drm/msm/msm_gpu.c
@@ -417,7 +417,7 @@ static void retire_submit(struct msm_gpu *gpu, struct msm_gem_submit *submit)
/* move to inactive: */
msm_gem_move_to_inactive(&msm_obj->base);
msm_gem_put_iova(&msm_obj->base, gpu->aspace);
- drm_gem_object_unreference(&msm_obj->base);
+ drm_gem_object_put(&msm_obj->base);
}

pm_runtime_mark_last_busy(&gpu->pdev->dev);
@@ -496,7 +496,7 @@ void msm_gpu_submit(struct msm_gpu *gpu, struct msm_gem_submit *submit,
WARN_ON(is_active(msm_obj) && (msm_obj->gpu != gpu));

/* submit takes a reference to the bo and iova until retired: */
- drm_gem_object_reference(&msm_obj->base);
+ drm_gem_object_get(&msm_obj->base);
msm_gem_get_iova(&msm_obj->base,
submit->gpu->aspace, &iova);

diff --git a/drivers/gpu/drm/msm/msm_ringbuffer.c b/drivers/gpu/drm/msm/msm_ringbuffer.c
index 791bca3..2ba978b 100644
--- a/drivers/gpu/drm/msm/msm_ringbuffer.c
+++ b/drivers/gpu/drm/msm/msm_ringbuffer.c
@@ -62,7 +62,7 @@ void msm_ringbuffer_destroy(struct msm_ringbuffer *ring)
{
if (ring->bo) {
msm_gem_put_vaddr(ring->bo);
- drm_gem_object_unreference_unlocked(ring->bo);
+ drm_gem_object_put_unlocked(ring->bo);
}
kfree(ring);
}
--
2.7.4

2017-08-11 12:34:51

by Cihangir Akturk

[permalink] [raw]
Subject: [PATCH v3 17/28] drm/omapdrm: 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: Cihangir Akturk <[email protected]>
---
drivers/gpu/drm/omapdrm/omap_drv.c | 2 +-
drivers/gpu/drm/omapdrm/omap_fb.c | 4 ++--
drivers/gpu/drm/omapdrm/omap_fbdev.c | 2 +-
drivers/gpu/drm/omapdrm/omap_gem.c | 4 ++--
drivers/gpu/drm/omapdrm/omap_gem_dmabuf.c | 2 +-
5 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
index 721a358..9223a8a 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.c
+++ b/drivers/gpu/drm/omapdrm/omap_drv.c
@@ -393,7 +393,7 @@ static int ioctl_gem_info(struct drm_device *dev, void *data,
args->size = omap_gem_mmap_size(obj);
args->offset = omap_gem_mmap_offset(obj);

- drm_gem_object_unreference_unlocked(obj);
+ drm_gem_object_put_unlocked(obj);

return ret;
}
diff --git a/drivers/gpu/drm/omapdrm/omap_fb.c b/drivers/gpu/drm/omapdrm/omap_fb.c
index ddf7a45..549196d 100644
--- a/drivers/gpu/drm/omapdrm/omap_fb.c
+++ b/drivers/gpu/drm/omapdrm/omap_fb.c
@@ -91,7 +91,7 @@ static void omap_framebuffer_destroy(struct drm_framebuffer *fb)
for (i = 0; i < n; i++) {
struct plane *plane = &omap_fb->planes[i];

- drm_gem_object_unreference_unlocked(plane->bo);
+ drm_gem_object_put_unlocked(plane->bo);
}

kfree(omap_fb);
@@ -380,7 +380,7 @@ struct drm_framebuffer *omap_framebuffer_create(struct drm_device *dev,

error:
while (--i > 0)
- drm_gem_object_unreference_unlocked(bos[i]);
+ drm_gem_object_put_unlocked(bos[i]);

return fb;
}
diff --git a/drivers/gpu/drm/omapdrm/omap_fbdev.c b/drivers/gpu/drm/omapdrm/omap_fbdev.c
index 9273118..1ada9e1 100644
--- a/drivers/gpu/drm/omapdrm/omap_fbdev.c
+++ b/drivers/gpu/drm/omapdrm/omap_fbdev.c
@@ -149,7 +149,7 @@ static int omap_fbdev_create(struct drm_fb_helper *helper,
/* note: if fb creation failed, we can't rely on fb destroy
* to unref the bo:
*/
- drm_gem_object_unreference_unlocked(fbdev->bo);
+ drm_gem_object_put_unlocked(fbdev->bo);
ret = PTR_ERR(fb);
goto fail;
}
diff --git a/drivers/gpu/drm/omapdrm/omap_gem.c b/drivers/gpu/drm/omapdrm/omap_gem.c
index 5c5c86d..062fb57 100644
--- a/drivers/gpu/drm/omapdrm/omap_gem.c
+++ b/drivers/gpu/drm/omapdrm/omap_gem.c
@@ -665,7 +665,7 @@ int omap_gem_dumb_map_offset(struct drm_file *file, struct drm_device *dev,

*offset = omap_gem_mmap_offset(obj);

- drm_gem_object_unreference_unlocked(obj);
+ drm_gem_object_put_unlocked(obj);

fail:
return ret;
@@ -1299,7 +1299,7 @@ int omap_gem_new_handle(struct drm_device *dev, struct drm_file *file,
}

/* drop reference from allocate - handle holds it now */
- drm_gem_object_unreference_unlocked(obj);
+ drm_gem_object_put_unlocked(obj);

return 0;
}
diff --git a/drivers/gpu/drm/omapdrm/omap_gem_dmabuf.c b/drivers/gpu/drm/omapdrm/omap_gem_dmabuf.c
index 863a881..17cc3ab 100644
--- a/drivers/gpu/drm/omapdrm/omap_gem_dmabuf.c
+++ b/drivers/gpu/drm/omapdrm/omap_gem_dmabuf.c
@@ -189,7 +189,7 @@ struct drm_gem_object *omap_gem_prime_import(struct drm_device *dev,
* Importing dmabuf exported from out own gem increases
* refcount on gem itself instead of f_count of dmabuf.
*/
- drm_gem_object_reference(obj);
+ drm_gem_object_get(obj);
return obj;
}
}
--
2.7.4

2017-08-11 12:34:57

by Cihangir Akturk

[permalink] [raw]
Subject: [PATCH v3 19/28] drm/radeon: 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: Cihangir Akturk <[email protected]>
Reviewed-by: Christian König <[email protected]>
---
drivers/gpu/drm/radeon/radeon_cs.c | 2 +-
drivers/gpu/drm/radeon/radeon_cursor.c | 6 +++---
drivers/gpu/drm/radeon/radeon_display.c | 12 ++++++------
drivers/gpu/drm/radeon/radeon_fb.c | 4 ++--
drivers/gpu/drm/radeon/radeon_gem.c | 30 +++++++++++++++---------------
drivers/gpu/drm/radeon/radeon_object.c | 2 +-
6 files changed, 28 insertions(+), 28 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_cs.c b/drivers/gpu/drm/radeon/radeon_cs.c
index 00b22af..ea0db26 100644
--- a/drivers/gpu/drm/radeon/radeon_cs.c
+++ b/drivers/gpu/drm/radeon/radeon_cs.c
@@ -437,7 +437,7 @@ static void radeon_cs_parser_fini(struct radeon_cs_parser *parser, int error, bo
if (bo == NULL)
continue;

- drm_gem_object_unreference_unlocked(&bo->gem_base);
+ drm_gem_object_put_unlocked(&bo->gem_base);
}
}
kfree(parser->track);
diff --git a/drivers/gpu/drm/radeon/radeon_cursor.c b/drivers/gpu/drm/radeon/radeon_cursor.c
index 4a4f953..9195227 100644
--- a/drivers/gpu/drm/radeon/radeon_cursor.c
+++ b/drivers/gpu/drm/radeon/radeon_cursor.c
@@ -307,7 +307,7 @@ int radeon_crtc_cursor_set2(struct drm_crtc *crtc,
robj = gem_to_radeon_bo(obj);
ret = radeon_bo_reserve(robj, false);
if (ret != 0) {
- drm_gem_object_unreference_unlocked(obj);
+ drm_gem_object_put_unlocked(obj);
return ret;
}
/* Only 27 bit offset for legacy cursor */
@@ -317,7 +317,7 @@ int radeon_crtc_cursor_set2(struct drm_crtc *crtc,
radeon_bo_unreserve(robj);
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;
}

@@ -352,7 +352,7 @@ int radeon_crtc_cursor_set2(struct drm_crtc *crtc,
radeon_bo_unpin(robj);
radeon_bo_unreserve(robj);
}
- drm_gem_object_unreference_unlocked(radeon_crtc->cursor_bo);
+ drm_gem_object_put_unlocked(radeon_crtc->cursor_bo);
}

radeon_crtc->cursor_bo = obj;
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
index 8b7d7a0..207c1a8 100644
--- a/drivers/gpu/drm/radeon/radeon_display.c
+++ b/drivers/gpu/drm/radeon/radeon_display.c
@@ -267,7 +267,7 @@ static void radeon_unpin_work_func(struct work_struct *__work)
} else
DRM_ERROR("failed to reserve buffer after flip\n");

- drm_gem_object_unreference_unlocked(&work->old_rbo->gem_base);
+ drm_gem_object_put_unlocked(&work->old_rbo->gem_base);
kfree(work);
}

@@ -504,7 +504,7 @@ static int radeon_crtc_page_flip_target(struct drm_crtc *crtc,
obj = old_radeon_fb->obj;

/* take a reference to the old object */
- drm_gem_object_reference(obj);
+ drm_gem_object_get(obj);
work->old_rbo = gem_to_radeon_bo(obj);

new_radeon_fb = to_radeon_framebuffer(fb);
@@ -603,7 +603,7 @@ static int radeon_crtc_page_flip_target(struct drm_crtc *crtc,
radeon_bo_unreserve(new_rbo);

cleanup:
- drm_gem_object_unreference_unlocked(&work->old_rbo->gem_base);
+ drm_gem_object_put_unlocked(&work->old_rbo->gem_base);
dma_fence_put(work->fence);
kfree(work);
return r;
@@ -1288,7 +1288,7 @@ static void radeon_user_framebuffer_destroy(struct drm_framebuffer *fb)
{
struct radeon_framebuffer *radeon_fb = to_radeon_framebuffer(fb);

- drm_gem_object_unreference_unlocked(radeon_fb->obj);
+ drm_gem_object_put_unlocked(radeon_fb->obj);
drm_framebuffer_cleanup(fb);
kfree(radeon_fb);
}
@@ -1348,14 +1348,14 @@ radeon_user_framebuffer_create(struct drm_device *dev,

radeon_fb = kzalloc(sizeof(*radeon_fb), GFP_KERNEL);
if (radeon_fb == NULL) {
- drm_gem_object_unreference_unlocked(obj);
+ drm_gem_object_put_unlocked(obj);
return ERR_PTR(-ENOMEM);
}

ret = radeon_framebuffer_init(dev, radeon_fb, mode_cmd, obj);
if (ret) {
kfree(radeon_fb);
- drm_gem_object_unreference_unlocked(obj);
+ drm_gem_object_put_unlocked(obj);
return ERR_PTR(ret);
}

diff --git a/drivers/gpu/drm/radeon/radeon_fb.c b/drivers/gpu/drm/radeon/radeon_fb.c
index 4b8f072..d7308dc 100644
--- a/drivers/gpu/drm/radeon/radeon_fb.c
+++ b/drivers/gpu/drm/radeon/radeon_fb.c
@@ -118,7 +118,7 @@ static void radeonfb_destroy_pinned_object(struct drm_gem_object *gobj)
radeon_bo_unpin(rbo);
radeon_bo_unreserve(rbo);
}
- drm_gem_object_unreference_unlocked(gobj);
+ drm_gem_object_put_unlocked(gobj);
}

static int radeonfb_create_pinned_object(struct radeon_fbdev *rfbdev,
@@ -299,7 +299,7 @@ static int radeonfb_create(struct drm_fb_helper *helper,

}
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);
diff --git a/drivers/gpu/drm/radeon/radeon_gem.c b/drivers/gpu/drm/radeon/radeon_gem.c
index 574bf7e..3386452 100644
--- a/drivers/gpu/drm/radeon/radeon_gem.c
+++ b/drivers/gpu/drm/radeon/radeon_gem.c
@@ -271,7 +271,7 @@ int radeon_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) {
up_read(&rdev->exclusive_lock);
r = radeon_gem_handle_lockup(rdev, r);
@@ -352,7 +352,7 @@ int radeon_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)
goto handle_lockup;

@@ -361,7 +361,7 @@ int radeon_gem_userptr_ioctl(struct drm_device *dev, void *data,
return 0;

release_object:
- drm_gem_object_unreference_unlocked(gobj);
+ drm_gem_object_put_unlocked(gobj);

handle_lockup:
up_read(&rdev->exclusive_lock);
@@ -395,7 +395,7 @@ int radeon_gem_set_domain_ioctl(struct drm_device *dev, void *data,

r = radeon_gem_set_domain(gobj, args->read_domains, args->write_domain);

- drm_gem_object_unreference_unlocked(gobj);
+ drm_gem_object_put_unlocked(gobj);
up_read(&rdev->exclusive_lock);
r = radeon_gem_handle_lockup(robj->rdev, r);
return r;
@@ -414,11 +414,11 @@ int radeon_mode_dumb_mmap(struct drm_file *filp,
}
robj = gem_to_radeon_bo(gobj);
if (radeon_ttm_tt_has_userptr(robj->tbo.ttm)) {
- drm_gem_object_unreference_unlocked(gobj);
+ drm_gem_object_put_unlocked(gobj);
return -EPERM;
}
*offset_p = radeon_bo_mmap_offset(robj);
- drm_gem_object_unreference_unlocked(gobj);
+ drm_gem_object_put_unlocked(gobj);
return 0;
}

@@ -453,7 +453,7 @@ int radeon_gem_busy_ioctl(struct drm_device *dev, void *data,

cur_placement = ACCESS_ONCE(robj->tbo.mem.mem_type);
args->domain = radeon_mem_type_to_domain(cur_placement);
- drm_gem_object_unreference_unlocked(gobj);
+ drm_gem_object_put_unlocked(gobj);
return r;
}

@@ -485,7 +485,7 @@ int radeon_gem_wait_idle_ioctl(struct drm_device *dev, void *data,
if (rdev->asic->mmio_hdp_flush &&
radeon_mem_type_to_domain(cur_placement) == RADEON_GEM_DOMAIN_VRAM)
robj->rdev->asic->mmio_hdp_flush(rdev);
- drm_gem_object_unreference_unlocked(gobj);
+ drm_gem_object_put_unlocked(gobj);
r = radeon_gem_handle_lockup(rdev, r);
return r;
}
@@ -504,7 +504,7 @@ int radeon_gem_set_tiling_ioctl(struct drm_device *dev, void *data,
return -ENOENT;
robj = gem_to_radeon_bo(gobj);
r = radeon_bo_set_tiling_flags(robj, args->tiling_flags, args->pitch);
- drm_gem_object_unreference_unlocked(gobj);
+ drm_gem_object_put_unlocked(gobj);
return r;
}

@@ -527,7 +527,7 @@ int radeon_gem_get_tiling_ioctl(struct drm_device *dev, void *data,
radeon_bo_get_tiling_flags(rbo, &args->tiling_flags, &args->pitch);
radeon_bo_unreserve(rbo);
out:
- drm_gem_object_unreference_unlocked(gobj);
+ drm_gem_object_put_unlocked(gobj);
return r;
}

@@ -661,14 +661,14 @@ int radeon_gem_va_ioctl(struct drm_device *dev, void *data,
r = radeon_bo_reserve(rbo, false);
if (r) {
args->operation = RADEON_VA_RESULT_ERROR;
- drm_gem_object_unreference_unlocked(gobj);
+ drm_gem_object_put_unlocked(gobj);
return r;
}
bo_va = radeon_vm_bo_find(&fpriv->vm, rbo);
if (!bo_va) {
args->operation = RADEON_VA_RESULT_ERROR;
radeon_bo_unreserve(rbo);
- drm_gem_object_unreference_unlocked(gobj);
+ drm_gem_object_put_unlocked(gobj);
return -ENOENT;
}

@@ -695,7 +695,7 @@ int radeon_gem_va_ioctl(struct drm_device *dev, void *data,
args->operation = RADEON_VA_RESULT_ERROR;
}
out:
- drm_gem_object_unreference_unlocked(gobj);
+ drm_gem_object_put_unlocked(gobj);
return r;
}

@@ -736,7 +736,7 @@ int radeon_gem_op_ioctl(struct drm_device *dev, void *data,

radeon_bo_unreserve(robj);
out:
- drm_gem_object_unreference_unlocked(gobj);
+ drm_gem_object_put_unlocked(gobj);
return r;
}

@@ -762,7 +762,7 @@ int radeon_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;
}
diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c
index 8b72229..ad2a2fd 100644
--- a/drivers/gpu/drm/radeon/radeon_object.c
+++ b/drivers/gpu/drm/radeon/radeon_object.c
@@ -445,7 +445,7 @@ void radeon_bo_force_delete(struct radeon_device *rdev)
list_del_init(&bo->list);
mutex_unlock(&bo->rdev->gem.mutex);
/* this should unref the ttm bo */
- drm_gem_object_unreference_unlocked(&bo->gem_base);
+ drm_gem_object_put_unlocked(&bo->gem_base);
}
}

--
2.7.4

2017-08-11 12:35:24

by Cihangir Akturk

[permalink] [raw]
Subject: [PATCH v3 20/28] drm/rockchip: 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: Cihangir Akturk <[email protected]>
---
drivers/gpu/drm/rockchip/rockchip_drm_fb.c | 6 +++---
drivers/gpu/drm/rockchip/rockchip_drm_fbdev.c | 2 +-
drivers/gpu/drm/rockchip/rockchip_drm_gem.c | 2 +-
drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 4 ++--
4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c
index 8a0f756..7077304 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c
@@ -48,7 +48,7 @@ static void rockchip_drm_fb_destroy(struct drm_framebuffer *fb)
int i;

for (i = 0; i < ROCKCHIP_MAX_FB_BUFFER; i++)
- drm_gem_object_unreference_unlocked(rockchip_fb->obj[i]);
+ drm_gem_object_put_unlocked(rockchip_fb->obj[i]);

drm_framebuffer_cleanup(fb);
kfree(rockchip_fb);
@@ -144,7 +144,7 @@ rockchip_user_fb_create(struct drm_device *dev, struct drm_file *file_priv,
width * drm_format_plane_cpp(mode_cmd->pixel_format, i);

if (obj->size < min_size) {
- drm_gem_object_unreference_unlocked(obj);
+ drm_gem_object_put_unlocked(obj);
ret = -EINVAL;
goto err_gem_object_unreference;
}
@@ -161,7 +161,7 @@ rockchip_user_fb_create(struct drm_device *dev, struct drm_file *file_priv,

err_gem_object_unreference:
for (i--; i >= 0; i--)
- drm_gem_object_unreference_unlocked(objs[i]);
+ drm_gem_object_put_unlocked(objs[i]);
return ERR_PTR(ret);
}

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_fbdev.c b/drivers/gpu/drm/rockchip/rockchip_drm_fbdev.c
index ce946b9..724579e 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_fbdev.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_fbdev.c
@@ -173,7 +173,7 @@ void rockchip_drm_fbdev_fini(struct drm_device *dev)
drm_fb_helper_unregister_fbi(helper);

if (helper->fb)
- drm_framebuffer_unreference(helper->fb);
+ drm_framebuffer_put(helper->fb);

drm_fb_helper_fini(helper);
}
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c
index f74333e..1869c8b 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c
@@ -383,7 +383,7 @@ rockchip_gem_create_with_handle(struct drm_file *file_priv,
goto err_handle_create;

/* drop reference from allocate - handle holds it now. */
- drm_gem_object_unreference_unlocked(obj);
+ drm_gem_object_put_unlocked(obj);

return rk_obj;

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
index 948719d..bf9ed0e 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
@@ -1026,7 +1026,7 @@ static void vop_crtc_atomic_flush(struct drm_crtc *crtc,
if (old_plane_state->fb == new_plane_state->fb)
continue;

- drm_framebuffer_reference(old_plane_state->fb);
+ drm_framebuffer_get(old_plane_state->fb);
drm_flip_work_queue(&vop->fb_unref_work, old_plane_state->fb);
set_bit(VOP_PENDING_FB_UNREF, &vop->pending);
WARN_ON(drm_crtc_vblank_get(crtc) != 0);
@@ -1150,7 +1150,7 @@ static void vop_fb_unref_worker(struct drm_flip_work *work, void *val)
struct drm_framebuffer *fb = val;

drm_crtc_vblank_put(&vop->crtc);
- drm_framebuffer_unreference(fb);
+ drm_framebuffer_put(fb);
}

static void vop_handle_vblank(struct vop *vop)
--
2.7.4

2017-08-11 12:35:31

by Cihangir Akturk

[permalink] [raw]
Subject: [PATCH v3 25/28] drm/vgem: 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: Cihangir Akturk <[email protected]>
---
drivers/gpu/drm/vgem/vgem_drv.c | 4 ++--
drivers/gpu/drm/vgem/vgem_fence.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/vgem/vgem_drv.c b/drivers/gpu/drm/vgem/vgem_drv.c
index 1228967..2524ff1 100644
--- a/drivers/gpu/drm/vgem/vgem_drv.c
+++ b/drivers/gpu/drm/vgem/vgem_drv.c
@@ -190,7 +190,7 @@ static struct drm_gem_object *vgem_gem_create(struct drm_device *dev,
return ERR_CAST(obj);

ret = drm_gem_handle_create(file, &obj->base, handle);
- drm_gem_object_unreference_unlocked(&obj->base);
+ drm_gem_object_put_unlocked(&obj->base);
if (ret)
goto err;

@@ -245,7 +245,7 @@ static int vgem_gem_dumb_map(struct drm_file *file, struct drm_device *dev,

*offset = drm_vma_node_offset_addr(&obj->vma_node);
unref:
- drm_gem_object_unreference_unlocked(obj);
+ drm_gem_object_put_unlocked(obj);

return ret;
}
diff --git a/drivers/gpu/drm/vgem/vgem_fence.c b/drivers/gpu/drm/vgem/vgem_fence.c
index 3109c83..8fd52f2 100644
--- a/drivers/gpu/drm/vgem/vgem_fence.c
+++ b/drivers/gpu/drm/vgem/vgem_fence.c
@@ -213,7 +213,7 @@ int vgem_fence_attach_ioctl(struct drm_device *dev,
dma_fence_put(fence);
}
err:
- drm_gem_object_unreference_unlocked(obj);
+ drm_gem_object_put_unlocked(obj);
return ret;
}

--
2.7.4

2017-08-11 12:35:35

by Cihangir Akturk

[permalink] [raw]
Subject: [PATCH v3 27/28] drm/vmwgfx: 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: Cihangir Akturk <[email protected]>
Reviewed-by: Thomas Hellstrom <[email protected]>
---
drivers/gpu/drm/vmwgfx/vmwgfx_fb.c | 2 +-
drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c b/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c
index d23a18a..be7d7fb 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c
@@ -500,7 +500,7 @@ static int vmw_fb_kms_detach(struct vmw_fb_par *par,
}

if (cur_fb) {
- drm_framebuffer_unreference(cur_fb);
+ drm_framebuffer_put(cur_fb);
par->set_fb = NULL;
}

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c b/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c
index 5ec24fd..fd4a988 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c
@@ -316,7 +316,7 @@ int vmw_present_ioctl(struct drm_device *dev, void *data,
out_no_surface:
ttm_read_unlock(&dev_priv->reservation_sem);
out_no_ttm_lock:
- drm_framebuffer_unreference(fb);
+ drm_framebuffer_put(fb);
out_no_fb:
drm_modeset_unlock_all(dev);
out_no_copy:
@@ -393,7 +393,7 @@ int vmw_present_readback_ioctl(struct drm_device *dev, void *data,

ttm_read_unlock(&dev_priv->reservation_sem);
out_no_ttm_lock:
- drm_framebuffer_unreference(fb);
+ drm_framebuffer_put(fb);
out_no_fb:
drm_modeset_unlock_all(dev);
out_no_copy:
--
2.7.4

2017-08-11 12:35:47

by Cihangir Akturk

[permalink] [raw]
Subject: [PATCH v3 28/28] drm: vboxvideo: 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: Cihangir Akturk <[email protected]>
---
drivers/staging/vboxvideo/vbox_fb.c | 2 +-
drivers/staging/vboxvideo/vbox_main.c | 8 ++++----
drivers/staging/vboxvideo/vbox_mode.c | 2 +-
3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/vboxvideo/vbox_fb.c b/drivers/staging/vboxvideo/vbox_fb.c
index bf66358..c157284 100644
--- a/drivers/staging/vboxvideo/vbox_fb.c
+++ b/drivers/staging/vboxvideo/vbox_fb.c
@@ -343,7 +343,7 @@ void vbox_fbdev_fini(struct drm_device *dev)
vbox_bo_unpin(bo);
vbox_bo_unreserve(bo);
}
- drm_gem_object_unreference_unlocked(afb->obj);
+ drm_gem_object_put_unlocked(afb->obj);
afb->obj = NULL;
}
drm_fb_helper_fini(&fbdev->helper);
diff --git a/drivers/staging/vboxvideo/vbox_main.c b/drivers/staging/vboxvideo/vbox_main.c
index d0c6ec7..80bd039 100644
--- a/drivers/staging/vboxvideo/vbox_main.c
+++ b/drivers/staging/vboxvideo/vbox_main.c
@@ -40,7 +40,7 @@ static void vbox_user_framebuffer_destroy(struct drm_framebuffer *fb)
struct vbox_framebuffer *vbox_fb = to_vbox_framebuffer(fb);

if (vbox_fb->obj)
- drm_gem_object_unreference_unlocked(vbox_fb->obj);
+ drm_gem_object_put_unlocked(vbox_fb->obj);

drm_framebuffer_cleanup(fb);
kfree(fb);
@@ -198,7 +198,7 @@ static struct drm_framebuffer *vbox_user_framebuffer_create(
err_free_vbox_fb:
kfree(vbox_fb);
err_unref_obj:
- drm_gem_object_unreference_unlocked(obj);
+ drm_gem_object_put_unlocked(obj);
return ERR_PTR(ret);
}

@@ -472,7 +472,7 @@ int vbox_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;

@@ -525,7 +525,7 @@ vbox_dumb_mmap_offset(struct drm_file *file,
bo = gem_to_vbox_bo(obj);
*offset = vbox_bo_mmap_offset(bo);

- drm_gem_object_unreference(obj);
+ drm_gem_object_put(obj);
ret = 0;

out_unlock:
diff --git a/drivers/staging/vboxvideo/vbox_mode.c b/drivers/staging/vboxvideo/vbox_mode.c
index 996da1c..e5b6383 100644
--- a/drivers/staging/vboxvideo/vbox_mode.c
+++ b/drivers/staging/vboxvideo/vbox_mode.c
@@ -812,7 +812,7 @@ static int vbox_cursor_set2(struct drm_crtc *crtc, struct drm_file *file_priv,
out_unreserve_bo:
vbox_bo_unreserve(bo);
out_unref_obj:
- drm_gem_object_unreference_unlocked(obj);
+ drm_gem_object_put_unlocked(obj);

return ret;
}
--
2.7.4

2017-08-11 12:35:28

by Cihangir Akturk

[permalink] [raw]
Subject: [PATCH v3 24/28] drm/vc4: 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: Cihangir Akturk <[email protected]>
---
drivers/gpu/drm/vc4/vc4_bo.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/vc4/vc4_bo.c b/drivers/gpu/drm/vc4/vc4_bo.c
index facee39..3afdbf4 100644
--- a/drivers/gpu/drm/vc4/vc4_bo.c
+++ b/drivers/gpu/drm/vc4/vc4_bo.c
@@ -830,7 +830,7 @@ int vc4_label_bo_ioctl(struct drm_device *dev, void *data,
ret = -ENOMEM;
mutex_unlock(&vc4->bo_lock);

- drm_gem_object_unreference_unlocked(gem_obj);
+ drm_gem_object_put_unlocked(gem_obj);

return ret;
}
--
2.7.4

2017-08-11 12:37:02

by Cihangir Akturk

[permalink] [raw]
Subject: [PATCH v3 26/28] drm/virtio: 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: Cihangir Akturk <[email protected]>
---
drivers/gpu/drm/virtio/virtgpu_display.c | 4 ++--
drivers/gpu/drm/virtio/virtgpu_gem.c | 4 ++--
drivers/gpu/drm/virtio/virtgpu_ioctl.c | 14 +++++++-------
3 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/virtio/virtgpu_display.c b/drivers/gpu/drm/virtio/virtgpu_display.c
index b6d5205..41b0930 100644
--- a/drivers/gpu/drm/virtio/virtgpu_display.c
+++ b/drivers/gpu/drm/virtio/virtgpu_display.c
@@ -53,7 +53,7 @@ static void virtio_gpu_user_framebuffer_destroy(struct drm_framebuffer *fb)
struct virtio_gpu_framebuffer *virtio_gpu_fb
= to_virtio_gpu_framebuffer(fb);

- drm_gem_object_unreference_unlocked(virtio_gpu_fb->obj);
+ drm_gem_object_put_unlocked(virtio_gpu_fb->obj);
drm_framebuffer_cleanup(fb);
kfree(virtio_gpu_fb);
}
@@ -327,7 +327,7 @@ virtio_gpu_user_framebuffer_create(struct drm_device *dev,
ret = virtio_gpu_framebuffer_init(dev, virtio_gpu_fb, mode_cmd, obj);
if (ret) {
kfree(virtio_gpu_fb);
- drm_gem_object_unreference_unlocked(obj);
+ drm_gem_object_put_unlocked(obj);
return NULL;
}

diff --git a/drivers/gpu/drm/virtio/virtgpu_gem.c b/drivers/gpu/drm/virtio/virtgpu_gem.c
index cc025d8..78da210 100644
--- a/drivers/gpu/drm/virtio/virtgpu_gem.c
+++ b/drivers/gpu/drm/virtio/virtgpu_gem.c
@@ -72,7 +72,7 @@ int virtio_gpu_gem_create(struct drm_file *file,
*obj_p = &obj->gem_base;

/* drop reference from allocate - handle holds it now */
- drm_gem_object_unreference_unlocked(&obj->gem_base);
+ drm_gem_object_put_unlocked(&obj->gem_base);

*handle_p = handle;
return 0;
@@ -137,7 +137,7 @@ int virtio_gpu_mode_dumb_mmap(struct drm_file *file_priv,
return -ENOENT;
obj = gem_to_virtio_gpu_obj(gobj);
*offset_p = virtio_gpu_object_mmap_offset(obj);
- drm_gem_object_unreference_unlocked(gobj);
+ drm_gem_object_put_unlocked(gobj);
return 0;
}

diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
index b94bd54..461f81a 100644
--- a/drivers/gpu/drm/virtio/virtgpu_ioctl.c
+++ b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
@@ -86,7 +86,7 @@ static void virtio_gpu_unref_list(struct list_head *head)
bo = buf->bo;
qobj = container_of(bo, struct virtio_gpu_object, tbo);

- drm_gem_object_unreference_unlocked(&qobj->gem_base);
+ drm_gem_object_put_unlocked(&qobj->gem_base);
}
}

@@ -261,7 +261,7 @@ static int virtio_gpu_resource_create_ioctl(struct drm_device *dev, void *data,
ret = virtio_gpu_object_attach(vgdev, qobj, res_id, NULL);
} else {
/* use a gem reference since unref list undoes them */
- drm_gem_object_reference(&qobj->gem_base);
+ drm_gem_object_get(&qobj->gem_base);
mainbuf.bo = &qobj->tbo;
list_add(&mainbuf.head, &validate_list);

@@ -304,7 +304,7 @@ static int virtio_gpu_resource_create_ioctl(struct drm_device *dev, void *data,
}
return ret;
}
- drm_gem_object_unreference_unlocked(obj);
+ drm_gem_object_put_unlocked(obj);

rc->res_handle = res_id; /* similiar to a VM address */
rc->bo_handle = handle;
@@ -341,7 +341,7 @@ static int virtio_gpu_resource_info_ioctl(struct drm_device *dev, void *data,

ri->size = qobj->gem_base.size;
ri->res_handle = qobj->hw_res_handle;
- drm_gem_object_unreference_unlocked(gobj);
+ drm_gem_object_put_unlocked(gobj);
return 0;
}

@@ -389,7 +389,7 @@ static int virtio_gpu_transfer_from_host_ioctl(struct drm_device *dev,
out_unres:
virtio_gpu_object_unreserve(qobj);
out:
- drm_gem_object_unreference_unlocked(gobj);
+ drm_gem_object_put_unlocked(gobj);
return ret;
}

@@ -439,7 +439,7 @@ static int virtio_gpu_transfer_to_host_ioctl(struct drm_device *dev, void *data,
out_unres:
virtio_gpu_object_unreserve(qobj);
out:
- drm_gem_object_unreference_unlocked(gobj);
+ drm_gem_object_put_unlocked(gobj);
return ret;
}

@@ -462,7 +462,7 @@ static int virtio_gpu_wait_ioctl(struct drm_device *dev, void *data,
nowait = true;
ret = virtio_gpu_object_wait(qobj, nowait);

- drm_gem_object_unreference_unlocked(gobj);
+ drm_gem_object_put_unlocked(gobj);
return ret;
}

--
2.7.4

2017-08-11 12:37:48

by Cihangir Akturk

[permalink] [raw]
Subject: [PATCH v3 23/28] drm/udl: 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: Cihangir Akturk <[email protected]>
---
drivers/gpu/drm/udl/udl_fb.c | 6 +++---
drivers/gpu/drm/udl/udl_gem.c | 4 ++--
2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/udl/udl_fb.c b/drivers/gpu/drm/udl/udl_fb.c
index 77a2c59..b7ca90d 100644
--- a/drivers/gpu/drm/udl/udl_fb.c
+++ b/drivers/gpu/drm/udl/udl_fb.c
@@ -309,7 +309,7 @@ static void udl_user_framebuffer_destroy(struct drm_framebuffer *fb)
struct udl_framebuffer *ufb = to_udl_fb(fb);

if (ufb->obj)
- drm_gem_object_unreference_unlocked(&ufb->obj->base);
+ drm_gem_object_put_unlocked(&ufb->obj->base);

drm_framebuffer_cleanup(fb);
kfree(ufb);
@@ -403,7 +403,7 @@ static int udlfb_create(struct drm_fb_helper *helper,

return ret;
out_gfree:
- drm_gem_object_unreference_unlocked(&ufbdev->ufb.obj->base);
+ drm_gem_object_put_unlocked(&ufbdev->ufb.obj->base);
out:
return ret;
}
@@ -419,7 +419,7 @@ static void udl_fbdev_destroy(struct drm_device *dev,
drm_fb_helper_fini(&ufbdev->helper);
drm_framebuffer_unregister_private(&ufbdev->ufb.base);
drm_framebuffer_cleanup(&ufbdev->ufb.base);
- drm_gem_object_unreference_unlocked(&ufbdev->ufb.obj->base);
+ drm_gem_object_put_unlocked(&ufbdev->ufb.obj->base);
}

int udl_fbdev_init(struct drm_device *dev)
diff --git a/drivers/gpu/drm/udl/udl_gem.c b/drivers/gpu/drm/udl/udl_gem.c
index db9cece..dee6bd9 100644
--- a/drivers/gpu/drm/udl/udl_gem.c
+++ b/drivers/gpu/drm/udl/udl_gem.c
@@ -52,7 +52,7 @@ udl_gem_create(struct drm_file *file,
return ret;
}

- drm_gem_object_unreference_unlocked(&obj->base);
+ drm_gem_object_put_unlocked(&obj->base);
*handle_p = handle;
return 0;
}
@@ -234,7 +234,7 @@ int udl_gem_mmap(struct drm_file *file, struct drm_device *dev,
*offset = drm_vma_node_offset_addr(&gobj->base.vma_node);

out:
- drm_gem_object_unreference(&gobj->base);
+ drm_gem_object_put(&gobj->base);
unlock:
mutex_unlock(&dev->struct_mutex);
return ret;
--
2.7.4

2017-08-11 12:35:22

by Cihangir Akturk

[permalink] [raw]
Subject: [PATCH v3 21/28] 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: Cihangir Akturk <[email protected]>
---
drivers/gpu/drm/tegra/drm.c | 12 ++++++------
drivers/gpu/drm/tegra/fb.c | 8 ++++----
drivers/gpu/drm/tegra/gem.c | 10 +++++-----
3 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c
index 3ba659a..e70c67b 100644
--- a/drivers/gpu/drm/tegra/drm.c
+++ b/drivers/gpu/drm/tegra/drm.c
@@ -306,7 +306,7 @@ host1x_bo_lookup(struct drm_file *file, u32 handle)
if (!gem)
return NULL;

- drm_gem_object_unreference_unlocked(gem);
+ drm_gem_object_put_unlocked(gem);

bo = to_tegra_bo(gem);
return &bo->base;
@@ -593,7 +593,7 @@ static int tegra_gem_mmap(struct drm_device *drm, void *data,

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;
}
@@ -860,7 +860,7 @@ static int tegra_gem_set_tiling(struct drm_device *drm, void *data,
bo->tiling.mode = mode;
bo->tiling.value = value;

- drm_gem_object_unreference_unlocked(gem);
+ drm_gem_object_put_unlocked(gem);

return 0;
}
@@ -900,7 +900,7 @@ static int tegra_gem_get_tiling(struct drm_device *drm, void *data,
break;
}

- drm_gem_object_unreference_unlocked(gem);
+ drm_gem_object_put_unlocked(gem);

return err;
}
@@ -925,7 +925,7 @@ static int tegra_gem_set_flags(struct drm_device *drm, void *data,
if (args->flags & DRM_TEGRA_GEM_BOTTOM_UP)
bo->flags |= TEGRA_BO_BOTTOM_UP;

- drm_gem_object_unreference_unlocked(gem);
+ drm_gem_object_put_unlocked(gem);

return 0;
}
@@ -947,7 +947,7 @@ static int tegra_gem_get_flags(struct drm_device *drm, void *data,
if (bo->flags & TEGRA_BO_BOTTOM_UP)
args->flags |= DRM_TEGRA_GEM_BOTTOM_UP;

- drm_gem_object_unreference_unlocked(gem);
+ drm_gem_object_put_unlocked(gem);

return 0;
}
diff --git a/drivers/gpu/drm/tegra/fb.c b/drivers/gpu/drm/tegra/fb.c
index 25acb73..80540c1 100644
--- a/drivers/gpu/drm/tegra/fb.c
+++ b/drivers/gpu/drm/tegra/fb.c
@@ -88,7 +88,7 @@ static void tegra_fb_destroy(struct drm_framebuffer *framebuffer)
if (bo->pages)
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,

unreference:
while (i--)
- drm_gem_object_unreference_unlocked(&planes[i]->gem);
+ drm_gem_object_put_unlocked(&planes[i]->gem);

return ERR_PTR(err);
}
@@ -242,7 +242,7 @@ static int tegra_fbdev_probe(struct drm_fb_helper *helper,
info = drm_fb_helper_alloc_fbi(helper);
if (IS_ERR(info)) {
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);
}

@@ -251,7 +251,7 @@ static int tegra_fbdev_probe(struct drm_fb_helper *helper,
err = PTR_ERR(fbdev->fb);
dev_err(drm->dev, "failed to allocate DRM framebuffer: %d\n",
err);
- drm_gem_object_unreference_unlocked(&bo->gem);
+ drm_gem_object_put_unlocked(&bo->gem);
return PTR_ERR(fbdev->fb);
}

diff --git a/drivers/gpu/drm/tegra/gem.c b/drivers/gpu/drm/tegra/gem.c
index 7a39a35..fe77bcd 100644
--- a/drivers/gpu/drm/tegra/gem.c
+++ b/drivers/gpu/drm/tegra/gem.c
@@ -24,7 +24,7 @@ static void tegra_bo_put(struct host1x_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)
@@ -95,7 +95,7 @@ static struct host1x_bo *tegra_bo_get(struct host1x_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;
}
@@ -325,7 +325,7 @@ struct tegra_bo *tegra_bo_create_with_handle(struct drm_file *file,
return ERR_PTR(err);
}

- drm_gem_object_unreference_unlocked(&bo->gem);
+ drm_gem_object_put_unlocked(&bo->gem);

return bo;
}
@@ -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);

- drm_gem_object_unreference_unlocked(gem);
+ drm_gem_object_put_unlocked(gem);

return 0;
}
@@ -654,7 +654,7 @@ struct drm_gem_object *tegra_gem_prime_import(struct drm_device *drm,
struct drm_gem_object *gem = buf->priv;

if (gem->dev == drm) {
- drm_gem_object_reference(gem);
+ drm_gem_object_get(gem);
return gem;
}
}
--
2.7.4

2017-08-11 12:35:21

by Cihangir Akturk

[permalink] [raw]
Subject: [PATCH v3 22/28] drm/tilcdc: 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: Cihangir Akturk <[email protected]>
Acked-by: Jyri Sarha <[email protected]>
---
drivers/gpu/drm/tilcdc/tilcdc_crtc.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
index 406fe45..d2589f310 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
@@ -75,7 +75,7 @@ static void unref_worker(struct drm_flip_work *work, void *val)
struct drm_device *dev = tilcdc_crtc->base.dev;

mutex_lock(&dev->mode_config.mutex);
- drm_framebuffer_unreference(val);
+ drm_framebuffer_put(val);
mutex_unlock(&dev->mode_config.mutex);
}

@@ -456,7 +456,7 @@ static void tilcdc_crtc_set_mode(struct drm_crtc *crtc)

set_scanout(crtc, fb);

- drm_framebuffer_reference(fb);
+ drm_framebuffer_get(fb);

crtc->hwmode = crtc->state->adjusted_mode;
}
@@ -633,7 +633,7 @@ int tilcdc_crtc_update_fb(struct drm_crtc *crtc,
return -EBUSY;
}

- drm_framebuffer_reference(fb);
+ drm_framebuffer_get(fb);

crtc->primary->fb = fb;
tilcdc_crtc->event = event;
--
2.7.4

2017-08-11 12:38:40

by Cihangir Akturk

[permalink] [raw]
Subject: [PATCH v3 18/28] drm/qxl: 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: Cihangir Akturk <[email protected]>
---
drivers/gpu/drm/qxl/qxl_display.c | 4 ++--
drivers/gpu/drm/qxl/qxl_dumb.c | 2 +-
drivers/gpu/drm/qxl/qxl_fb.c | 6 +++---
drivers/gpu/drm/qxl/qxl_gem.c | 2 +-
drivers/gpu/drm/qxl/qxl_ioctl.c | 4 ++--
drivers/gpu/drm/qxl/qxl_object.c | 6 +++---
6 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/qxl/qxl_display.c b/drivers/gpu/drm/qxl/qxl_display.c
index 14c5613..a54a766 100644
--- a/drivers/gpu/drm/qxl/qxl_display.c
+++ b/drivers/gpu/drm/qxl/qxl_display.c
@@ -306,7 +306,7 @@ void qxl_user_framebuffer_destroy(struct drm_framebuffer *fb)
{
struct qxl_framebuffer *qxl_fb = to_qxl_framebuffer(fb);

- drm_gem_object_unreference_unlocked(qxl_fb->obj);
+ drm_gem_object_put_unlocked(qxl_fb->obj);
drm_framebuffer_cleanup(fb);
kfree(qxl_fb);
}
@@ -1106,7 +1106,7 @@ qxl_user_framebuffer_create(struct drm_device *dev,
ret = qxl_framebuffer_init(dev, qxl_fb, mode_cmd, obj, &qxl_fb_funcs);
if (ret) {
kfree(qxl_fb);
- drm_gem_object_unreference_unlocked(obj);
+ drm_gem_object_put_unlocked(obj);
return NULL;
}

diff --git a/drivers/gpu/drm/qxl/qxl_dumb.c b/drivers/gpu/drm/qxl/qxl_dumb.c
index 5e65d5d..a0c9e73 100644
--- a/drivers/gpu/drm/qxl/qxl_dumb.c
+++ b/drivers/gpu/drm/qxl/qxl_dumb.c
@@ -81,6 +81,6 @@ int qxl_mode_dumb_mmap(struct drm_file *file_priv,
return -ENOENT;
qobj = gem_to_qxl_bo(gobj);
*offset_p = qxl_bo_mmap_offset(qobj);
- drm_gem_object_unreference_unlocked(gobj);
+ drm_gem_object_put_unlocked(gobj);
return 0;
}
diff --git a/drivers/gpu/drm/qxl/qxl_fb.c b/drivers/gpu/drm/qxl/qxl_fb.c
index 844c4a3..52903ef 100644
--- a/drivers/gpu/drm/qxl/qxl_fb.c
+++ b/drivers/gpu/drm/qxl/qxl_fb.c
@@ -95,7 +95,7 @@ static void qxlfb_destroy_pinned_object(struct drm_gem_object *gobj)
qxl_bo_kunmap(qbo);
qxl_bo_unpin(qbo);

- drm_gem_object_unreference_unlocked(gobj);
+ drm_gem_object_put_unlocked(gobj);
}

int qxl_get_handle_for_primary_fb(struct qxl_device *qdev,
@@ -319,11 +319,11 @@ static int qxlfb_create(struct qxl_fbdev *qfbdev,
qxl_bo_unpin(qbo);
}
if (fb && ret) {
- drm_gem_object_unreference_unlocked(gobj);
+ drm_gem_object_put_unlocked(gobj);
drm_framebuffer_cleanup(fb);
kfree(fb);
}
- drm_gem_object_unreference_unlocked(gobj);
+ drm_gem_object_put_unlocked(gobj);
return ret;
}

diff --git a/drivers/gpu/drm/qxl/qxl_gem.c b/drivers/gpu/drm/qxl/qxl_gem.c
index 85f5467..f5c1e78 100644
--- a/drivers/gpu/drm/qxl/qxl_gem.c
+++ b/drivers/gpu/drm/qxl/qxl_gem.c
@@ -98,7 +98,7 @@ int qxl_gem_object_create_with_handle(struct qxl_device *qdev,
return r;
/* drop reference from allocate - handle holds it now */
*qobj = gem_to_qxl_bo(gobj);
- drm_gem_object_unreference_unlocked(gobj);
+ drm_gem_object_put_unlocked(gobj);
return 0;
}

diff --git a/drivers/gpu/drm/qxl/qxl_ioctl.c b/drivers/gpu/drm/qxl/qxl_ioctl.c
index 31effed..7b141db 100644
--- a/drivers/gpu/drm/qxl/qxl_ioctl.c
+++ b/drivers/gpu/drm/qxl/qxl_ioctl.c
@@ -121,7 +121,7 @@ static int qxlhw_handle_to_bo(struct drm_file *file_priv, uint64_t handle,
qobj = gem_to_qxl_bo(gobj);

ret = qxl_release_list_add(release, qobj);
- drm_gem_object_unreference_unlocked(gobj);
+ drm_gem_object_put_unlocked(gobj);
if (ret)
return ret;

@@ -343,7 +343,7 @@ static int qxl_update_area_ioctl(struct drm_device *dev, void *data,
qxl_bo_unreserve(qobj);

out:
- drm_gem_object_unreference_unlocked(gobj);
+ drm_gem_object_put_unlocked(gobj);
return ret;
}

diff --git a/drivers/gpu/drm/qxl/qxl_object.c b/drivers/gpu/drm/qxl/qxl_object.c
index 0a67ddf..c4aebcf 100644
--- a/drivers/gpu/drm/qxl/qxl_object.c
+++ b/drivers/gpu/drm/qxl/qxl_object.c
@@ -211,13 +211,13 @@ void qxl_bo_unref(struct qxl_bo **bo)
if ((*bo) == NULL)
return;

- drm_gem_object_unreference_unlocked(&(*bo)->gem_base);
+ drm_gem_object_put_unlocked(&(*bo)->gem_base);
*bo = NULL;
}

struct qxl_bo *qxl_bo_ref(struct qxl_bo *bo)
{
- drm_gem_object_reference(&bo->gem_base);
+ drm_gem_object_get(&bo->gem_base);
return bo;
}

@@ -316,7 +316,7 @@ void qxl_bo_force_delete(struct qxl_device *qdev)
list_del_init(&bo->list);
mutex_unlock(&qdev->gem.mutex);
/* this should unref the ttm bo */
- drm_gem_object_unreference_unlocked(&bo->gem_base);
+ drm_gem_object_put_unlocked(&bo->gem_base);
}
}

--
2.7.4

2017-08-11 12:38:59

by Cihangir Akturk

[permalink] [raw]
Subject: [PATCH v3 16/28] drm/nouveau: 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: Cihangir Akturk <[email protected]>
Reviewed-by: Tobias Klausmann <[email protected]>
---
drivers/gpu/drm/nouveau/dispnv04/crtc.c | 2 +-
drivers/gpu/drm/nouveau/nouveau_abi16.c | 2 +-
drivers/gpu/drm/nouveau/nouveau_display.c | 8 ++++----
drivers/gpu/drm/nouveau/nouveau_fbcon.c | 2 +-
drivers/gpu/drm/nouveau/nouveau_gem.c | 14 +++++++-------
drivers/gpu/drm/nouveau/nv50_display.c | 2 +-
6 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/dispnv04/crtc.c b/drivers/gpu/drm/nouveau/dispnv04/crtc.c
index 8f689f1..444d827 100644
--- a/drivers/gpu/drm/nouveau/dispnv04/crtc.c
+++ b/drivers/gpu/drm/nouveau/dispnv04/crtc.c
@@ -1017,7 +1017,7 @@ nv04_crtc_cursor_set(struct drm_crtc *crtc, struct drm_file *file_priv,
nv_crtc->cursor.set_offset(nv_crtc, nv_crtc->cursor.offset);
nv_crtc->cursor.show(nv_crtc, true);
out:
- drm_gem_object_unreference_unlocked(gem);
+ drm_gem_object_put_unlocked(gem);
return ret;
}

diff --git a/drivers/gpu/drm/nouveau/nouveau_abi16.c b/drivers/gpu/drm/nouveau/nouveau_abi16.c
index f98f800..3e9db5a 100644
--- a/drivers/gpu/drm/nouveau/nouveau_abi16.c
+++ b/drivers/gpu/drm/nouveau/nouveau_abi16.c
@@ -136,7 +136,7 @@ nouveau_abi16_chan_fini(struct nouveau_abi16 *abi16,
if (chan->ntfy) {
nouveau_bo_vma_del(chan->ntfy, &chan->ntfy_vma);
nouveau_bo_unpin(chan->ntfy);
- drm_gem_object_unreference_unlocked(&chan->ntfy->gem);
+ drm_gem_object_put_unlocked(&chan->ntfy->gem);
}

if (chan->heap.block_size)
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c
index b9a109b..73cb82f 100644
--- a/drivers/gpu/drm/nouveau/nouveau_display.c
+++ b/drivers/gpu/drm/nouveau/nouveau_display.c
@@ -204,7 +204,7 @@ nouveau_user_framebuffer_destroy(struct drm_framebuffer *drm_fb)
struct nouveau_framebuffer *fb = nouveau_framebuffer(drm_fb);

if (fb->nvbo)
- drm_gem_object_unreference_unlocked(&fb->nvbo->gem);
+ drm_gem_object_put_unlocked(&fb->nvbo->gem);

drm_framebuffer_cleanup(drm_fb);
kfree(fb);
@@ -265,7 +265,7 @@ nouveau_user_framebuffer_create(struct drm_device *dev,
if (ret == 0)
return &fb->base;

- drm_gem_object_unreference_unlocked(gem);
+ drm_gem_object_put_unlocked(gem);
return ERR_PTR(ret);
}

@@ -945,7 +945,7 @@ nouveau_display_dumb_create(struct drm_file *file_priv, struct drm_device *dev,
return ret;

ret = drm_gem_handle_create(file_priv, &bo->gem, &args->handle);
- drm_gem_object_unreference_unlocked(&bo->gem);
+ drm_gem_object_put_unlocked(&bo->gem);
return ret;
}

@@ -960,7 +960,7 @@ nouveau_display_dumb_map_offset(struct drm_file *file_priv,
if (gem) {
struct nouveau_bo *bo = nouveau_gem_object(gem);
*poffset = drm_vma_node_offset_addr(&bo->bo.vma_node);
- drm_gem_object_unreference_unlocked(gem);
+ drm_gem_object_put_unlocked(gem);
return 0;
}

diff --git a/drivers/gpu/drm/nouveau/nouveau_fbcon.c b/drivers/gpu/drm/nouveau/nouveau_fbcon.c
index f770784..e6a14af 100644
--- a/drivers/gpu/drm/nouveau/nouveau_fbcon.c
+++ b/drivers/gpu/drm/nouveau/nouveau_fbcon.c
@@ -431,7 +431,7 @@ nouveau_fbcon_destroy(struct drm_device *dev, struct nouveau_fbdev *fbcon)
nouveau_bo_vma_del(nouveau_fb->nvbo, &nouveau_fb->vma);
nouveau_bo_unmap(nouveau_fb->nvbo);
nouveau_bo_unpin(nouveau_fb->nvbo);
- drm_framebuffer_unreference(&nouveau_fb->base);
+ drm_framebuffer_put(&nouveau_fb->base);
}

return 0;
diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c b/drivers/gpu/drm/nouveau/nouveau_gem.c
index 2170534..653425c 100644
--- a/drivers/gpu/drm/nouveau/nouveau_gem.c
+++ b/drivers/gpu/drm/nouveau/nouveau_gem.c
@@ -281,7 +281,7 @@ nouveau_gem_ioctl_new(struct drm_device *dev, void *data,
}

/* drop reference from allocate - handle holds it now */
- drm_gem_object_unreference_unlocked(&nvbo->gem);
+ drm_gem_object_put_unlocked(&nvbo->gem);
return ret;
}

@@ -350,7 +350,7 @@ validate_fini_no_ticket(struct validate_op *op, struct nouveau_fence *fence,
list_del(&nvbo->entry);
nvbo->reserved_by = NULL;
ttm_bo_unreserve_ticket(&nvbo->bo, &op->ticket);
- drm_gem_object_unreference_unlocked(&nvbo->gem);
+ drm_gem_object_put_unlocked(&nvbo->gem);
}
}

@@ -396,14 +396,14 @@ validate_init(struct nouveau_channel *chan, struct drm_file *file_priv,
nvbo = nouveau_gem_object(gem);
if (nvbo == res_bo) {
res_bo = NULL;
- drm_gem_object_unreference_unlocked(gem);
+ drm_gem_object_put_unlocked(gem);
continue;
}

if (nvbo->reserved_by && nvbo->reserved_by == file_priv) {
NV_PRINTK(err, cli, "multiple instances of buffer %d on "
"validation list\n", b->handle);
- drm_gem_object_unreference_unlocked(gem);
+ drm_gem_object_put_unlocked(gem);
ret = -EINVAL;
break;
}
@@ -877,7 +877,7 @@ nouveau_gem_ioctl_cpu_prep(struct drm_device *dev, void *data,
ret = lret;

nouveau_bo_sync_for_cpu(nvbo);
- drm_gem_object_unreference_unlocked(gem);
+ drm_gem_object_put_unlocked(gem);

return ret;
}
@@ -896,7 +896,7 @@ nouveau_gem_ioctl_cpu_fini(struct drm_device *dev, void *data,
nvbo = nouveau_gem_object(gem);

nouveau_bo_sync_for_device(nvbo);
- drm_gem_object_unreference_unlocked(gem);
+ drm_gem_object_put_unlocked(gem);
return 0;
}

@@ -913,7 +913,7 @@ nouveau_gem_ioctl_info(struct drm_device *dev, void *data,
return -ENOENT;

ret = nouveau_gem_info(file_priv, gem, req);
- drm_gem_object_unreference_unlocked(gem);
+ drm_gem_object_put_unlocked(gem);
return ret;
}

diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c
index 6dee407..d29e15f 100644
--- a/drivers/gpu/drm/nouveau/nv50_display.c
+++ b/drivers/gpu/drm/nouveau/nv50_display.c
@@ -3221,7 +3221,7 @@ nv50_mstm_destroy_connector(struct drm_dp_mst_topology_mgr *mgr,
mstc->port = NULL;
drm_modeset_unlock_all(drm->dev);

- drm_connector_unreference(&mstc->connector);
+ drm_connector_put(&mstc->connector);
}

static void
--
2.7.4

2017-08-11 12:34:20

by Cihangir Akturk

[permalink] [raw]
Subject: [PATCH v3 10/28] drm/hisilicon: 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: Cihangir Akturk <[email protected]>
---
drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_fbdev.c | 4 ++--
drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c | 8 ++++----
2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_fbdev.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_fbdev.c
index 9740eed..b92595c 100644
--- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_fbdev.c
+++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_fbdev.c
@@ -157,7 +157,7 @@ static int hibmc_drm_fb_create(struct drm_fb_helper *helper,
out_unreserve_ttm_bo:
ttm_bo_unreserve(&bo->bo);
out_unref_gem:
- drm_gem_object_unreference_unlocked(gobj);
+ drm_gem_object_put_unlocked(gobj);

return ret;
}
@@ -172,7 +172,7 @@ static void hibmc_fbdev_destroy(struct hibmc_fbdev *fbdev)
drm_fb_helper_fini(fbh);

if (gfb)
- drm_framebuffer_unreference(&gfb->fb);
+ drm_framebuffer_put(&gfb->fb);
}

static const struct drm_fb_helper_funcs hibmc_fbdev_helper_funcs = {
diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c
index ac457c7..3518167 100644
--- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c
+++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c
@@ -444,7 +444,7 @@ int hibmc_dumb_create(struct drm_file *file, struct drm_device *dev,
}

ret = drm_gem_handle_create(file, gobj, &handle);
- drm_gem_object_unreference_unlocked(gobj);
+ drm_gem_object_put_unlocked(gobj);
if (ret) {
DRM_ERROR("failed to unreference GEM object: %d\n", ret);
return ret;
@@ -479,7 +479,7 @@ int hibmc_dumb_mmap_offset(struct drm_file *file, struct drm_device *dev,
bo = gem_to_hibmc_bo(obj);
*offset = hibmc_bo_mmap_offset(bo);

- drm_gem_object_unreference_unlocked(obj);
+ drm_gem_object_put_unlocked(obj);
return 0;
}

@@ -487,7 +487,7 @@ static void hibmc_user_framebuffer_destroy(struct drm_framebuffer *fb)
{
struct hibmc_framebuffer *hibmc_fb = to_hibmc_framebuffer(fb);

- drm_gem_object_unreference_unlocked(hibmc_fb->obj);
+ drm_gem_object_put_unlocked(hibmc_fb->obj);
drm_framebuffer_cleanup(fb);
kfree(hibmc_fb);
}
@@ -543,7 +543,7 @@ hibmc_user_framebuffer_create(struct drm_device *dev,

hibmc_fb = hibmc_framebuffer_init(dev, mode_cmd, obj);
if (IS_ERR(hibmc_fb)) {
- drm_gem_object_unreference_unlocked(obj);
+ drm_gem_object_put_unlocked(obj);
return ERR_PTR((long)hibmc_fb);
}
return &hibmc_fb->fb;
--
2.7.4

2017-08-11 12:39:33

by Cihangir Akturk

[permalink] [raw]
Subject: [PATCH v3 13/28] drm/mediatek: 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: Cihangir Akturk <[email protected]>
---
drivers/gpu/drm/mediatek/mtk_drm_fb.c | 4 ++--
drivers/gpu/drm/mediatek/mtk_drm_gem.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_drm_fb.c b/drivers/gpu/drm/mediatek/mtk_drm_fb.c
index d4246c9..0d8d506 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_fb.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_fb.c
@@ -58,7 +58,7 @@ static void mtk_drm_fb_destroy(struct drm_framebuffer *fb)

drm_framebuffer_cleanup(fb);

- drm_gem_object_unreference_unlocked(mtk_fb->gem_obj);
+ drm_gem_object_put_unlocked(mtk_fb->gem_obj);

kfree(mtk_fb);
}
@@ -160,6 +160,6 @@ struct drm_framebuffer *mtk_drm_mode_fb_create(struct drm_device *dev,
return &mtk_fb->base;

unreference:
- drm_gem_object_unreference_unlocked(gem);
+ drm_gem_object_put_unlocked(gem);
return ERR_PTR(ret);
}
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_gem.c b/drivers/gpu/drm/mediatek/mtk_drm_gem.c
index 8ec963f..f595ac8 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_gem.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_gem.c
@@ -122,7 +122,7 @@ int mtk_drm_gem_dumb_create(struct drm_file *file_priv, struct drm_device *dev,
goto err_handle_create;

/* drop reference from allocate - handle holds it now. */
- drm_gem_object_unreference_unlocked(&mtk_gem->base);
+ drm_gem_object_put_unlocked(&mtk_gem->base);

return 0;

--
2.7.4

2017-08-11 12:39:58

by Cihangir Akturk

[permalink] [raw]
Subject: [PATCH v3 11/28] drm/i915: 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: Cihangir Akturk <[email protected]>
---
drivers/gpu/drm/i915/i915_gem_object.h | 4 ++--
drivers/gpu/drm/i915/intel_display.c | 24 ++++++++++++------------
drivers/gpu/drm/i915/intel_dp_mst.c | 2 +-
drivers/gpu/drm/i915/intel_fbdev.c | 4 ++--
4 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_object.h b/drivers/gpu/drm/i915/i915_gem_object.h
index 5b19a49..95cfb64 100644
--- a/drivers/gpu/drm/i915/i915_gem_object.h
+++ b/drivers/gpu/drm/i915/i915_gem_object.h
@@ -257,7 +257,7 @@ __attribute__((nonnull))
static inline struct drm_i915_gem_object *
i915_gem_object_get(struct drm_i915_gem_object *obj)
{
- drm_gem_object_reference(&obj->base);
+ drm_gem_object_get(&obj->base);
return obj;
}

@@ -268,7 +268,7 @@ __attribute__((nonnull))
static inline void
i915_gem_object_put(struct drm_i915_gem_object *obj)
{
- __drm_gem_object_unreference(&obj->base);
+ __drm_gem_object_put(&obj->base);
}

__deprecated
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 684d653..70ebc19 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -2672,10 +2672,10 @@ update_state_fb(struct drm_plane *plane)
return;

if (plane->state->fb)
- drm_framebuffer_unreference(plane->state->fb);
+ drm_framebuffer_put(plane->state->fb);
plane->state->fb = plane->fb;
if (plane->state->fb)
- drm_framebuffer_reference(plane->state->fb);
+ drm_framebuffer_get(plane->state->fb);
}

static void
@@ -2746,7 +2746,7 @@ intel_find_initial_plane_obj(struct intel_crtc *intel_crtc,

if (intel_plane_ggtt_offset(state) == plane_config->base) {
fb = c->primary->fb;
- drm_framebuffer_reference(fb);
+ drm_framebuffer_get(fb);
goto valid_fb;
}
}
@@ -2777,7 +2777,7 @@ intel_find_initial_plane_obj(struct intel_crtc *intel_crtc,
intel_crtc->pipe, PTR_ERR(intel_state->vma));

intel_state->vma = NULL;
- drm_framebuffer_unreference(fb);
+ drm_framebuffer_put(fb);
return;
}

@@ -2798,7 +2798,7 @@ intel_find_initial_plane_obj(struct intel_crtc *intel_crtc,
if (i915_gem_object_is_tiled(obj))
dev_priv->preserve_bios_swizzle = true;

- drm_framebuffer_reference(fb);
+ drm_framebuffer_get(fb);
primary->fb = primary->state->fb = fb;
primary->crtc = primary->state->crtc = &intel_crtc->base;

@@ -9683,7 +9683,7 @@ mode_fits_in_fbdev(struct drm_device *dev,
if (obj->base.size < mode->vdisplay * fb->pitches[0])
return NULL;

- drm_framebuffer_reference(fb);
+ drm_framebuffer_get(fb);
return fb;
#else
return NULL;
@@ -9864,7 +9864,7 @@ int intel_get_load_detect_pipe(struct drm_connector *connector,
if (ret)
goto fail;

- drm_framebuffer_unreference(fb);
+ drm_framebuffer_put(fb);

ret = drm_atomic_set_mode_for_crtc(&crtc_state->base, mode);
if (ret)
@@ -10174,7 +10174,7 @@ static void intel_unpin_work_fn(struct work_struct *__work)
intel_frontbuffer_flip_complete(to_i915(dev),
to_intel_plane(primary)->frontbuffer_bit);
intel_fbc_post_update(crtc);
- drm_framebuffer_unreference(work->old_fb);
+ drm_framebuffer_put(work->old_fb);

BUG_ON(atomic_read(&crtc->unpin_work_count) == 0);
atomic_dec(&crtc->unpin_work_count);
@@ -10814,7 +10814,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
flush_workqueue(dev_priv->wq);

/* Reference the objects for the scheduled work. */
- drm_framebuffer_reference(work->old_fb);
+ drm_framebuffer_get(work->old_fb);

crtc->primary->fb = fb;
update_state_fb(crtc->primary);
@@ -10928,7 +10928,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
update_state_fb(crtc->primary);

i915_gem_object_put(obj);
- drm_framebuffer_unreference(work->old_fb);
+ drm_framebuffer_put(work->old_fb);

spin_lock_irq(&dev->event_lock);
intel_crtc->flip_work = NULL;
@@ -11252,7 +11252,7 @@ static void intel_modeset_update_connector_atomic_state(struct drm_device *dev)
drm_connector_list_iter_begin(dev, &conn_iter);
for_each_intel_connector_iter(connector, &conn_iter) {
if (connector->base.state->crtc)
- drm_connector_unreference(&connector->base);
+ drm_connector_put(&connector->base);

if (connector->base.encoder) {
connector->base.state->best_encoder =
@@ -11260,7 +11260,7 @@ static void intel_modeset_update_connector_atomic_state(struct drm_device *dev)
connector->base.state->crtc =
connector->base.encoder->crtc;

- drm_connector_reference(&connector->base);
+ drm_connector_get(&connector->base);
} else {
connector->base.state->best_encoder = NULL;
connector->base.state->crtc = NULL;
diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c b/drivers/gpu/drm/i915/intel_dp_mst.c
index 5856855..99a6fd8 100644
--- a/drivers/gpu/drm/i915/intel_dp_mst.c
+++ b/drivers/gpu/drm/i915/intel_dp_mst.c
@@ -501,7 +501,7 @@ static void intel_dp_destroy_mst_connector(struct drm_dp_mst_topology_mgr *mgr,
intel_connector->mst_port = NULL;
drm_modeset_unlock(&connector->dev->mode_config.connection_mutex);

- drm_connector_unreference(connector);
+ drm_connector_put(connector);
DRM_DEBUG_KMS("\n");
}

diff --git a/drivers/gpu/drm/i915/intel_fbdev.c b/drivers/gpu/drm/i915/intel_fbdev.c
index 0986ca4..5568e33 100644
--- a/drivers/gpu/drm/i915/intel_fbdev.c
+++ b/drivers/gpu/drm/i915/intel_fbdev.c
@@ -189,7 +189,7 @@ static int intelfb_create(struct drm_fb_helper *helper,
" releasing it\n",
intel_fb->base.width, intel_fb->base.height,
sizes->fb_width, sizes->fb_height);
- drm_framebuffer_unreference(&intel_fb->base);
+ drm_framebuffer_put(&intel_fb->base);
intel_fb = ifbdev->fb = NULL;
}
if (!intel_fb || WARN_ON(!intel_fb->obj)) {
@@ -626,7 +626,7 @@ static bool intel_fbdev_init_bios(struct drm_device *dev,
ifbdev->preferred_bpp = fb->base.format->cpp[0] * 8;
ifbdev->fb = fb;

- drm_framebuffer_reference(&ifbdev->fb->base);
+ drm_framebuffer_get(&ifbdev->fb->base);

/* Final pass to check if any active pipes don't have fbs */
for_each_crtc(dev, crtc) {
--
2.7.4

2017-08-11 12:34:10

by Cihangir Akturk

[permalink] [raw]
Subject: [PATCH v3 08/28] drm/exynos: 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: Cihangir Akturk <[email protected]>
---
drivers/gpu/drm/exynos/exynos_drm_fb.c | 4 ++--
drivers/gpu/drm/exynos/exynos_drm_gem.c | 12 ++++++------
drivers/gpu/drm/exynos/exynos_drm_plane.c | 2 +-
3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fb.c b/drivers/gpu/drm/exynos/exynos_drm_fb.c
index ed1a648..f16ea6c 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fb.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fb.c
@@ -80,7 +80,7 @@ static void exynos_drm_fb_destroy(struct drm_framebuffer *fb)
continue;

obj = &exynos_fb->exynos_gem[i]->base;
- drm_gem_object_unreference_unlocked(obj);
+ drm_gem_object_put_unlocked(obj);
}

kfree(exynos_fb);
@@ -172,7 +172,7 @@ exynos_user_fb_create(struct drm_device *dev, struct drm_file *file_priv,

err:
while (i--)
- drm_gem_object_unreference_unlocked(&exynos_gem[i]->base);
+ drm_gem_object_put_unlocked(&exynos_gem[i]->base);

return ERR_PTR(ret);
}
diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.c b/drivers/gpu/drm/exynos/exynos_drm_gem.c
index c23479b..1c8d2f9 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_gem.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_gem.c
@@ -143,7 +143,7 @@ static int exynos_drm_gem_handle_create(struct drm_gem_object *obj,
DRM_DEBUG_KMS("gem handle = 0x%x\n", *handle);

/* drop reference from allocate - handle holds it now. */
- drm_gem_object_unreference_unlocked(obj);
+ drm_gem_object_put_unlocked(obj);

return 0;
}
@@ -186,7 +186,7 @@ unsigned long exynos_drm_gem_get_size(struct drm_device *dev,

exynos_gem = to_exynos_gem(obj);

- drm_gem_object_unreference_unlocked(obj);
+ drm_gem_object_put_unlocked(obj);

return exynos_gem->size;
}
@@ -320,13 +320,13 @@ void exynos_drm_gem_put_dma_addr(struct drm_device *dev,
return;
}

- drm_gem_object_unreference_unlocked(obj);
+ drm_gem_object_put_unlocked(obj);

/*
* decrease obj->refcount one more time because we has already
* increased it at exynos_drm_gem_get_dma_addr().
*/
- drm_gem_object_unreference_unlocked(obj);
+ drm_gem_object_put_unlocked(obj);
}

static int exynos_drm_gem_mmap_buffer(struct exynos_drm_gem *exynos_gem,
@@ -374,7 +374,7 @@ int exynos_drm_gem_get_ioctl(struct drm_device *dev, void *data,
args->flags = exynos_gem->flags;
args->size = exynos_gem->size;

- drm_gem_object_unreference_unlocked(obj);
+ drm_gem_object_put_unlocked(obj);

return 0;
}
@@ -444,7 +444,7 @@ int exynos_drm_gem_dumb_map_offset(struct drm_file *file_priv,
*offset = drm_vma_node_offset_addr(&obj->vma_node);
DRM_DEBUG_KMS("offset = 0x%lx\n", (unsigned long)*offset);

- drm_gem_object_unreference_unlocked(obj);
+ drm_gem_object_put_unlocked(obj);
return ret;
}

diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.c b/drivers/gpu/drm/exynos/exynos_drm_plane.c
index 8de7400..930f45b 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_plane.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c
@@ -132,7 +132,7 @@ static void exynos_drm_plane_reset(struct drm_plane *plane)
if (plane->state) {
exynos_state = to_exynos_plane_state(plane->state);
if (exynos_state->base.fb)
- drm_framebuffer_unreference(exynos_state->base.fb);
+ drm_framebuffer_put(exynos_state->base.fb);
kfree(exynos_state);
plane->state = NULL;
}
--
2.7.4

2017-08-11 12:40:46

by Cihangir Akturk

[permalink] [raw]
Subject: [PATCH v3 09/28] drm/gma500: 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: Cihangir Akturk <[email protected]>
---
drivers/gpu/drm/gma500/framebuffer.c | 4 ++--
drivers/gpu/drm/gma500/gem.c | 4 ++--
drivers/gpu/drm/gma500/gma_display.c | 6 +++---
3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/gma500/framebuffer.c b/drivers/gpu/drm/gma500/framebuffer.c
index 2570c7f..270b225 100644
--- a/drivers/gpu/drm/gma500/framebuffer.c
+++ b/drivers/gpu/drm/gma500/framebuffer.c
@@ -519,7 +519,7 @@ static int psb_fbdev_destroy(struct drm_device *dev, struct psb_fbdev *fbdev)
drm_framebuffer_cleanup(&psbfb->base);

if (psbfb->gtt)
- drm_gem_object_unreference_unlocked(&psbfb->gtt->gem);
+ drm_gem_object_put_unlocked(&psbfb->gtt->gem);
return 0;
}

@@ -617,7 +617,7 @@ static void psb_user_framebuffer_destroy(struct drm_framebuffer *fb)
/* Let DRM do its clean up */
drm_framebuffer_cleanup(fb);
/* We are no longer using the resource in GEM */
- drm_gem_object_unreference_unlocked(&r->gem);
+ drm_gem_object_put_unlocked(&r->gem);
kfree(fb);
}

diff --git a/drivers/gpu/drm/gma500/gem.c b/drivers/gpu/drm/gma500/gem.c
index 7da061a..b14ae9b 100644
--- a/drivers/gpu/drm/gma500/gem.c
+++ b/drivers/gpu/drm/gma500/gem.c
@@ -73,7 +73,7 @@ int psb_gem_dumb_map_gtt(struct drm_file *file, struct drm_device *dev,
goto out;
*offset = drm_vma_node_offset_addr(&obj->vma_node);
out:
- drm_gem_object_unreference_unlocked(obj);
+ drm_gem_object_put_unlocked(obj);
return ret;
}

@@ -123,7 +123,7 @@ int psb_gem_create(struct drm_file *file, struct drm_device *dev, u64 size,
return ret;
}
/* We have the initial and handle reference but need only one now */
- drm_gem_object_unreference_unlocked(&r->gem);
+ drm_gem_object_put_unlocked(&r->gem);
*handlep = handle;
return 0;
}
diff --git a/drivers/gpu/drm/gma500/gma_display.c b/drivers/gpu/drm/gma500/gma_display.c
index f3c48a2..5800e28 100644
--- a/drivers/gpu/drm/gma500/gma_display.c
+++ b/drivers/gpu/drm/gma500/gma_display.c
@@ -353,7 +353,7 @@ int gma_crtc_cursor_set(struct drm_crtc *crtc,
gt = container_of(gma_crtc->cursor_obj,
struct gtt_range, gem);
psb_gtt_unpin(gt);
- drm_gem_object_unreference_unlocked(gma_crtc->cursor_obj);
+ drm_gem_object_put_unlocked(gma_crtc->cursor_obj);
gma_crtc->cursor_obj = NULL;
}
return 0;
@@ -429,7 +429,7 @@ int gma_crtc_cursor_set(struct drm_crtc *crtc,
if (gma_crtc->cursor_obj) {
gt = container_of(gma_crtc->cursor_obj, struct gtt_range, gem);
psb_gtt_unpin(gt);
- drm_gem_object_unreference_unlocked(gma_crtc->cursor_obj);
+ drm_gem_object_put_unlocked(gma_crtc->cursor_obj);
}

gma_crtc->cursor_obj = obj;
@@ -437,7 +437,7 @@ int gma_crtc_cursor_set(struct drm_crtc *crtc,
return ret;

unref_cursor:
- drm_gem_object_unreference_unlocked(obj);
+ drm_gem_object_put_unlocked(obj);
return ret;
}

--
2.7.4

2017-08-11 12:41:03

by Cihangir Akturk

[permalink] [raw]
Subject: [PATCH v3 06/28] drm/cirrus: 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: Cihangir Akturk <[email protected]>
---
drivers/gpu/drm/cirrus/cirrus_fbdev.c | 2 +-
drivers/gpu/drm/cirrus/cirrus_main.c | 10 +++++-----
2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/cirrus/cirrus_fbdev.c b/drivers/gpu/drm/cirrus/cirrus_fbdev.c
index 0f6815f..32fbfba 100644
--- a/drivers/gpu/drm/cirrus/cirrus_fbdev.c
+++ b/drivers/gpu/drm/cirrus/cirrus_fbdev.c
@@ -251,7 +251,7 @@ static int cirrus_fbdev_destroy(struct drm_device *dev,
drm_fb_helper_unregister_fbi(&gfbdev->helper);

if (gfb->obj) {
- drm_gem_object_unreference_unlocked(gfb->obj);
+ drm_gem_object_put_unlocked(gfb->obj);
gfb->obj = NULL;
}

diff --git a/drivers/gpu/drm/cirrus/cirrus_main.c b/drivers/gpu/drm/cirrus/cirrus_main.c
index e7fc95f..b5f5285 100644
--- a/drivers/gpu/drm/cirrus/cirrus_main.c
+++ b/drivers/gpu/drm/cirrus/cirrus_main.c
@@ -18,7 +18,7 @@ static void cirrus_user_framebuffer_destroy(struct drm_framebuffer *fb)
{
struct cirrus_framebuffer *cirrus_fb = to_cirrus_framebuffer(fb);

- drm_gem_object_unreference_unlocked(cirrus_fb->obj);
+ drm_gem_object_put_unlocked(cirrus_fb->obj);
drm_framebuffer_cleanup(fb);
kfree(fb);
}
@@ -67,13 +67,13 @@ cirrus_user_framebuffer_create(struct drm_device *dev,

cirrus_fb = kzalloc(sizeof(*cirrus_fb), GFP_KERNEL);
if (!cirrus_fb) {
- drm_gem_object_unreference_unlocked(obj);
+ drm_gem_object_put_unlocked(obj);
return ERR_PTR(-ENOMEM);
}

ret = cirrus_framebuffer_init(dev, cirrus_fb, mode_cmd, obj);
if (ret) {
- drm_gem_object_unreference_unlocked(obj);
+ drm_gem_object_put_unlocked(obj);
kfree(cirrus_fb);
return ERR_PTR(ret);
}
@@ -261,7 +261,7 @@ int cirrus_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;

@@ -310,7 +310,7 @@ cirrus_dumb_mmap_offset(struct drm_file *file,
bo = gem_to_cirrus_bo(obj);
*offset = cirrus_bo_mmap_offset(bo);

- drm_gem_object_unreference_unlocked(obj);
+ drm_gem_object_put_unlocked(obj);

return 0;
}
--
2.7.4

2017-08-11 12:41:50

by Cihangir Akturk

[permalink] [raw]
Subject: [PATCH v3 02/28] drm: mali-dp: 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: Cihangir Akturk <[email protected]>
Acked-by: Liviu Dudau <[email protected]>
---
drivers/gpu/drm/arm/malidp_planes.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/arm/malidp_planes.c b/drivers/gpu/drm/arm/malidp_planes.c
index 94e7e3f..f12f8eb 100644
--- a/drivers/gpu/drm/arm/malidp_planes.c
+++ b/drivers/gpu/drm/arm/malidp_planes.c
@@ -57,7 +57,7 @@ static void malidp_de_plane_destroy(struct drm_plane *plane)
struct malidp_plane *mp = to_malidp_plane(plane);

if (mp->base.fb)
- drm_framebuffer_unreference(mp->base.fb);
+ drm_framebuffer_put(mp->base.fb);

drm_plane_helper_disable(plane);
drm_plane_cleanup(plane);
--
2.7.4

2017-08-11 13:01:29

by Philipp Zabel

[permalink] [raw]
Subject: Re: [PATCH v3 12/28] drm/imx: switch to drm_*_get(), drm_*_put() helpers

On Fri, 2017-08-11 at 15:32 +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 <[email protected]>
> ---
>  drivers/gpu/drm/imx/ipuv3-crtc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/imx/ipuv3-crtc.c b/drivers/gpu/drm/imx/ipuv3-crtc.c
> index 53e0b24..9a99618 100644
> --- a/drivers/gpu/drm/imx/ipuv3-crtc.c
> +++ b/drivers/gpu/drm/imx/ipuv3-crtc.c
> @@ -115,7 +115,7 @@ static void imx_drm_crtc_reset(struct drm_crtc *crtc)
>  
> >   if (crtc->state) {
> >   if (crtc->state->mode_blob)
> > - drm_property_unreference_blob(crtc->state->mode_blob);
> > + drm_property_blob_put(crtc->state->mode_blob);
>  
> >   state = to_imx_crtc_state(crtc->state);
> >   memset(state, 0, sizeof(*state));

Thank you, applied to imx-drm/next.

regards
Philipp

2017-08-11 13:01:47

by Philipp Zabel

[permalink] [raw]
Subject: Re: [PATCH v3 13/28] drm/mediatek: switch to drm_*_get(), drm_*_put() helpers

On Fri, 2017-08-11 at 15:32 +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 <[email protected]>
> ---
>  drivers/gpu/drm/mediatek/mtk_drm_fb.c  | 4 ++--
>  drivers/gpu/drm/mediatek/mtk_drm_gem.c | 2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_fb.c
> b/drivers/gpu/drm/mediatek/mtk_drm_fb.c
> index d4246c9..0d8d506 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_fb.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_fb.c
> @@ -58,7 +58,7 @@ static void mtk_drm_fb_destroy(struct
> drm_framebuffer *fb)
>  
>   drm_framebuffer_cleanup(fb);
>  
> - drm_gem_object_unreference_unlocked(mtk_fb->gem_obj);
> + drm_gem_object_put_unlocked(mtk_fb->gem_obj);
>  
>   kfree(mtk_fb);
>  }
> @@ -160,6 +160,6 @@ struct drm_framebuffer
> *mtk_drm_mode_fb_create(struct drm_device *dev,
>   return &mtk_fb->base;
>  
>  unreference:
> - drm_gem_object_unreference_unlocked(gem);
> + drm_gem_object_put_unlocked(gem);
>   return ERR_PTR(ret);
>  }
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_gem.c
> b/drivers/gpu/drm/mediatek/mtk_drm_gem.c
> index 8ec963f..f595ac8 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_gem.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_gem.c
> @@ -122,7 +122,7 @@ int mtk_drm_gem_dumb_create(struct drm_file
> *file_priv, struct drm_device *dev,
>   goto err_handle_create;
>  
>   /* drop reference from allocate - handle holds it now. */
> - drm_gem_object_unreference_unlocked(&mtk_gem->base);
> + drm_gem_object_put_unlocked(&mtk_gem->base);
>  
>   return 0;
>  

Reviewed-by: Philipp Zabel <[email protected]>

regards
Philipp

2017-08-11 13:26:50

by Hans de Goede

[permalink] [raw]
Subject: Re: [PATCH v3 28/28] drm: vboxvideo: switch to drm_*_get(), drm_*_put() helpers

Hi,

On 11-08-17 14:33, 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 <[email protected]>

Thank you for doing this, looks good to me:

Reviewed-by: Hans de Goede <[email protected]>

Regards,

Hans



> ---
> drivers/staging/vboxvideo/vbox_fb.c | 2 +-
> drivers/staging/vboxvideo/vbox_main.c | 8 ++++----
> drivers/staging/vboxvideo/vbox_mode.c | 2 +-
> 3 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/staging/vboxvideo/vbox_fb.c b/drivers/staging/vboxvideo/vbox_fb.c
> index bf66358..c157284 100644
> --- a/drivers/staging/vboxvideo/vbox_fb.c
> +++ b/drivers/staging/vboxvideo/vbox_fb.c
> @@ -343,7 +343,7 @@ void vbox_fbdev_fini(struct drm_device *dev)
> vbox_bo_unpin(bo);
> vbox_bo_unreserve(bo);
> }
> - drm_gem_object_unreference_unlocked(afb->obj);
> + drm_gem_object_put_unlocked(afb->obj);
> afb->obj = NULL;
> }
> drm_fb_helper_fini(&fbdev->helper);
> diff --git a/drivers/staging/vboxvideo/vbox_main.c b/drivers/staging/vboxvideo/vbox_main.c
> index d0c6ec7..80bd039 100644
> --- a/drivers/staging/vboxvideo/vbox_main.c
> +++ b/drivers/staging/vboxvideo/vbox_main.c
> @@ -40,7 +40,7 @@ static void vbox_user_framebuffer_destroy(struct drm_framebuffer *fb)
> struct vbox_framebuffer *vbox_fb = to_vbox_framebuffer(fb);
>
> if (vbox_fb->obj)
> - drm_gem_object_unreference_unlocked(vbox_fb->obj);
> + drm_gem_object_put_unlocked(vbox_fb->obj);
>
> drm_framebuffer_cleanup(fb);
> kfree(fb);
> @@ -198,7 +198,7 @@ static struct drm_framebuffer *vbox_user_framebuffer_create(
> err_free_vbox_fb:
> kfree(vbox_fb);
> err_unref_obj:
> - drm_gem_object_unreference_unlocked(obj);
> + drm_gem_object_put_unlocked(obj);
> return ERR_PTR(ret);
> }
>
> @@ -472,7 +472,7 @@ int vbox_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;
>
> @@ -525,7 +525,7 @@ vbox_dumb_mmap_offset(struct drm_file *file,
> bo = gem_to_vbox_bo(obj);
> *offset = vbox_bo_mmap_offset(bo);
>
> - drm_gem_object_unreference(obj);
> + drm_gem_object_put(obj);
> ret = 0;
>
> out_unlock:
> diff --git a/drivers/staging/vboxvideo/vbox_mode.c b/drivers/staging/vboxvideo/vbox_mode.c
> index 996da1c..e5b6383 100644
> --- a/drivers/staging/vboxvideo/vbox_mode.c
> +++ b/drivers/staging/vboxvideo/vbox_mode.c
> @@ -812,7 +812,7 @@ static int vbox_cursor_set2(struct drm_crtc *crtc, struct drm_file *file_priv,
> out_unreserve_bo:
> vbox_bo_unreserve(bo);
> out_unref_obj:
> - drm_gem_object_unreference_unlocked(obj);
> + drm_gem_object_put_unlocked(obj);
>
> return ret;
> }
>

2017-08-11 14:24:26

by Deucher, Alexander

[permalink] [raw]
Subject: RE: [PATCH v3 00/28] DRM API Conversions

> -----Original Message-----
> From: amd-gfx [mailto:[email protected]] On Behalf
> Of Cihangir Akturk
> Sent: Friday, August 11, 2017 8:33 AM
> Cc: [email protected]; [email protected]; intel-
> [email protected]; [email protected]; dri-
> [email protected]; [email protected]; Cihangir Akturk;
> [email protected]; [email protected];
> [email protected]; [email protected];
> [email protected]; [email protected]
> Subject: [PATCH v3 00/28] DRM API Conversions
>
> Changes since v2:
>
> - Patch series is based on *drm-misc-next* as suggested by Sean Paul.
>
> - Dropped patch 05 (drm/atmel-hlcdc) and patch 25 (drm/vc4) from v2,
> since they were already pulled in the drm-misc-next
>
> Changes since v1:
>
> - This time patches were generated with coccinelle instead of my own
> script, as suggested by Daniel Vetter.
>
> - Fixed the typo in commit messages. s/adn/and
>

FWIW, I already picked up v1 of these patches for radeon and amdgpu.

Alex

> Note: I've included r-b, a-b tags, as these patches are identical to v1
> except for the file: drivers/gpu/drm/i915/i915_gem_object.h
>
> This patch set replaces the occurrences of drm_*_reference() and
> drm_*_unreference() with the new drm_*_get() and drm_*_put()
> functions.
> All patches in the series do the same thing, converting to the new APIs.
> I created patches per DRM driver as suggested by Daniel Vetter.
>
> This patch set was generated by scripts/coccinelle/api/drm-get-put.cocci
>
> Previous thread can be reached at:
> https://marc.info/?l=dri-devel&m=150178288816047
>
> Background:
>
> In the kernel, reference counting APIs use *_get(), *_put() style naming
> to reference-count the objects. But DRM subsystem uses a different
> naming for them such as *_reference(), *_unreference() which is
> inconsistent with the other reference counting APIs in the kernel. To
> solve this consistency issue, Thierry Reding introduced a couple of
> functions and compatibility aliases in the following commits for them.
>
> commit 020a218f95bd3ceff7dd1022ff7ebc0497bc7bf9
> Author: Thierry Reding <[email protected]>
> Date: Tue Feb 28 15:46:38 2017 +0100
>
> drm: Introduce drm_mode_object_{get,put}()
>
> commit ad09360750afa18a0a0ce0253d6ea6033abc22e7
> Author: Thierry Reding <[email protected]>
> Date: Tue Feb 28 15:46:39 2017 +0100
>
> drm: Introduce drm_connector_{get,put}()
>
> commit a4a69da06bc11a937a6e417938b1bb698ee1fa46
> Author: Thierry Reding <[email protected]>
> Date: Tue Feb 28 15:46:40 2017 +0100
>
> drm: Introduce drm_framebuffer_{get,put}()
>
> commit e6b62714e87c8811d5564b6a0738dcde63a51774
> Author: Thierry Reding <[email protected]>
> Date: Tue Feb 28 15:46:41 2017 +0100
>
> drm: Introduce drm_gem_object_{get,put}()
>
> commit 6472e5090be7c78749a3c279b4faae87ab835c40
> Author: Thierry Reding <[email protected]>
> Date: Tue Feb 28 15:46:42 2017 +0100
>
> drm: Introduce drm_property_blob_{get,put}()
>
> Cihangir Akturk (28):
> drm/amdgpu: switch to drm_*_get(), drm_*_put() helpers
> drm: mali-dp: switch to drm_*_get(), drm_*_put() helpers
> drm/armada: switch to drm_*_get(), drm_*_put() helpers
> drm/ast: switch to drm_*_get(), drm_*_put() helpers
> drm/bochs: switch to drm_*_get(), drm_*_put() helpers
> drm/cirrus: switch to drm_*_get(), drm_*_put() helpers
> drm/etnaviv: switch to drm_*_get(), drm_*_put() helpers
> drm/exynos: switch to drm_*_get(), drm_*_put() helpers
> drm/gma500: switch to drm_*_get(), drm_*_put() helpers
> drm/hisilicon: switch to drm_*_get(), drm_*_put() helpers
> drm/i915: switch to drm_*_get(), drm_*_put() helpers
> drm/imx: switch to drm_*_get(), drm_*_put() helpers
> drm/mediatek: switch to drm_*_get(), drm_*_put() helpers
> drm/mgag200: switch to drm_*_get(), drm_*_put() helpers
> drm/msm: switch to drm_*_get(), drm_*_put() helpers
> drm/nouveau: switch to drm_*_get(), drm_*_put() helpers
> drm/omapdrm: switch to drm_*_get(), drm_*_put() helpers
> drm/qxl: switch to drm_*_get(), drm_*_put() helpers
> drm/radeon: switch to drm_*_get(), drm_*_put() helpers
> drm/rockchip: switch to drm_*_get(), drm_*_put() helpers
> drm/tegra: switch to drm_*_get(), drm_*_put() helpers
> drm/tilcdc: switch to drm_*_get(), drm_*_put() helpers
> drm/udl: switch to drm_*_get(), drm_*_put() helpers
> drm/vc4: switch to drm_*_get(), drm_*_put() helpers
> drm/vgem: switch to drm_*_get(), drm_*_put() helpers
> drm/virtio: switch to drm_*_get(), drm_*_put() helpers
> drm/vmwgfx: switch to drm_*_get(), drm_*_put() helpers
> drm: vboxvideo: switch to drm_*_get(), drm_*_put() helpers
>
> drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c | 2 +-
> drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 2 +-
> drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 6 ++---
> drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c | 4 +--
> drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 22 ++++++++---------
> drivers/gpu/drm/amd/amdgpu/dce_v10_0.c | 6 ++---
> drivers/gpu/drm/amd/amdgpu/dce_v11_0.c | 6 ++---
> drivers/gpu/drm/amd/amdgpu/dce_v6_0.c | 6 ++---
> drivers/gpu/drm/amd/amdgpu/dce_v8_0.c | 6 ++---
> drivers/gpu/drm/arm/malidp_planes.c | 2 +-
> drivers/gpu/drm/armada/armada_crtc.c | 22 ++++++++---------
> drivers/gpu/drm/armada/armada_drv.c | 2 +-
> drivers/gpu/drm/armada/armada_fb.c | 8 +++---
> drivers/gpu/drm/armada/armada_fbdev.c | 6 ++---
> drivers/gpu/drm/armada/armada_gem.c | 14 +++++------
> drivers/gpu/drm/armada/armada_overlay.c | 4 +--
> drivers/gpu/drm/ast/ast_fb.c | 2 +-
> drivers/gpu/drm/ast/ast_main.c | 10 ++++----
> drivers/gpu/drm/ast/ast_mode.c | 6 ++---
> drivers/gpu/drm/bochs/bochs_fbdev.c | 2 +-
> drivers/gpu/drm/bochs/bochs_mm.c | 10 ++++----
> drivers/gpu/drm/cirrus/cirrus_fbdev.c | 2 +-
> drivers/gpu/drm/cirrus/cirrus_main.c | 10 ++++----
> drivers/gpu/drm/etnaviv/etnaviv_drv.c | 8 +++---
> drivers/gpu/drm/etnaviv/etnaviv_gem.c | 20 +++++++--------
> drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c | 2 +-
> drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c | 4 +--
> drivers/gpu/drm/exynos/exynos_drm_fb.c | 4 +--
> drivers/gpu/drm/exynos/exynos_drm_gem.c | 12 ++++-----
> drivers/gpu/drm/exynos/exynos_drm_plane.c | 2 +-
> drivers/gpu/drm/gma500/framebuffer.c | 4 +--
> drivers/gpu/drm/gma500/gem.c | 4 +--
> drivers/gpu/drm/gma500/gma_display.c | 6 ++---
> drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_fbdev.c | 4 +--
> drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c | 8 +++---
> drivers/gpu/drm/i915/i915_gem_object.h | 4 +--
> drivers/gpu/drm/i915/intel_display.c | 24 +++++++++---------
> drivers/gpu/drm/i915/intel_dp_mst.c | 2 +-
> drivers/gpu/drm/i915/intel_fbdev.c | 4 +--
> drivers/gpu/drm/imx/ipuv3-crtc.c | 2 +-
> drivers/gpu/drm/mediatek/mtk_drm_fb.c | 4 +--
> drivers/gpu/drm/mediatek/mtk_drm_gem.c | 2 +-
> drivers/gpu/drm/mgag200/mgag200_cursor.c | 2 +-
> drivers/gpu/drm/mgag200/mgag200_fb.c | 4 +--
> drivers/gpu/drm/mgag200/mgag200_main.c | 10 ++++----
> drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 10 ++++----
> drivers/gpu/drm/msm/adreno/a5xx_power.c | 2 +-
> drivers/gpu/drm/msm/adreno/adreno_gpu.c | 2 +-
> drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c | 6 ++---
> drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c | 2 +-
> drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c | 2 +-
> drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c | 4 +--
> drivers/gpu/drm/msm/msm_drv.c | 8 +++---
> drivers/gpu/drm/msm/msm_fb.c | 4 +--
> drivers/gpu/drm/msm/msm_fbdev.c | 2 +-
> drivers/gpu/drm/msm/msm_gem.c | 8 +++---
> drivers/gpu/drm/msm/msm_gem_submit.c | 4 +--
> drivers/gpu/drm/msm/msm_gpu.c | 4 +--
> drivers/gpu/drm/msm/msm_ringbuffer.c | 2 +-
> drivers/gpu/drm/nouveau/dispnv04/crtc.c | 2 +-
> drivers/gpu/drm/nouveau/nouveau_abi16.c | 2 +-
> drivers/gpu/drm/nouveau/nouveau_display.c | 8 +++---
> drivers/gpu/drm/nouveau/nouveau_fbcon.c | 2 +-
> drivers/gpu/drm/nouveau/nouveau_gem.c | 14 +++++------
> drivers/gpu/drm/nouveau/nv50_display.c | 2 +-
> drivers/gpu/drm/omapdrm/omap_drv.c | 2 +-
> drivers/gpu/drm/omapdrm/omap_fb.c | 4 +--
> drivers/gpu/drm/omapdrm/omap_fbdev.c | 2 +-
> drivers/gpu/drm/omapdrm/omap_gem.c | 4 +--
> drivers/gpu/drm/omapdrm/omap_gem_dmabuf.c | 2 +-
> drivers/gpu/drm/qxl/qxl_display.c | 4 +--
> drivers/gpu/drm/qxl/qxl_dumb.c | 2 +-
> drivers/gpu/drm/qxl/qxl_fb.c | 6 ++---
> drivers/gpu/drm/qxl/qxl_gem.c | 2 +-
> drivers/gpu/drm/qxl/qxl_ioctl.c | 4 +--
> drivers/gpu/drm/qxl/qxl_object.c | 6 ++---
> drivers/gpu/drm/radeon/radeon_cs.c | 2 +-
> drivers/gpu/drm/radeon/radeon_cursor.c | 6 ++---
> drivers/gpu/drm/radeon/radeon_display.c | 12 ++++-----
> drivers/gpu/drm/radeon/radeon_fb.c | 4 +--
> drivers/gpu/drm/radeon/radeon_gem.c | 30 +++++++++++------------
> drivers/gpu/drm/radeon/radeon_object.c | 2 +-
> drivers/gpu/drm/rockchip/rockchip_drm_fb.c | 6 ++---
> drivers/gpu/drm/rockchip/rockchip_drm_fbdev.c | 2 +-
> drivers/gpu/drm/rockchip/rockchip_drm_gem.c | 2 +-
> drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 4 +--
> drivers/gpu/drm/tegra/drm.c | 12 ++++-----
> drivers/gpu/drm/tegra/fb.c | 8 +++---
> drivers/gpu/drm/tegra/gem.c | 10 ++++----
> drivers/gpu/drm/tilcdc/tilcdc_crtc.c | 6 ++---
> drivers/gpu/drm/udl/udl_fb.c | 6 ++---
> drivers/gpu/drm/udl/udl_gem.c | 4 +--
> drivers/gpu/drm/vc4/vc4_bo.c | 2 +-
> drivers/gpu/drm/vgem/vgem_drv.c | 4 +--
> drivers/gpu/drm/vgem/vgem_fence.c | 2 +-
> drivers/gpu/drm/virtio/virtgpu_display.c | 4 +--
> drivers/gpu/drm/virtio/virtgpu_gem.c | 4 +--
> drivers/gpu/drm/virtio/virtgpu_ioctl.c | 14 +++++------
> drivers/gpu/drm/vmwgfx/vmwgfx_fb.c | 2 +-
> drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c | 4 +--
> drivers/staging/vboxvideo/vbox_fb.c | 2 +-
> drivers/staging/vboxvideo/vbox_main.c | 8 +++---
> drivers/staging/vboxvideo/vbox_mode.c | 2 +-
> 103 files changed, 294 insertions(+), 294 deletions(-)
>
> --
> 2.7.4
>
> _______________________________________________
> amd-gfx mailing list
> [email protected]
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx

2017-08-11 14:43:13

by Lucas Stach

[permalink] [raw]
Subject: Re: [PATCH v3 07/28] drm/etnaviv: switch to drm_*_get(), drm_*_put() helpers

Am Freitag, den 11.08.2017, 15:32 +0300 schrieb Cihangir Akturk:
> 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 <[email protected]>

I have already applied v1 of this patch to the etnaviv tree.

Regards,
Lucas

> ---
> drivers/gpu/drm/etnaviv/etnaviv_drv.c | 8 ++++----
> drivers/gpu/drm/etnaviv/etnaviv_gem.c | 20 ++++++++++----------
> drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c | 2 +-
> drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c | 4 ++--
> 4 files changed, 17 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/gpu/drm/etnaviv/etnaviv_drv.c b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
> index 91e17ae..2cb4773 100644
> --- a/drivers/gpu/drm/etnaviv/etnaviv_drv.c
> +++ b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
> @@ -316,7 +316,7 @@ static int etnaviv_ioctl_gem_cpu_prep(struct drm_device *dev, void *data,
>
> ret = etnaviv_gem_cpu_prep(obj, args->op, &TS(args->timeout));
>
> - drm_gem_object_unreference_unlocked(obj);
> + drm_gem_object_put_unlocked(obj);
>
> return ret;
> }
> @@ -337,7 +337,7 @@ static int etnaviv_ioctl_gem_cpu_fini(struct drm_device *dev, void *data,
>
> ret = etnaviv_gem_cpu_fini(obj);
>
> - drm_gem_object_unreference_unlocked(obj);
> + drm_gem_object_put_unlocked(obj);
>
> return ret;
> }
> @@ -357,7 +357,7 @@ static int etnaviv_ioctl_gem_info(struct drm_device *dev, void *data,
> return -ENOENT;
>
> ret = etnaviv_gem_mmap_offset(obj, &args->offset);
> - drm_gem_object_unreference_unlocked(obj);
> + drm_gem_object_put_unlocked(obj);
>
> return ret;
> }
> @@ -446,7 +446,7 @@ static int etnaviv_ioctl_gem_wait(struct drm_device *dev, void *data,
>
> ret = etnaviv_gem_wait_bo(gpu, obj, timeout);
>
> - drm_gem_object_unreference_unlocked(obj);
> + drm_gem_object_put_unlocked(obj);
>
> return ret;
> }
> diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem.c b/drivers/gpu/drm/etnaviv/etnaviv_gem.c
> index 9a3bea7..e36fbb9 100644
> --- a/drivers/gpu/drm/etnaviv/etnaviv_gem.c
> +++ b/drivers/gpu/drm/etnaviv/etnaviv_gem.c
> @@ -265,7 +265,7 @@ void etnaviv_gem_mapping_reference(struct etnaviv_vram_mapping *mapping)
> {
> struct etnaviv_gem_object *etnaviv_obj = mapping->object;
>
> - drm_gem_object_reference(&etnaviv_obj->base);
> + drm_gem_object_get(&etnaviv_obj->base);
>
> mutex_lock(&etnaviv_obj->lock);
> WARN_ON(mapping->use == 0);
> @@ -282,7 +282,7 @@ void etnaviv_gem_mapping_unreference(struct etnaviv_vram_mapping *mapping)
> mapping->use -= 1;
> mutex_unlock(&etnaviv_obj->lock);
>
> - drm_gem_object_unreference_unlocked(&etnaviv_obj->base);
> + drm_gem_object_put_unlocked(&etnaviv_obj->base);
> }
>
> struct etnaviv_vram_mapping *etnaviv_gem_mapping_get(
> @@ -358,7 +358,7 @@ struct etnaviv_vram_mapping *etnaviv_gem_mapping_get(
> return ERR_PTR(ret);
>
> /* Take a reference on the object */
> - drm_gem_object_reference(obj);
> + drm_gem_object_get(obj);
> return mapping;
> }
>
> @@ -671,7 +671,7 @@ static struct drm_gem_object *__etnaviv_gem_new(struct drm_device *dev,
> return obj;
>
> fail:
> - drm_gem_object_unreference_unlocked(obj);
> + drm_gem_object_put_unlocked(obj);
> return ERR_PTR(ret);
> }
>
> @@ -688,14 +688,14 @@ int etnaviv_gem_new_handle(struct drm_device *dev, struct drm_file *file,
>
> ret = etnaviv_gem_obj_add(dev, obj);
> if (ret < 0) {
> - drm_gem_object_unreference_unlocked(obj);
> + drm_gem_object_put_unlocked(obj);
> return ret;
> }
>
> ret = drm_gem_handle_create(file, obj, handle);
>
> /* drop reference from allocate - handle holds it now */
> - drm_gem_object_unreference_unlocked(obj);
> + drm_gem_object_put_unlocked(obj);
>
> return ret;
> }
> @@ -712,7 +712,7 @@ struct drm_gem_object *etnaviv_gem_new(struct drm_device *dev,
>
> ret = etnaviv_gem_obj_add(dev, obj);
> if (ret < 0) {
> - drm_gem_object_unreference_unlocked(obj);
> + drm_gem_object_put_unlocked(obj);
> return ERR_PTR(ret);
> }
>
> @@ -800,7 +800,7 @@ static void __etnaviv_gem_userptr_get_pages(struct work_struct *_work)
> }
>
> mutex_unlock(&etnaviv_obj->lock);
> - drm_gem_object_unreference_unlocked(&etnaviv_obj->base);
> + drm_gem_object_put_unlocked(&etnaviv_obj->base);
>
> mmput(work->mm);
> put_task_struct(work->task);
> @@ -858,7 +858,7 @@ static int etnaviv_gem_userptr_get_pages(struct etnaviv_gem_object *etnaviv_obj)
> }
>
> get_task_struct(current);
> - drm_gem_object_reference(&etnaviv_obj->base);
> + drm_gem_object_get(&etnaviv_obj->base);
>
> work->mm = mm;
> work->task = current;
> @@ -924,6 +924,6 @@ int etnaviv_gem_new_userptr(struct drm_device *dev, struct drm_file *file,
> ret = drm_gem_handle_create(file, &etnaviv_obj->base, handle);
> unreference:
> /* drop reference from allocate - handle holds it now */
> - drm_gem_object_unreference_unlocked(&etnaviv_obj->base);
> + drm_gem_object_put_unlocked(&etnaviv_obj->base);
> return ret;
> }
> diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c b/drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c
> index e5da4f23..ae88472 100644
> --- a/drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c
> +++ b/drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c
> @@ -146,7 +146,7 @@ struct drm_gem_object *etnaviv_gem_prime_import_sg_table(struct drm_device *dev,
> return &etnaviv_obj->base;
>
> fail:
> - drm_gem_object_unreference_unlocked(&etnaviv_obj->base);
> + drm_gem_object_put_unlocked(&etnaviv_obj->base);
>
> return ERR_PTR(ret);
> }
> diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
> index 5bd9316..d456a6b 100644
> --- a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
> +++ b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
> @@ -88,7 +88,7 @@ static int submit_lookup_objects(struct etnaviv_gem_submit *submit,
> * Take a refcount on the object. The file table lock
> * prevents the object_idr's refcount on this being dropped.
> */
> - drm_gem_object_reference(obj);
> + drm_gem_object_get(obj);
>
> submit->bos[i].obj = to_etnaviv_bo(obj);
> }
> @@ -291,7 +291,7 @@ static void submit_cleanup(struct etnaviv_gem_submit *submit)
> struct etnaviv_gem_object *etnaviv_obj = submit->bos[i].obj;
>
> submit_unlock_object(submit, i);
> - drm_gem_object_unreference_unlocked(&etnaviv_obj->base);
> + drm_gem_object_put_unlocked(&etnaviv_obj->base);
> }
>
> ww_acquire_fini(&submit->ticket);


2017-08-11 15:02:09

by Cihangir Akturk

[permalink] [raw]
Subject: Re: [PATCH v3 07/28] drm/etnaviv: switch to drm_*_get(), drm_*_put() helpers

On Fri, Aug 11, 2017 at 04:43:07PM +0200, Lucas Stach wrote:
> Am Freitag, den 11.08.2017, 15:32 +0300 schrieb Cihangir Akturk:
> > 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 <[email protected]>
>
> I have already applied v1 of this patch to the etnaviv tree.

This is identical to the same patch of v1, just based on drm-misc-next
as suggested by Sean Paul.


> Regards,
> Lucas
>
> > ---
> > drivers/gpu/drm/etnaviv/etnaviv_drv.c | 8 ++++----
> > drivers/gpu/drm/etnaviv/etnaviv_gem.c | 20 ++++++++++----------
> > drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c | 2 +-
> > drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c | 4 ++--
> > 4 files changed, 17 insertions(+), 17 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/etnaviv/etnaviv_drv.c b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
> > index 91e17ae..2cb4773 100644
> > --- a/drivers/gpu/drm/etnaviv/etnaviv_drv.c
> > +++ b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
> > @@ -316,7 +316,7 @@ static int etnaviv_ioctl_gem_cpu_prep(struct drm_device *dev, void *data,
> >
> > ret = etnaviv_gem_cpu_prep(obj, args->op, &TS(args->timeout));
> >
> > - drm_gem_object_unreference_unlocked(obj);
> > + drm_gem_object_put_unlocked(obj);
> >
> > return ret;
> > }
> > @@ -337,7 +337,7 @@ static int etnaviv_ioctl_gem_cpu_fini(struct drm_device *dev, void *data,
> >
> > ret = etnaviv_gem_cpu_fini(obj);
> >
> > - drm_gem_object_unreference_unlocked(obj);
> > + drm_gem_object_put_unlocked(obj);
> >
> > return ret;
> > }
> > @@ -357,7 +357,7 @@ static int etnaviv_ioctl_gem_info(struct drm_device *dev, void *data,
> > return -ENOENT;
> >
> > ret = etnaviv_gem_mmap_offset(obj, &args->offset);
> > - drm_gem_object_unreference_unlocked(obj);
> > + drm_gem_object_put_unlocked(obj);
> >
> > return ret;
> > }
> > @@ -446,7 +446,7 @@ static int etnaviv_ioctl_gem_wait(struct drm_device *dev, void *data,
> >
> > ret = etnaviv_gem_wait_bo(gpu, obj, timeout);
> >
> > - drm_gem_object_unreference_unlocked(obj);
> > + drm_gem_object_put_unlocked(obj);
> >
> > return ret;
> > }
> > diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem.c b/drivers/gpu/drm/etnaviv/etnaviv_gem.c
> > index 9a3bea7..e36fbb9 100644
> > --- a/drivers/gpu/drm/etnaviv/etnaviv_gem.c
> > +++ b/drivers/gpu/drm/etnaviv/etnaviv_gem.c
> > @@ -265,7 +265,7 @@ void etnaviv_gem_mapping_reference(struct etnaviv_vram_mapping *mapping)
> > {
> > struct etnaviv_gem_object *etnaviv_obj = mapping->object;
> >
> > - drm_gem_object_reference(&etnaviv_obj->base);
> > + drm_gem_object_get(&etnaviv_obj->base);
> >
> > mutex_lock(&etnaviv_obj->lock);
> > WARN_ON(mapping->use == 0);
> > @@ -282,7 +282,7 @@ void etnaviv_gem_mapping_unreference(struct etnaviv_vram_mapping *mapping)
> > mapping->use -= 1;
> > mutex_unlock(&etnaviv_obj->lock);
> >
> > - drm_gem_object_unreference_unlocked(&etnaviv_obj->base);
> > + drm_gem_object_put_unlocked(&etnaviv_obj->base);
> > }
> >
> > struct etnaviv_vram_mapping *etnaviv_gem_mapping_get(
> > @@ -358,7 +358,7 @@ struct etnaviv_vram_mapping *etnaviv_gem_mapping_get(
> > return ERR_PTR(ret);
> >
> > /* Take a reference on the object */
> > - drm_gem_object_reference(obj);
> > + drm_gem_object_get(obj);
> > return mapping;
> > }
> >
> > @@ -671,7 +671,7 @@ static struct drm_gem_object *__etnaviv_gem_new(struct drm_device *dev,
> > return obj;
> >
> > fail:
> > - drm_gem_object_unreference_unlocked(obj);
> > + drm_gem_object_put_unlocked(obj);
> > return ERR_PTR(ret);
> > }
> >
> > @@ -688,14 +688,14 @@ int etnaviv_gem_new_handle(struct drm_device *dev, struct drm_file *file,
> >
> > ret = etnaviv_gem_obj_add(dev, obj);
> > if (ret < 0) {
> > - drm_gem_object_unreference_unlocked(obj);
> > + drm_gem_object_put_unlocked(obj);
> > return ret;
> > }
> >
> > ret = drm_gem_handle_create(file, obj, handle);
> >
> > /* drop reference from allocate - handle holds it now */
> > - drm_gem_object_unreference_unlocked(obj);
> > + drm_gem_object_put_unlocked(obj);
> >
> > return ret;
> > }
> > @@ -712,7 +712,7 @@ struct drm_gem_object *etnaviv_gem_new(struct drm_device *dev,
> >
> > ret = etnaviv_gem_obj_add(dev, obj);
> > if (ret < 0) {
> > - drm_gem_object_unreference_unlocked(obj);
> > + drm_gem_object_put_unlocked(obj);
> > return ERR_PTR(ret);
> > }
> >
> > @@ -800,7 +800,7 @@ static void __etnaviv_gem_userptr_get_pages(struct work_struct *_work)
> > }
> >
> > mutex_unlock(&etnaviv_obj->lock);
> > - drm_gem_object_unreference_unlocked(&etnaviv_obj->base);
> > + drm_gem_object_put_unlocked(&etnaviv_obj->base);
> >
> > mmput(work->mm);
> > put_task_struct(work->task);
> > @@ -858,7 +858,7 @@ static int etnaviv_gem_userptr_get_pages(struct etnaviv_gem_object *etnaviv_obj)
> > }
> >
> > get_task_struct(current);
> > - drm_gem_object_reference(&etnaviv_obj->base);
> > + drm_gem_object_get(&etnaviv_obj->base);
> >
> > work->mm = mm;
> > work->task = current;
> > @@ -924,6 +924,6 @@ int etnaviv_gem_new_userptr(struct drm_device *dev, struct drm_file *file,
> > ret = drm_gem_handle_create(file, &etnaviv_obj->base, handle);
> > unreference:
> > /* drop reference from allocate - handle holds it now */
> > - drm_gem_object_unreference_unlocked(&etnaviv_obj->base);
> > + drm_gem_object_put_unlocked(&etnaviv_obj->base);
> > return ret;
> > }
> > diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c b/drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c
> > index e5da4f23..ae88472 100644
> > --- a/drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c
> > +++ b/drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c
> > @@ -146,7 +146,7 @@ struct drm_gem_object *etnaviv_gem_prime_import_sg_table(struct drm_device *dev,
> > return &etnaviv_obj->base;
> >
> > fail:
> > - drm_gem_object_unreference_unlocked(&etnaviv_obj->base);
> > + drm_gem_object_put_unlocked(&etnaviv_obj->base);
> >
> > return ERR_PTR(ret);
> > }
> > diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
> > index 5bd9316..d456a6b 100644
> > --- a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
> > +++ b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
> > @@ -88,7 +88,7 @@ static int submit_lookup_objects(struct etnaviv_gem_submit *submit,
> > * Take a refcount on the object. The file table lock
> > * prevents the object_idr's refcount on this being dropped.
> > */
> > - drm_gem_object_reference(obj);
> > + drm_gem_object_get(obj);
> >
> > submit->bos[i].obj = to_etnaviv_bo(obj);
> > }
> > @@ -291,7 +291,7 @@ static void submit_cleanup(struct etnaviv_gem_submit *submit)
> > struct etnaviv_gem_object *etnaviv_obj = submit->bos[i].obj;
> >
> > submit_unlock_object(submit, i);
> > - drm_gem_object_unreference_unlocked(&etnaviv_obj->base);
> > + drm_gem_object_put_unlocked(&etnaviv_obj->base);
> > }
> >
> > ww_acquire_fini(&submit->ticket);
>
>

2017-08-11 15:21:39

by Cihangir Akturk

[permalink] [raw]
Subject: Re: [PATCH v3 00/28] DRM API Conversions

On Fri, Aug 11, 2017 at 02:24:19PM +0000, Deucher, Alexander wrote:
> > -----Original Message-----
> > From: amd-gfx [mailto:[email protected]] On Behalf
> > Of Cihangir Akturk
> > Sent: Friday, August 11, 2017 8:33 AM
> > Cc: [email protected]; [email protected]; intel-
> > [email protected]; [email protected]; dri-
> > [email protected]; [email protected]; Cihangir Akturk;
> > [email protected]; [email protected];
> > [email protected]; [email protected];
> > [email protected]; [email protected]
> > Subject: [PATCH v3 00/28] DRM API Conversions
> >
> > Changes since v2:
> >
> > - Patch series is based on *drm-misc-next* as suggested by Sean Paul.
> >
> > - Dropped patch 05 (drm/atmel-hlcdc) and patch 25 (drm/vc4) from v2,
> > since they were already pulled in the drm-misc-next
> >
> > Changes since v1:
> >
> > - This time patches were generated with coccinelle instead of my own
> > script, as suggested by Daniel Vetter.
> >
> > - Fixed the typo in commit messages. s/adn/and
> >
>
> FWIW, I already picked up v1 of these patches for radeon and amdgpu.

I think you can skip these patches of v3 for amdgpu and radeon, as
they have remained unchanged since v1.

>
> Alex
>
> > Note: I've included r-b, a-b tags, as these patches are identical to v1
> > except for the file: drivers/gpu/drm/i915/i915_gem_object.h
> >
> > This patch set replaces the occurrences of drm_*_reference() and
> > drm_*_unreference() with the new drm_*_get() and drm_*_put()
> > functions.
> > All patches in the series do the same thing, converting to the new APIs.
> > I created patches per DRM driver as suggested by Daniel Vetter.
> >
> > This patch set was generated by scripts/coccinelle/api/drm-get-put.cocci
> >
> > Previous thread can be reached at:
> > https://marc.info/?l=dri-devel&m=150178288816047
> >
> > Background:
> >
> > In the kernel, reference counting APIs use *_get(), *_put() style naming
> > to reference-count the objects. But DRM subsystem uses a different
> > naming for them such as *_reference(), *_unreference() which is
> > inconsistent with the other reference counting APIs in the kernel. To
> > solve this consistency issue, Thierry Reding introduced a couple of
> > functions and compatibility aliases in the following commits for them.
> >
> > commit 020a218f95bd3ceff7dd1022ff7ebc0497bc7bf9
> > Author: Thierry Reding <[email protected]>
> > Date: Tue Feb 28 15:46:38 2017 +0100
> >
> > drm: Introduce drm_mode_object_{get,put}()
> >
> > commit ad09360750afa18a0a0ce0253d6ea6033abc22e7
> > Author: Thierry Reding <[email protected]>
> > Date: Tue Feb 28 15:46:39 2017 +0100
> >
> > drm: Introduce drm_connector_{get,put}()
> >
> > commit a4a69da06bc11a937a6e417938b1bb698ee1fa46
> > Author: Thierry Reding <[email protected]>
> > Date: Tue Feb 28 15:46:40 2017 +0100
> >
> > drm: Introduce drm_framebuffer_{get,put}()
> >
> > commit e6b62714e87c8811d5564b6a0738dcde63a51774
> > Author: Thierry Reding <[email protected]>
> > Date: Tue Feb 28 15:46:41 2017 +0100
> >
> > drm: Introduce drm_gem_object_{get,put}()
> >
> > commit 6472e5090be7c78749a3c279b4faae87ab835c40
> > Author: Thierry Reding <[email protected]>
> > Date: Tue Feb 28 15:46:42 2017 +0100
> >
> > drm: Introduce drm_property_blob_{get,put}()
> >
> > Cihangir Akturk (28):
> > drm/amdgpu: switch to drm_*_get(), drm_*_put() helpers
> > drm: mali-dp: switch to drm_*_get(), drm_*_put() helpers
> > drm/armada: switch to drm_*_get(), drm_*_put() helpers
> > drm/ast: switch to drm_*_get(), drm_*_put() helpers
> > drm/bochs: switch to drm_*_get(), drm_*_put() helpers
> > drm/cirrus: switch to drm_*_get(), drm_*_put() helpers
> > drm/etnaviv: switch to drm_*_get(), drm_*_put() helpers
> > drm/exynos: switch to drm_*_get(), drm_*_put() helpers
> > drm/gma500: switch to drm_*_get(), drm_*_put() helpers
> > drm/hisilicon: switch to drm_*_get(), drm_*_put() helpers
> > drm/i915: switch to drm_*_get(), drm_*_put() helpers
> > drm/imx: switch to drm_*_get(), drm_*_put() helpers
> > drm/mediatek: switch to drm_*_get(), drm_*_put() helpers
> > drm/mgag200: switch to drm_*_get(), drm_*_put() helpers
> > drm/msm: switch to drm_*_get(), drm_*_put() helpers
> > drm/nouveau: switch to drm_*_get(), drm_*_put() helpers
> > drm/omapdrm: switch to drm_*_get(), drm_*_put() helpers
> > drm/qxl: switch to drm_*_get(), drm_*_put() helpers
> > drm/radeon: switch to drm_*_get(), drm_*_put() helpers
> > drm/rockchip: switch to drm_*_get(), drm_*_put() helpers
> > drm/tegra: switch to drm_*_get(), drm_*_put() helpers
> > drm/tilcdc: switch to drm_*_get(), drm_*_put() helpers
> > drm/udl: switch to drm_*_get(), drm_*_put() helpers
> > drm/vc4: switch to drm_*_get(), drm_*_put() helpers
> > drm/vgem: switch to drm_*_get(), drm_*_put() helpers
> > drm/virtio: switch to drm_*_get(), drm_*_put() helpers
> > drm/vmwgfx: switch to drm_*_get(), drm_*_put() helpers
> > drm: vboxvideo: switch to drm_*_get(), drm_*_put() helpers
> >
> > drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c | 2 +-
> > drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 2 +-
> > drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 6 ++---
> > drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c | 4 +--
> > drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 22 ++++++++---------
> > drivers/gpu/drm/amd/amdgpu/dce_v10_0.c | 6 ++---
> > drivers/gpu/drm/amd/amdgpu/dce_v11_0.c | 6 ++---
> > drivers/gpu/drm/amd/amdgpu/dce_v6_0.c | 6 ++---
> > drivers/gpu/drm/amd/amdgpu/dce_v8_0.c | 6 ++---
> > drivers/gpu/drm/arm/malidp_planes.c | 2 +-
> > drivers/gpu/drm/armada/armada_crtc.c | 22 ++++++++---------
> > drivers/gpu/drm/armada/armada_drv.c | 2 +-
> > drivers/gpu/drm/armada/armada_fb.c | 8 +++---
> > drivers/gpu/drm/armada/armada_fbdev.c | 6 ++---
> > drivers/gpu/drm/armada/armada_gem.c | 14 +++++------
> > drivers/gpu/drm/armada/armada_overlay.c | 4 +--
> > drivers/gpu/drm/ast/ast_fb.c | 2 +-
> > drivers/gpu/drm/ast/ast_main.c | 10 ++++----
> > drivers/gpu/drm/ast/ast_mode.c | 6 ++---
> > drivers/gpu/drm/bochs/bochs_fbdev.c | 2 +-
> > drivers/gpu/drm/bochs/bochs_mm.c | 10 ++++----
> > drivers/gpu/drm/cirrus/cirrus_fbdev.c | 2 +-
> > drivers/gpu/drm/cirrus/cirrus_main.c | 10 ++++----
> > drivers/gpu/drm/etnaviv/etnaviv_drv.c | 8 +++---
> > drivers/gpu/drm/etnaviv/etnaviv_gem.c | 20 +++++++--------
> > drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c | 2 +-
> > drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c | 4 +--
> > drivers/gpu/drm/exynos/exynos_drm_fb.c | 4 +--
> > drivers/gpu/drm/exynos/exynos_drm_gem.c | 12 ++++-----
> > drivers/gpu/drm/exynos/exynos_drm_plane.c | 2 +-
> > drivers/gpu/drm/gma500/framebuffer.c | 4 +--
> > drivers/gpu/drm/gma500/gem.c | 4 +--
> > drivers/gpu/drm/gma500/gma_display.c | 6 ++---
> > drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_fbdev.c | 4 +--
> > drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c | 8 +++---
> > drivers/gpu/drm/i915/i915_gem_object.h | 4 +--
> > drivers/gpu/drm/i915/intel_display.c | 24 +++++++++---------
> > drivers/gpu/drm/i915/intel_dp_mst.c | 2 +-
> > drivers/gpu/drm/i915/intel_fbdev.c | 4 +--
> > drivers/gpu/drm/imx/ipuv3-crtc.c | 2 +-
> > drivers/gpu/drm/mediatek/mtk_drm_fb.c | 4 +--
> > drivers/gpu/drm/mediatek/mtk_drm_gem.c | 2 +-
> > drivers/gpu/drm/mgag200/mgag200_cursor.c | 2 +-
> > drivers/gpu/drm/mgag200/mgag200_fb.c | 4 +--
> > drivers/gpu/drm/mgag200/mgag200_main.c | 10 ++++----
> > drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 10 ++++----
> > drivers/gpu/drm/msm/adreno/a5xx_power.c | 2 +-
> > drivers/gpu/drm/msm/adreno/adreno_gpu.c | 2 +-
> > drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c | 6 ++---
> > drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c | 2 +-
> > drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c | 2 +-
> > drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c | 4 +--
> > drivers/gpu/drm/msm/msm_drv.c | 8 +++---
> > drivers/gpu/drm/msm/msm_fb.c | 4 +--
> > drivers/gpu/drm/msm/msm_fbdev.c | 2 +-
> > drivers/gpu/drm/msm/msm_gem.c | 8 +++---
> > drivers/gpu/drm/msm/msm_gem_submit.c | 4 +--
> > drivers/gpu/drm/msm/msm_gpu.c | 4 +--
> > drivers/gpu/drm/msm/msm_ringbuffer.c | 2 +-
> > drivers/gpu/drm/nouveau/dispnv04/crtc.c | 2 +-
> > drivers/gpu/drm/nouveau/nouveau_abi16.c | 2 +-
> > drivers/gpu/drm/nouveau/nouveau_display.c | 8 +++---
> > drivers/gpu/drm/nouveau/nouveau_fbcon.c | 2 +-
> > drivers/gpu/drm/nouveau/nouveau_gem.c | 14 +++++------
> > drivers/gpu/drm/nouveau/nv50_display.c | 2 +-
> > drivers/gpu/drm/omapdrm/omap_drv.c | 2 +-
> > drivers/gpu/drm/omapdrm/omap_fb.c | 4 +--
> > drivers/gpu/drm/omapdrm/omap_fbdev.c | 2 +-
> > drivers/gpu/drm/omapdrm/omap_gem.c | 4 +--
> > drivers/gpu/drm/omapdrm/omap_gem_dmabuf.c | 2 +-
> > drivers/gpu/drm/qxl/qxl_display.c | 4 +--
> > drivers/gpu/drm/qxl/qxl_dumb.c | 2 +-
> > drivers/gpu/drm/qxl/qxl_fb.c | 6 ++---
> > drivers/gpu/drm/qxl/qxl_gem.c | 2 +-
> > drivers/gpu/drm/qxl/qxl_ioctl.c | 4 +--
> > drivers/gpu/drm/qxl/qxl_object.c | 6 ++---
> > drivers/gpu/drm/radeon/radeon_cs.c | 2 +-
> > drivers/gpu/drm/radeon/radeon_cursor.c | 6 ++---
> > drivers/gpu/drm/radeon/radeon_display.c | 12 ++++-----
> > drivers/gpu/drm/radeon/radeon_fb.c | 4 +--
> > drivers/gpu/drm/radeon/radeon_gem.c | 30 +++++++++++------------
> > drivers/gpu/drm/radeon/radeon_object.c | 2 +-
> > drivers/gpu/drm/rockchip/rockchip_drm_fb.c | 6 ++---
> > drivers/gpu/drm/rockchip/rockchip_drm_fbdev.c | 2 +-
> > drivers/gpu/drm/rockchip/rockchip_drm_gem.c | 2 +-
> > drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 4 +--
> > drivers/gpu/drm/tegra/drm.c | 12 ++++-----
> > drivers/gpu/drm/tegra/fb.c | 8 +++---
> > drivers/gpu/drm/tegra/gem.c | 10 ++++----
> > drivers/gpu/drm/tilcdc/tilcdc_crtc.c | 6 ++---
> > drivers/gpu/drm/udl/udl_fb.c | 6 ++---
> > drivers/gpu/drm/udl/udl_gem.c | 4 +--
> > drivers/gpu/drm/vc4/vc4_bo.c | 2 +-
> > drivers/gpu/drm/vgem/vgem_drv.c | 4 +--
> > drivers/gpu/drm/vgem/vgem_fence.c | 2 +-
> > drivers/gpu/drm/virtio/virtgpu_display.c | 4 +--
> > drivers/gpu/drm/virtio/virtgpu_gem.c | 4 +--
> > drivers/gpu/drm/virtio/virtgpu_ioctl.c | 14 +++++------
> > drivers/gpu/drm/vmwgfx/vmwgfx_fb.c | 2 +-
> > drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c | 4 +--
> > drivers/staging/vboxvideo/vbox_fb.c | 2 +-
> > drivers/staging/vboxvideo/vbox_main.c | 8 +++---
> > drivers/staging/vboxvideo/vbox_mode.c | 2 +-
> > 103 files changed, 294 insertions(+), 294 deletions(-)
> >
> > --
> > 2.7.4
> >
> > _______________________________________________
> > amd-gfx mailing list
> > [email protected]
> > https://lists.freedesktop.org/mailman/listinfo/amd-gfx

2017-08-11 16:02:08

by Sean Paul

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

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 <[email protected]>
> Acked-by: Joel Stanley <[email protected]>

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

2017-08-11 16:02:18

by Sean Paul

[permalink] [raw]
Subject: Re: [PATCH v3 06/28] drm/cirrus: switch to drm_*_get(), drm_*_put() helpers

On Fri, Aug 11, 2017 at 03:32:52PM +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 <[email protected]>

Applied to drm-misc-next, thank you!

Sean

> ---
> drivers/gpu/drm/cirrus/cirrus_fbdev.c | 2 +-
> drivers/gpu/drm/cirrus/cirrus_main.c | 10 +++++-----
> 2 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/cirrus/cirrus_fbdev.c b/drivers/gpu/drm/cirrus/cirrus_fbdev.c
> index 0f6815f..32fbfba 100644
> --- a/drivers/gpu/drm/cirrus/cirrus_fbdev.c
> +++ b/drivers/gpu/drm/cirrus/cirrus_fbdev.c
> @@ -251,7 +251,7 @@ static int cirrus_fbdev_destroy(struct drm_device *dev,
> drm_fb_helper_unregister_fbi(&gfbdev->helper);
>
> if (gfb->obj) {
> - drm_gem_object_unreference_unlocked(gfb->obj);
> + drm_gem_object_put_unlocked(gfb->obj);
> gfb->obj = NULL;
> }
>
> diff --git a/drivers/gpu/drm/cirrus/cirrus_main.c b/drivers/gpu/drm/cirrus/cirrus_main.c
> index e7fc95f..b5f5285 100644
> --- a/drivers/gpu/drm/cirrus/cirrus_main.c
> +++ b/drivers/gpu/drm/cirrus/cirrus_main.c
> @@ -18,7 +18,7 @@ static void cirrus_user_framebuffer_destroy(struct drm_framebuffer *fb)
> {
> struct cirrus_framebuffer *cirrus_fb = to_cirrus_framebuffer(fb);
>
> - drm_gem_object_unreference_unlocked(cirrus_fb->obj);
> + drm_gem_object_put_unlocked(cirrus_fb->obj);
> drm_framebuffer_cleanup(fb);
> kfree(fb);
> }
> @@ -67,13 +67,13 @@ cirrus_user_framebuffer_create(struct drm_device *dev,
>
> cirrus_fb = kzalloc(sizeof(*cirrus_fb), GFP_KERNEL);
> if (!cirrus_fb) {
> - drm_gem_object_unreference_unlocked(obj);
> + drm_gem_object_put_unlocked(obj);
> return ERR_PTR(-ENOMEM);
> }
>
> ret = cirrus_framebuffer_init(dev, cirrus_fb, mode_cmd, obj);
> if (ret) {
> - drm_gem_object_unreference_unlocked(obj);
> + drm_gem_object_put_unlocked(obj);
> kfree(cirrus_fb);
> return ERR_PTR(ret);
> }
> @@ -261,7 +261,7 @@ int cirrus_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;
>
> @@ -310,7 +310,7 @@ cirrus_dumb_mmap_offset(struct drm_file *file,
> bo = gem_to_cirrus_bo(obj);
> *offset = cirrus_bo_mmap_offset(bo);
>
> - drm_gem_object_unreference_unlocked(obj);
> + drm_gem_object_put_unlocked(obj);
>
> return 0;
> }
> --
> 2.7.4
>

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

2017-08-11 16:02:56

by Sean Paul

[permalink] [raw]
Subject: Re: [PATCH v3 10/28] drm/hisilicon: switch to drm_*_get(), drm_*_put() helpers

On Fri, Aug 11, 2017 at 03:32:56PM +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 <[email protected]>

Applied to drm-misc-next, thank you!

Sean

> ---
> drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_fbdev.c | 4 ++--
> drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c | 8 ++++----
> 2 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_fbdev.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_fbdev.c
> index 9740eed..b92595c 100644
> --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_fbdev.c
> +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_fbdev.c
> @@ -157,7 +157,7 @@ static int hibmc_drm_fb_create(struct drm_fb_helper *helper,
> out_unreserve_ttm_bo:
> ttm_bo_unreserve(&bo->bo);
> out_unref_gem:
> - drm_gem_object_unreference_unlocked(gobj);
> + drm_gem_object_put_unlocked(gobj);
>
> return ret;
> }
> @@ -172,7 +172,7 @@ static void hibmc_fbdev_destroy(struct hibmc_fbdev *fbdev)
> drm_fb_helper_fini(fbh);
>
> if (gfb)
> - drm_framebuffer_unreference(&gfb->fb);
> + drm_framebuffer_put(&gfb->fb);
> }
>
> static const struct drm_fb_helper_funcs hibmc_fbdev_helper_funcs = {
> diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c
> index ac457c7..3518167 100644
> --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c
> +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c
> @@ -444,7 +444,7 @@ int hibmc_dumb_create(struct drm_file *file, struct drm_device *dev,
> }
>
> ret = drm_gem_handle_create(file, gobj, &handle);
> - drm_gem_object_unreference_unlocked(gobj);
> + drm_gem_object_put_unlocked(gobj);
> if (ret) {
> DRM_ERROR("failed to unreference GEM object: %d\n", ret);
> return ret;
> @@ -479,7 +479,7 @@ int hibmc_dumb_mmap_offset(struct drm_file *file, struct drm_device *dev,
> bo = gem_to_hibmc_bo(obj);
> *offset = hibmc_bo_mmap_offset(bo);
>
> - drm_gem_object_unreference_unlocked(obj);
> + drm_gem_object_put_unlocked(obj);
> return 0;
> }
>
> @@ -487,7 +487,7 @@ static void hibmc_user_framebuffer_destroy(struct drm_framebuffer *fb)
> {
> struct hibmc_framebuffer *hibmc_fb = to_hibmc_framebuffer(fb);
>
> - drm_gem_object_unreference_unlocked(hibmc_fb->obj);
> + drm_gem_object_put_unlocked(hibmc_fb->obj);
> drm_framebuffer_cleanup(fb);
> kfree(hibmc_fb);
> }
> @@ -543,7 +543,7 @@ hibmc_user_framebuffer_create(struct drm_device *dev,
>
> hibmc_fb = hibmc_framebuffer_init(dev, mode_cmd, obj);
> if (IS_ERR(hibmc_fb)) {
> - drm_gem_object_unreference_unlocked(obj);
> + drm_gem_object_put_unlocked(obj);
> return ERR_PTR((long)hibmc_fb);
> }
> return &hibmc_fb->fb;
> --
> 2.7.4
>

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

2017-08-11 16:03:07

by Sean Paul

[permalink] [raw]
Subject: Re: [PATCH v3 14/28] drm/mgag200: switch to drm_*_get(), drm_*_put() helpers

On Fri, Aug 11, 2017 at 03:33:00PM +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 <[email protected]>

Applied to drm-misc-next, thank you!

Sean

> ---
> drivers/gpu/drm/mgag200/mgag200_cursor.c | 2 +-
> drivers/gpu/drm/mgag200/mgag200_fb.c | 4 ++--
> drivers/gpu/drm/mgag200/mgag200_main.c | 10 +++++-----
> 3 files changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/mgag200/mgag200_cursor.c b/drivers/gpu/drm/mgag200/mgag200_cursor.c
> index 2ac3fcb..968e203 100644
> --- a/drivers/gpu/drm/mgag200/mgag200_cursor.c
> +++ b/drivers/gpu/drm/mgag200/mgag200_cursor.c
> @@ -248,7 +248,7 @@ int mga_crtc_cursor_set(struct drm_crtc *crtc,
> out_unreserve1:
> mgag200_bo_unreserve(pixels_2);
> out_unref:
> - drm_gem_object_unreference_unlocked(obj);
> + drm_gem_object_put_unlocked(obj);
>
> return ret;
> }
> diff --git a/drivers/gpu/drm/mgag200/mgag200_fb.c b/drivers/gpu/drm/mgag200/mgag200_fb.c
> index 9d914ca..30726c9 100644
> --- a/drivers/gpu/drm/mgag200/mgag200_fb.c
> +++ b/drivers/gpu/drm/mgag200/mgag200_fb.c
> @@ -232,7 +232,7 @@ static int mgag200fb_create(struct drm_fb_helper *helper,
> err_alloc_fbi:
> vfree(sysram);
> err_sysram:
> - drm_gem_object_unreference_unlocked(gobj);
> + drm_gem_object_put_unlocked(gobj);
>
> return ret;
> }
> @@ -245,7 +245,7 @@ static int mga_fbdev_destroy(struct drm_device *dev,
> drm_fb_helper_unregister_fbi(&mfbdev->helper);
>
> if (mfb->obj) {
> - drm_gem_object_unreference_unlocked(mfb->obj);
> + drm_gem_object_put_unlocked(mfb->obj);
> mfb->obj = NULL;
> }
> drm_fb_helper_fini(&mfbdev->helper);
> diff --git a/drivers/gpu/drm/mgag200/mgag200_main.c b/drivers/gpu/drm/mgag200/mgag200_main.c
> index dce8a3e..780f983 100644
> --- a/drivers/gpu/drm/mgag200/mgag200_main.c
> +++ b/drivers/gpu/drm/mgag200/mgag200_main.c
> @@ -18,7 +18,7 @@ static void mga_user_framebuffer_destroy(struct drm_framebuffer *fb)
> {
> struct mga_framebuffer *mga_fb = to_mga_framebuffer(fb);
>
> - drm_gem_object_unreference_unlocked(mga_fb->obj);
> + drm_gem_object_put_unlocked(mga_fb->obj);
> drm_framebuffer_cleanup(fb);
> kfree(fb);
> }
> @@ -59,13 +59,13 @@ mgag200_user_framebuffer_create(struct drm_device *dev,
>
> mga_fb = kzalloc(sizeof(*mga_fb), GFP_KERNEL);
> if (!mga_fb) {
> - drm_gem_object_unreference_unlocked(obj);
> + drm_gem_object_put_unlocked(obj);
> return ERR_PTR(-ENOMEM);
> }
>
> ret = mgag200_framebuffer_init(dev, mga_fb, mode_cmd, obj);
> if (ret) {
> - drm_gem_object_unreference_unlocked(obj);
> + drm_gem_object_put_unlocked(obj);
> kfree(mga_fb);
> return ERR_PTR(ret);
> }
> @@ -317,7 +317,7 @@ int mgag200_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;
>
> @@ -366,6 +366,6 @@ mgag200_dumb_mmap_offset(struct drm_file *file,
> bo = gem_to_mga_bo(obj);
> *offset = mgag200_bo_mmap_offset(bo);
>
> - drm_gem_object_unreference_unlocked(obj);
> + drm_gem_object_put_unlocked(obj);
> return 0;
> }
> --
> 2.7.4
>

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

2017-08-11 16:03:29

by Sean Paul

[permalink] [raw]
Subject: Re: [PATCH v3 20/28] drm/rockchip: switch to drm_*_get(), drm_*_put() helpers

On Fri, Aug 11, 2017 at 03:33:06PM +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 <[email protected]>

Applied to drm-misc-next, thank you!

Sean

> ---
> drivers/gpu/drm/rockchip/rockchip_drm_fb.c | 6 +++---
> drivers/gpu/drm/rockchip/rockchip_drm_fbdev.c | 2 +-
> drivers/gpu/drm/rockchip/rockchip_drm_gem.c | 2 +-
> drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 4 ++--
> 4 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c
> index 8a0f756..7077304 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c
> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c
> @@ -48,7 +48,7 @@ static void rockchip_drm_fb_destroy(struct drm_framebuffer *fb)
> int i;
>
> for (i = 0; i < ROCKCHIP_MAX_FB_BUFFER; i++)
> - drm_gem_object_unreference_unlocked(rockchip_fb->obj[i]);
> + drm_gem_object_put_unlocked(rockchip_fb->obj[i]);
>
> drm_framebuffer_cleanup(fb);
> kfree(rockchip_fb);
> @@ -144,7 +144,7 @@ rockchip_user_fb_create(struct drm_device *dev, struct drm_file *file_priv,
> width * drm_format_plane_cpp(mode_cmd->pixel_format, i);
>
> if (obj->size < min_size) {
> - drm_gem_object_unreference_unlocked(obj);
> + drm_gem_object_put_unlocked(obj);
> ret = -EINVAL;
> goto err_gem_object_unreference;
> }
> @@ -161,7 +161,7 @@ rockchip_user_fb_create(struct drm_device *dev, struct drm_file *file_priv,
>
> err_gem_object_unreference:
> for (i--; i >= 0; i--)
> - drm_gem_object_unreference_unlocked(objs[i]);
> + drm_gem_object_put_unlocked(objs[i]);
> return ERR_PTR(ret);
> }
>
> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_fbdev.c b/drivers/gpu/drm/rockchip/rockchip_drm_fbdev.c
> index ce946b9..724579e 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_drm_fbdev.c
> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_fbdev.c
> @@ -173,7 +173,7 @@ void rockchip_drm_fbdev_fini(struct drm_device *dev)
> drm_fb_helper_unregister_fbi(helper);
>
> if (helper->fb)
> - drm_framebuffer_unreference(helper->fb);
> + drm_framebuffer_put(helper->fb);
>
> drm_fb_helper_fini(helper);
> }
> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c
> index f74333e..1869c8b 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c
> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c
> @@ -383,7 +383,7 @@ rockchip_gem_create_with_handle(struct drm_file *file_priv,
> goto err_handle_create;
>
> /* drop reference from allocate - handle holds it now. */
> - drm_gem_object_unreference_unlocked(obj);
> + drm_gem_object_put_unlocked(obj);
>
> return rk_obj;
>
> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> index 948719d..bf9ed0e 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> @@ -1026,7 +1026,7 @@ static void vop_crtc_atomic_flush(struct drm_crtc *crtc,
> if (old_plane_state->fb == new_plane_state->fb)
> continue;
>
> - drm_framebuffer_reference(old_plane_state->fb);
> + drm_framebuffer_get(old_plane_state->fb);
> drm_flip_work_queue(&vop->fb_unref_work, old_plane_state->fb);
> set_bit(VOP_PENDING_FB_UNREF, &vop->pending);
> WARN_ON(drm_crtc_vblank_get(crtc) != 0);
> @@ -1150,7 +1150,7 @@ static void vop_fb_unref_worker(struct drm_flip_work *work, void *val)
> struct drm_framebuffer *fb = val;
>
> drm_crtc_vblank_put(&vop->crtc);
> - drm_framebuffer_unreference(fb);
> + drm_framebuffer_put(fb);
> }
>
> static void vop_handle_vblank(struct vop *vop)
> --
> 2.7.4
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> [email protected]
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

2017-08-11 16:03:40

by Sean Paul

[permalink] [raw]
Subject: Re: [PATCH v3 23/28] drm/udl: switch to drm_*_get(), drm_*_put() helpers

On Fri, Aug 11, 2017 at 03:33:09PM +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 <[email protected]>

Applied to drm-misc-next, thank you!

Sean

> ---
> drivers/gpu/drm/udl/udl_fb.c | 6 +++---
> drivers/gpu/drm/udl/udl_gem.c | 4 ++--
> 2 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/udl/udl_fb.c b/drivers/gpu/drm/udl/udl_fb.c
> index 77a2c59..b7ca90d 100644
> --- a/drivers/gpu/drm/udl/udl_fb.c
> +++ b/drivers/gpu/drm/udl/udl_fb.c
> @@ -309,7 +309,7 @@ static void udl_user_framebuffer_destroy(struct drm_framebuffer *fb)
> struct udl_framebuffer *ufb = to_udl_fb(fb);
>
> if (ufb->obj)
> - drm_gem_object_unreference_unlocked(&ufb->obj->base);
> + drm_gem_object_put_unlocked(&ufb->obj->base);
>
> drm_framebuffer_cleanup(fb);
> kfree(ufb);
> @@ -403,7 +403,7 @@ static int udlfb_create(struct drm_fb_helper *helper,
>
> return ret;
> out_gfree:
> - drm_gem_object_unreference_unlocked(&ufbdev->ufb.obj->base);
> + drm_gem_object_put_unlocked(&ufbdev->ufb.obj->base);
> out:
> return ret;
> }
> @@ -419,7 +419,7 @@ static void udl_fbdev_destroy(struct drm_device *dev,
> drm_fb_helper_fini(&ufbdev->helper);
> drm_framebuffer_unregister_private(&ufbdev->ufb.base);
> drm_framebuffer_cleanup(&ufbdev->ufb.base);
> - drm_gem_object_unreference_unlocked(&ufbdev->ufb.obj->base);
> + drm_gem_object_put_unlocked(&ufbdev->ufb.obj->base);
> }
>
> int udl_fbdev_init(struct drm_device *dev)
> diff --git a/drivers/gpu/drm/udl/udl_gem.c b/drivers/gpu/drm/udl/udl_gem.c
> index db9cece..dee6bd9 100644
> --- a/drivers/gpu/drm/udl/udl_gem.c
> +++ b/drivers/gpu/drm/udl/udl_gem.c
> @@ -52,7 +52,7 @@ udl_gem_create(struct drm_file *file,
> return ret;
> }
>
> - drm_gem_object_unreference_unlocked(&obj->base);
> + drm_gem_object_put_unlocked(&obj->base);
> *handle_p = handle;
> return 0;
> }
> @@ -234,7 +234,7 @@ int udl_gem_mmap(struct drm_file *file, struct drm_device *dev,
> *offset = drm_vma_node_offset_addr(&gobj->base.vma_node);
>
> out:
> - drm_gem_object_unreference(&gobj->base);
> + drm_gem_object_put(&gobj->base);
> unlock:
> mutex_unlock(&dev->struct_mutex);
> return ret;
> --
> 2.7.4
>

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

2017-08-11 16:03:48

by Sean Paul

[permalink] [raw]
Subject: Re: [PATCH v3 25/28] drm/vgem: switch to drm_*_get(), drm_*_put() helpers

On Fri, Aug 11, 2017 at 03:33:11PM +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 <[email protected]>

Applied to drm-misc-next, thank you!

Sean

> ---
> drivers/gpu/drm/vgem/vgem_drv.c | 4 ++--
> drivers/gpu/drm/vgem/vgem_fence.c | 2 +-
> 2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/vgem/vgem_drv.c b/drivers/gpu/drm/vgem/vgem_drv.c
> index 1228967..2524ff1 100644
> --- a/drivers/gpu/drm/vgem/vgem_drv.c
> +++ b/drivers/gpu/drm/vgem/vgem_drv.c
> @@ -190,7 +190,7 @@ static struct drm_gem_object *vgem_gem_create(struct drm_device *dev,
> return ERR_CAST(obj);
>
> ret = drm_gem_handle_create(file, &obj->base, handle);
> - drm_gem_object_unreference_unlocked(&obj->base);
> + drm_gem_object_put_unlocked(&obj->base);
> if (ret)
> goto err;
>
> @@ -245,7 +245,7 @@ static int vgem_gem_dumb_map(struct drm_file *file, struct drm_device *dev,
>
> *offset = drm_vma_node_offset_addr(&obj->vma_node);
> unref:
> - drm_gem_object_unreference_unlocked(obj);
> + drm_gem_object_put_unlocked(obj);
>
> return ret;
> }
> diff --git a/drivers/gpu/drm/vgem/vgem_fence.c b/drivers/gpu/drm/vgem/vgem_fence.c
> index 3109c83..8fd52f2 100644
> --- a/drivers/gpu/drm/vgem/vgem_fence.c
> +++ b/drivers/gpu/drm/vgem/vgem_fence.c
> @@ -213,7 +213,7 @@ int vgem_fence_attach_ioctl(struct drm_device *dev,
> dma_fence_put(fence);
> }
> err:
> - drm_gem_object_unreference_unlocked(obj);
> + drm_gem_object_put_unlocked(obj);
> return ret;
> }
>
> --
> 2.7.4
>

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

2017-08-11 16:04:05

by Sean Paul

[permalink] [raw]
Subject: Re: [PATCH v3 13/28] drm/mediatek: switch to drm_*_get(), drm_*_put() helpers

On Fri, Aug 11, 2017 at 03:01:40PM +0200, Philipp Zabel wrote:
> On Fri, 2017-08-11 at 15:32 +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 <[email protected]>
> > ---
> > ?drivers/gpu/drm/mediatek/mtk_drm_fb.c??| 4 ++--
> > ?drivers/gpu/drm/mediatek/mtk_drm_gem.c | 2 +-
> > ?2 files changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/mediatek/mtk_drm_fb.c
> > b/drivers/gpu/drm/mediatek/mtk_drm_fb.c
> > index d4246c9..0d8d506 100644
> > --- a/drivers/gpu/drm/mediatek/mtk_drm_fb.c
> > +++ b/drivers/gpu/drm/mediatek/mtk_drm_fb.c
> > @@ -58,7 +58,7 @@ static void mtk_drm_fb_destroy(struct
> > drm_framebuffer *fb)
> > ?
> > ? drm_framebuffer_cleanup(fb);
> > ?
> > - drm_gem_object_unreference_unlocked(mtk_fb->gem_obj);
> > + drm_gem_object_put_unlocked(mtk_fb->gem_obj);
> > ?
> > ? kfree(mtk_fb);
> > ?}
> > @@ -160,6 +160,6 @@ struct drm_framebuffer
> > *mtk_drm_mode_fb_create(struct drm_device *dev,
> > ? return &mtk_fb->base;
> > ?
> > ?unreference:
> > - drm_gem_object_unreference_unlocked(gem);
> > + drm_gem_object_put_unlocked(gem);
> > ? return ERR_PTR(ret);
> > ?}
> > diff --git a/drivers/gpu/drm/mediatek/mtk_drm_gem.c
> > b/drivers/gpu/drm/mediatek/mtk_drm_gem.c
> > index 8ec963f..f595ac8 100644
> > --- a/drivers/gpu/drm/mediatek/mtk_drm_gem.c
> > +++ b/drivers/gpu/drm/mediatek/mtk_drm_gem.c
> > @@ -122,7 +122,7 @@ int mtk_drm_gem_dumb_create(struct drm_file
> > *file_priv, struct drm_device *dev,
> > ? goto err_handle_create;
> > ?
> > ? /* drop reference from allocate - handle holds it now. */
> > - drm_gem_object_unreference_unlocked(&mtk_gem->base);
> > + drm_gem_object_put_unlocked(&mtk_gem->base);
> > ?
> > ? return 0;
> > ?
>
> Reviewed-by: Philipp Zabel <[email protected]>

Applied to drm-misc-next, thank you for the review!

Sean

>
> regards
> Philipp
> _______________________________________________
> dri-devel mailing list
> [email protected]
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

2017-08-11 16:04:20

by Sean Paul

[permalink] [raw]
Subject: Re: [PATCH v3 28/28] drm: vboxvideo: switch to drm_*_get(), drm_*_put() helpers

On Fri, Aug 11, 2017 at 03:26:45PM +0200, Hans de Goede wrote:
> Hi,
>
> On 11-08-17 14:33, 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 <[email protected]>
>
> Thank you for doing this, looks good to me:
>
> Reviewed-by: Hans de Goede <[email protected]>
>

Applied to drm-misc-next, thank you for the review!

Sean

> Regards,
>
> Hans
>
>
>
> > ---
> > drivers/staging/vboxvideo/vbox_fb.c | 2 +-
> > drivers/staging/vboxvideo/vbox_main.c | 8 ++++----
> > drivers/staging/vboxvideo/vbox_mode.c | 2 +-
> > 3 files changed, 6 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/staging/vboxvideo/vbox_fb.c b/drivers/staging/vboxvideo/vbox_fb.c
> > index bf66358..c157284 100644
> > --- a/drivers/staging/vboxvideo/vbox_fb.c
> > +++ b/drivers/staging/vboxvideo/vbox_fb.c
> > @@ -343,7 +343,7 @@ void vbox_fbdev_fini(struct drm_device *dev)
> > vbox_bo_unpin(bo);
> > vbox_bo_unreserve(bo);
> > }
> > - drm_gem_object_unreference_unlocked(afb->obj);
> > + drm_gem_object_put_unlocked(afb->obj);
> > afb->obj = NULL;
> > }
> > drm_fb_helper_fini(&fbdev->helper);
> > diff --git a/drivers/staging/vboxvideo/vbox_main.c b/drivers/staging/vboxvideo/vbox_main.c
> > index d0c6ec7..80bd039 100644
> > --- a/drivers/staging/vboxvideo/vbox_main.c
> > +++ b/drivers/staging/vboxvideo/vbox_main.c
> > @@ -40,7 +40,7 @@ static void vbox_user_framebuffer_destroy(struct drm_framebuffer *fb)
> > struct vbox_framebuffer *vbox_fb = to_vbox_framebuffer(fb);
> > if (vbox_fb->obj)
> > - drm_gem_object_unreference_unlocked(vbox_fb->obj);
> > + drm_gem_object_put_unlocked(vbox_fb->obj);
> > drm_framebuffer_cleanup(fb);
> > kfree(fb);
> > @@ -198,7 +198,7 @@ static struct drm_framebuffer *vbox_user_framebuffer_create(
> > err_free_vbox_fb:
> > kfree(vbox_fb);
> > err_unref_obj:
> > - drm_gem_object_unreference_unlocked(obj);
> > + drm_gem_object_put_unlocked(obj);
> > return ERR_PTR(ret);
> > }
> > @@ -472,7 +472,7 @@ int vbox_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;
> > @@ -525,7 +525,7 @@ vbox_dumb_mmap_offset(struct drm_file *file,
> > bo = gem_to_vbox_bo(obj);
> > *offset = vbox_bo_mmap_offset(bo);
> > - drm_gem_object_unreference(obj);
> > + drm_gem_object_put(obj);
> > ret = 0;
> > out_unlock:
> > diff --git a/drivers/staging/vboxvideo/vbox_mode.c b/drivers/staging/vboxvideo/vbox_mode.c
> > index 996da1c..e5b6383 100644
> > --- a/drivers/staging/vboxvideo/vbox_mode.c
> > +++ b/drivers/staging/vboxvideo/vbox_mode.c
> > @@ -812,7 +812,7 @@ static int vbox_cursor_set2(struct drm_crtc *crtc, struct drm_file *file_priv,
> > out_unreserve_bo:
> > vbox_bo_unreserve(bo);
> > out_unref_obj:
> > - drm_gem_object_unreference_unlocked(obj);
> > + drm_gem_object_put_unlocked(obj);
> > return ret;
> > }
> >
> _______________________________________________
> dri-devel mailing list
> [email protected]
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

2017-08-11 16:11:13

by Hans de Goede

[permalink] [raw]
Subject: Re: [PATCH v3 28/28] drm: vboxvideo: switch to drm_*_get(), drm_*_put() helpers

Hi,

On 11-08-17 18:04, Sean Paul wrote:
> On Fri, Aug 11, 2017 at 03:26:45PM +0200, Hans de Goede wrote:
>> Hi,
>>
>> On 11-08-17 14:33, 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 <[email protected]>
>>
>> Thank you for doing this, looks good to me:
>>
>> Reviewed-by: Hans de Goede <[email protected]>
>>
>
> Applied to drm-misc-next, thank you for the review!

Erm vboxvideo is in staging, does this mean all patches for
it will now go through drm-misc-next despite it being in
staging (*) ? Because if some patches get merged through
drm-misc-next and some through Greg's staging repo that
is not going to end well.

Regards,

Hans



*) that is fine, the same is done for e.g. the media drivers afaik


>
> Sean
>
>> Regards,
>>
>> Hans
>>
>>
>>
>>> ---
>>> drivers/staging/vboxvideo/vbox_fb.c | 2 +-
>>> drivers/staging/vboxvideo/vbox_main.c | 8 ++++----
>>> drivers/staging/vboxvideo/vbox_mode.c | 2 +-
>>> 3 files changed, 6 insertions(+), 6 deletions(-)
>>>
>>> diff --git a/drivers/staging/vboxvideo/vbox_fb.c b/drivers/staging/vboxvideo/vbox_fb.c
>>> index bf66358..c157284 100644
>>> --- a/drivers/staging/vboxvideo/vbox_fb.c
>>> +++ b/drivers/staging/vboxvideo/vbox_fb.c
>>> @@ -343,7 +343,7 @@ void vbox_fbdev_fini(struct drm_device *dev)
>>> vbox_bo_unpin(bo);
>>> vbox_bo_unreserve(bo);
>>> }
>>> - drm_gem_object_unreference_unlocked(afb->obj);
>>> + drm_gem_object_put_unlocked(afb->obj);
>>> afb->obj = NULL;
>>> }
>>> drm_fb_helper_fini(&fbdev->helper);
>>> diff --git a/drivers/staging/vboxvideo/vbox_main.c b/drivers/staging/vboxvideo/vbox_main.c
>>> index d0c6ec7..80bd039 100644
>>> --- a/drivers/staging/vboxvideo/vbox_main.c
>>> +++ b/drivers/staging/vboxvideo/vbox_main.c
>>> @@ -40,7 +40,7 @@ static void vbox_user_framebuffer_destroy(struct drm_framebuffer *fb)
>>> struct vbox_framebuffer *vbox_fb = to_vbox_framebuffer(fb);
>>> if (vbox_fb->obj)
>>> - drm_gem_object_unreference_unlocked(vbox_fb->obj);
>>> + drm_gem_object_put_unlocked(vbox_fb->obj);
>>> drm_framebuffer_cleanup(fb);
>>> kfree(fb);
>>> @@ -198,7 +198,7 @@ static struct drm_framebuffer *vbox_user_framebuffer_create(
>>> err_free_vbox_fb:
>>> kfree(vbox_fb);
>>> err_unref_obj:
>>> - drm_gem_object_unreference_unlocked(obj);
>>> + drm_gem_object_put_unlocked(obj);
>>> return ERR_PTR(ret);
>>> }
>>> @@ -472,7 +472,7 @@ int vbox_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;
>>> @@ -525,7 +525,7 @@ vbox_dumb_mmap_offset(struct drm_file *file,
>>> bo = gem_to_vbox_bo(obj);
>>> *offset = vbox_bo_mmap_offset(bo);
>>> - drm_gem_object_unreference(obj);
>>> + drm_gem_object_put(obj);
>>> ret = 0;
>>> out_unlock:
>>> diff --git a/drivers/staging/vboxvideo/vbox_mode.c b/drivers/staging/vboxvideo/vbox_mode.c
>>> index 996da1c..e5b6383 100644
>>> --- a/drivers/staging/vboxvideo/vbox_mode.c
>>> +++ b/drivers/staging/vboxvideo/vbox_mode.c
>>> @@ -812,7 +812,7 @@ static int vbox_cursor_set2(struct drm_crtc *crtc, struct drm_file *file_priv,
>>> out_unreserve_bo:
>>> vbox_bo_unreserve(bo);
>>> out_unref_obj:
>>> - drm_gem_object_unreference_unlocked(obj);
>>> + drm_gem_object_put_unlocked(obj);
>>> return ret;
>>> }
>>>
>> _______________________________________________
>> dri-devel mailing list
>> [email protected]
>> https://lists.freedesktop.org/mailman/listinfo/dri-devel
>

2017-08-11 16:11:51

by Daniel Vetter

[permalink] [raw]
Subject: Re: [PATCH v3 11/28] drm/i915: switch to drm_*_get(), drm_*_put() helpers

On Fri, Aug 11, 2017 at 03:32:57PM +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 <[email protected]>

Seems this is against a rather old version of drm/i915. Can you pls
regenerate against linux-next or the drm-tip branch from

https://cgit.freedesktop.org/drm-tip

But in general, for large-scale refactoring like this, the recommendation
is to base them on linux-next, since that will have all pending patches
applied for every part of the kernel.
-Daniel

> ---
> drivers/gpu/drm/i915/i915_gem_object.h | 4 ++--
> drivers/gpu/drm/i915/intel_display.c | 24 ++++++++++++------------
> drivers/gpu/drm/i915/intel_dp_mst.c | 2 +-
> drivers/gpu/drm/i915/intel_fbdev.c | 4 ++--
> 4 files changed, 17 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem_object.h b/drivers/gpu/drm/i915/i915_gem_object.h
> index 5b19a49..95cfb64 100644
> --- a/drivers/gpu/drm/i915/i915_gem_object.h
> +++ b/drivers/gpu/drm/i915/i915_gem_object.h
> @@ -257,7 +257,7 @@ __attribute__((nonnull))
> static inline struct drm_i915_gem_object *
> i915_gem_object_get(struct drm_i915_gem_object *obj)
> {
> - drm_gem_object_reference(&obj->base);
> + drm_gem_object_get(&obj->base);
> return obj;
> }
>
> @@ -268,7 +268,7 @@ __attribute__((nonnull))
> static inline void
> i915_gem_object_put(struct drm_i915_gem_object *obj)
> {
> - __drm_gem_object_unreference(&obj->base);
> + __drm_gem_object_put(&obj->base);
> }
>
> __deprecated
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 684d653..70ebc19 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -2672,10 +2672,10 @@ update_state_fb(struct drm_plane *plane)
> return;
>
> if (plane->state->fb)
> - drm_framebuffer_unreference(plane->state->fb);
> + drm_framebuffer_put(plane->state->fb);
> plane->state->fb = plane->fb;
> if (plane->state->fb)
> - drm_framebuffer_reference(plane->state->fb);
> + drm_framebuffer_get(plane->state->fb);
> }
>
> static void
> @@ -2746,7 +2746,7 @@ intel_find_initial_plane_obj(struct intel_crtc *intel_crtc,
>
> if (intel_plane_ggtt_offset(state) == plane_config->base) {
> fb = c->primary->fb;
> - drm_framebuffer_reference(fb);
> + drm_framebuffer_get(fb);
> goto valid_fb;
> }
> }
> @@ -2777,7 +2777,7 @@ intel_find_initial_plane_obj(struct intel_crtc *intel_crtc,
> intel_crtc->pipe, PTR_ERR(intel_state->vma));
>
> intel_state->vma = NULL;
> - drm_framebuffer_unreference(fb);
> + drm_framebuffer_put(fb);
> return;
> }
>
> @@ -2798,7 +2798,7 @@ intel_find_initial_plane_obj(struct intel_crtc *intel_crtc,
> if (i915_gem_object_is_tiled(obj))
> dev_priv->preserve_bios_swizzle = true;
>
> - drm_framebuffer_reference(fb);
> + drm_framebuffer_get(fb);
> primary->fb = primary->state->fb = fb;
> primary->crtc = primary->state->crtc = &intel_crtc->base;
>
> @@ -9683,7 +9683,7 @@ mode_fits_in_fbdev(struct drm_device *dev,
> if (obj->base.size < mode->vdisplay * fb->pitches[0])
> return NULL;
>
> - drm_framebuffer_reference(fb);
> + drm_framebuffer_get(fb);
> return fb;
> #else
> return NULL;
> @@ -9864,7 +9864,7 @@ int intel_get_load_detect_pipe(struct drm_connector *connector,
> if (ret)
> goto fail;
>
> - drm_framebuffer_unreference(fb);
> + drm_framebuffer_put(fb);
>
> ret = drm_atomic_set_mode_for_crtc(&crtc_state->base, mode);
> if (ret)
> @@ -10174,7 +10174,7 @@ static void intel_unpin_work_fn(struct work_struct *__work)
> intel_frontbuffer_flip_complete(to_i915(dev),
> to_intel_plane(primary)->frontbuffer_bit);
> intel_fbc_post_update(crtc);
> - drm_framebuffer_unreference(work->old_fb);
> + drm_framebuffer_put(work->old_fb);
>
> BUG_ON(atomic_read(&crtc->unpin_work_count) == 0);
> atomic_dec(&crtc->unpin_work_count);
> @@ -10814,7 +10814,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
> flush_workqueue(dev_priv->wq);
>
> /* Reference the objects for the scheduled work. */
> - drm_framebuffer_reference(work->old_fb);
> + drm_framebuffer_get(work->old_fb);
>
> crtc->primary->fb = fb;
> update_state_fb(crtc->primary);
> @@ -10928,7 +10928,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
> update_state_fb(crtc->primary);
>
> i915_gem_object_put(obj);
> - drm_framebuffer_unreference(work->old_fb);
> + drm_framebuffer_put(work->old_fb);
>
> spin_lock_irq(&dev->event_lock);
> intel_crtc->flip_work = NULL;
> @@ -11252,7 +11252,7 @@ static void intel_modeset_update_connector_atomic_state(struct drm_device *dev)
> drm_connector_list_iter_begin(dev, &conn_iter);
> for_each_intel_connector_iter(connector, &conn_iter) {
> if (connector->base.state->crtc)
> - drm_connector_unreference(&connector->base);
> + drm_connector_put(&connector->base);
>
> if (connector->base.encoder) {
> connector->base.state->best_encoder =
> @@ -11260,7 +11260,7 @@ static void intel_modeset_update_connector_atomic_state(struct drm_device *dev)
> connector->base.state->crtc =
> connector->base.encoder->crtc;
>
> - drm_connector_reference(&connector->base);
> + drm_connector_get(&connector->base);
> } else {
> connector->base.state->best_encoder = NULL;
> connector->base.state->crtc = NULL;
> diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c b/drivers/gpu/drm/i915/intel_dp_mst.c
> index 5856855..99a6fd8 100644
> --- a/drivers/gpu/drm/i915/intel_dp_mst.c
> +++ b/drivers/gpu/drm/i915/intel_dp_mst.c
> @@ -501,7 +501,7 @@ static void intel_dp_destroy_mst_connector(struct drm_dp_mst_topology_mgr *mgr,
> intel_connector->mst_port = NULL;
> drm_modeset_unlock(&connector->dev->mode_config.connection_mutex);
>
> - drm_connector_unreference(connector);
> + drm_connector_put(connector);
> DRM_DEBUG_KMS("\n");
> }
>
> diff --git a/drivers/gpu/drm/i915/intel_fbdev.c b/drivers/gpu/drm/i915/intel_fbdev.c
> index 0986ca4..5568e33 100644
> --- a/drivers/gpu/drm/i915/intel_fbdev.c
> +++ b/drivers/gpu/drm/i915/intel_fbdev.c
> @@ -189,7 +189,7 @@ static int intelfb_create(struct drm_fb_helper *helper,
> " releasing it\n",
> intel_fb->base.width, intel_fb->base.height,
> sizes->fb_width, sizes->fb_height);
> - drm_framebuffer_unreference(&intel_fb->base);
> + drm_framebuffer_put(&intel_fb->base);
> intel_fb = ifbdev->fb = NULL;
> }
> if (!intel_fb || WARN_ON(!intel_fb->obj)) {
> @@ -626,7 +626,7 @@ static bool intel_fbdev_init_bios(struct drm_device *dev,
> ifbdev->preferred_bpp = fb->base.format->cpp[0] * 8;
> ifbdev->fb = fb;
>
> - drm_framebuffer_reference(&ifbdev->fb->base);
> + drm_framebuffer_get(&ifbdev->fb->base);
>
> /* Final pass to check if any active pipes don't have fbs */
> for_each_crtc(dev, crtc) {
> --
> 2.7.4
>

--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

2017-08-11 17:27:42

by Sean Paul

[permalink] [raw]
Subject: Re: [PATCH v3 28/28] drm: vboxvideo: switch to drm_*_get(), drm_*_put() helpers

On Fri, Aug 11, 2017 at 12:11 PM, Hans de Goede <[email protected]> wrote:
> Hi,
>
> On 11-08-17 18:04, Sean Paul wrote:
>>
>> On Fri, Aug 11, 2017 at 03:26:45PM +0200, Hans de Goede wrote:
>>>
>>> Hi,
>>>
>>> On 11-08-17 14:33, 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 <[email protected]>
>>>
>>>
>>> Thank you for doing this, looks good to me:
>>>
>>> Reviewed-by: Hans de Goede <[email protected]>
>>>
>>
>> Applied to drm-misc-next, thank you for the review!
>
>
> Erm vboxvideo is in staging, does this mean all patches for
> it will now go through drm-misc-next despite it being in
> staging (*) ? Because if some patches get merged through
> drm-misc-next and some through Greg's staging repo that
> is not going to end well.
>

Hi Hans,
Thanks for pointing this out. I picked it up as I was vacuuming up the
rest of the set that was not yet applied, not realizing the staging
implications. It's not my intention to start taking vboxvideo through
-misc.

Hopefully this won't cause any nasty conflicts with Greg's staging
tree, and we can treat it as a one-off. If it does cause problems, I
can revert it in -misc in favor of taking it through staging.

Sean

> Regards,
>
> Hans
>
>
>
> *) that is fine, the same is done for e.g. the media drivers afaik
>
>
>
>>
>> Sean
>>
>>> Regards,
>>>
>>> Hans
>>>
>>>
>>>
>>>> ---
>>>> drivers/staging/vboxvideo/vbox_fb.c | 2 +-
>>>> drivers/staging/vboxvideo/vbox_main.c | 8 ++++----
>>>> drivers/staging/vboxvideo/vbox_mode.c | 2 +-
>>>> 3 files changed, 6 insertions(+), 6 deletions(-)
>>>>
>>>> diff --git a/drivers/staging/vboxvideo/vbox_fb.c
>>>> b/drivers/staging/vboxvideo/vbox_fb.c
>>>> index bf66358..c157284 100644
>>>> --- a/drivers/staging/vboxvideo/vbox_fb.c
>>>> +++ b/drivers/staging/vboxvideo/vbox_fb.c
>>>> @@ -343,7 +343,7 @@ void vbox_fbdev_fini(struct drm_device *dev)
>>>> vbox_bo_unpin(bo);
>>>> vbox_bo_unreserve(bo);
>>>> }
>>>> - drm_gem_object_unreference_unlocked(afb->obj);
>>>> + drm_gem_object_put_unlocked(afb->obj);
>>>> afb->obj = NULL;
>>>> }
>>>> drm_fb_helper_fini(&fbdev->helper);
>>>> diff --git a/drivers/staging/vboxvideo/vbox_main.c
>>>> b/drivers/staging/vboxvideo/vbox_main.c
>>>> index d0c6ec7..80bd039 100644
>>>> --- a/drivers/staging/vboxvideo/vbox_main.c
>>>> +++ b/drivers/staging/vboxvideo/vbox_main.c
>>>> @@ -40,7 +40,7 @@ static void vbox_user_framebuffer_destroy(struct
>>>> drm_framebuffer *fb)
>>>> struct vbox_framebuffer *vbox_fb = to_vbox_framebuffer(fb);
>>>> if (vbox_fb->obj)
>>>> - drm_gem_object_unreference_unlocked(vbox_fb->obj);
>>>> + drm_gem_object_put_unlocked(vbox_fb->obj);
>>>> drm_framebuffer_cleanup(fb);
>>>> kfree(fb);
>>>> @@ -198,7 +198,7 @@ static struct drm_framebuffer
>>>> *vbox_user_framebuffer_create(
>>>> err_free_vbox_fb:
>>>> kfree(vbox_fb);
>>>> err_unref_obj:
>>>> - drm_gem_object_unreference_unlocked(obj);
>>>> + drm_gem_object_put_unlocked(obj);
>>>> return ERR_PTR(ret);
>>>> }
>>>> @@ -472,7 +472,7 @@ int vbox_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;
>>>> @@ -525,7 +525,7 @@ vbox_dumb_mmap_offset(struct drm_file *file,
>>>> bo = gem_to_vbox_bo(obj);
>>>> *offset = vbox_bo_mmap_offset(bo);
>>>> - drm_gem_object_unreference(obj);
>>>> + drm_gem_object_put(obj);
>>>> ret = 0;
>>>> out_unlock:
>>>> diff --git a/drivers/staging/vboxvideo/vbox_mode.c
>>>> b/drivers/staging/vboxvideo/vbox_mode.c
>>>> index 996da1c..e5b6383 100644
>>>> --- a/drivers/staging/vboxvideo/vbox_mode.c
>>>> +++ b/drivers/staging/vboxvideo/vbox_mode.c
>>>> @@ -812,7 +812,7 @@ static int vbox_cursor_set2(struct drm_crtc *crtc,
>>>> struct drm_file *file_priv,
>>>> out_unreserve_bo:
>>>> vbox_bo_unreserve(bo);
>>>> out_unref_obj:
>>>> - drm_gem_object_unreference_unlocked(obj);
>>>> + drm_gem_object_put_unlocked(obj);
>>>> return ret;
>>>> }
>>>>
>>> _______________________________________________
>>> dri-devel mailing list
>>> [email protected]
>>> https://lists.freedesktop.org/mailman/listinfo/dri-devel
>>
>>
>

2017-08-13 13:30:26

by Cihangir Akturk

[permalink] [raw]
Subject: [PATCH] drm/i915: 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: Cihangir Akturk <[email protected]>
---

This patch was generated against *drm-tip*.

If needed, I can re-generate the whole series against *drm-tip* and
resend.

drivers/gpu/drm/i915/i915_gem_object.h | 4 ++--
drivers/gpu/drm/i915/intel_display.c | 14 +++++++-------
drivers/gpu/drm/i915/intel_dp_mst.c | 2 +-
drivers/gpu/drm/i915/intel_fbdev.c | 4 ++--
4 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_object.h b/drivers/gpu/drm/i915/i915_gem_object.h
index 5b19a49..95cfb64 100644
--- a/drivers/gpu/drm/i915/i915_gem_object.h
+++ b/drivers/gpu/drm/i915/i915_gem_object.h
@@ -257,7 +257,7 @@ __attribute__((nonnull))
static inline struct drm_i915_gem_object *
i915_gem_object_get(struct drm_i915_gem_object *obj)
{
- drm_gem_object_reference(&obj->base);
+ drm_gem_object_get(&obj->base);
return obj;
}

@@ -268,7 +268,7 @@ __attribute__((nonnull))
static inline void
i915_gem_object_put(struct drm_i915_gem_object *obj)
{
- __drm_gem_object_unreference(&obj->base);
+ __drm_gem_object_put(&obj->base);
}

__deprecated
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index beff138..f9142ff 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -2832,7 +2832,7 @@ intel_find_initial_plane_obj(struct intel_crtc *intel_crtc,

if (intel_plane_ggtt_offset(state) == plane_config->base) {
fb = c->primary->fb;
- drm_framebuffer_reference(fb);
+ drm_framebuffer_get(fb);
goto valid_fb;
}
}
@@ -2863,7 +2863,7 @@ intel_find_initial_plane_obj(struct intel_crtc *intel_crtc,
intel_crtc->pipe, PTR_ERR(intel_state->vma));

intel_state->vma = NULL;
- drm_framebuffer_unreference(fb);
+ drm_framebuffer_put(fb);
return;
}

@@ -2884,7 +2884,7 @@ intel_find_initial_plane_obj(struct intel_crtc *intel_crtc,
if (i915_gem_object_is_tiled(obj))
dev_priv->preserve_bios_swizzle = true;

- drm_framebuffer_reference(fb);
+ drm_framebuffer_get(fb);
primary->fb = primary->state->fb = fb;
primary->crtc = primary->state->crtc = &intel_crtc->base;

@@ -9811,7 +9811,7 @@ mode_fits_in_fbdev(struct drm_device *dev,
if (obj->base.size < mode->vdisplay * fb->pitches[0])
return NULL;

- drm_framebuffer_reference(fb);
+ drm_framebuffer_get(fb);
return fb;
#else
return NULL;
@@ -9992,7 +9992,7 @@ int intel_get_load_detect_pipe(struct drm_connector *connector,
if (ret)
goto fail;

- drm_framebuffer_unreference(fb);
+ drm_framebuffer_put(fb);

ret = drm_atomic_set_mode_for_crtc(&crtc_state->base, mode);
if (ret)
@@ -10542,7 +10542,7 @@ static void intel_modeset_update_connector_atomic_state(struct drm_device *dev)
drm_connector_list_iter_begin(dev, &conn_iter);
for_each_intel_connector_iter(connector, &conn_iter) {
if (connector->base.state->crtc)
- drm_connector_unreference(&connector->base);
+ drm_connector_put(&connector->base);

if (connector->base.encoder) {
connector->base.state->best_encoder =
@@ -10550,7 +10550,7 @@ static void intel_modeset_update_connector_atomic_state(struct drm_device *dev)
connector->base.state->crtc =
connector->base.encoder->crtc;

- drm_connector_reference(&connector->base);
+ drm_connector_get(&connector->base);
} else {
connector->base.state->best_encoder = NULL;
connector->base.state->crtc = NULL;
diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c b/drivers/gpu/drm/i915/intel_dp_mst.c
index 93fc8ab..2092ab1 100644
--- a/drivers/gpu/drm/i915/intel_dp_mst.c
+++ b/drivers/gpu/drm/i915/intel_dp_mst.c
@@ -504,7 +504,7 @@ static void intel_dp_destroy_mst_connector(struct drm_dp_mst_topology_mgr *mgr,
intel_connector->mst_port = NULL;
drm_modeset_unlock(&connector->dev->mode_config.connection_mutex);

- drm_connector_unreference(connector);
+ drm_connector_put(connector);
DRM_DEBUG_KMS("\n");
}

diff --git a/drivers/gpu/drm/i915/intel_fbdev.c b/drivers/gpu/drm/i915/intel_fbdev.c
index 262e75c..e34334a 100644
--- a/drivers/gpu/drm/i915/intel_fbdev.c
+++ b/drivers/gpu/drm/i915/intel_fbdev.c
@@ -189,7 +189,7 @@ static int intelfb_create(struct drm_fb_helper *helper,
" releasing it\n",
intel_fb->base.width, intel_fb->base.height,
sizes->fb_width, sizes->fb_height);
- drm_framebuffer_unreference(&intel_fb->base);
+ drm_framebuffer_put(&intel_fb->base);
intel_fb = ifbdev->fb = NULL;
}
if (!intel_fb || WARN_ON(!intel_fb->obj)) {
@@ -624,7 +624,7 @@ static bool intel_fbdev_init_bios(struct drm_device *dev,
ifbdev->preferred_bpp = fb->base.format->cpp[0] * 8;
ifbdev->fb = fb;

- drm_framebuffer_reference(&ifbdev->fb->base);
+ drm_framebuffer_get(&ifbdev->fb->base);

/* Final pass to check if any active pipes don't have fbs */
for_each_crtc(dev, crtc) {
--
2.7.4

2017-08-14 08:58:32

by Daniel Vetter

[permalink] [raw]
Subject: Re: [PATCH v3 28/28] drm: vboxvideo: switch to drm_*_get(), drm_*_put() helpers

On Fri, Aug 11, 2017 at 06:11:08PM +0200, Hans de Goede wrote:
> Hi,
>
> On 11-08-17 18:04, Sean Paul wrote:
> > On Fri, Aug 11, 2017 at 03:26:45PM +0200, Hans de Goede wrote:
> > > Hi,
> > >
> > > On 11-08-17 14:33, 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 <[email protected]>
> > >
> > > Thank you for doing this, looks good to me:
> > >
> > > Reviewed-by: Hans de Goede <[email protected]>
> > >
> >
> > Applied to drm-misc-next, thank you for the review!
>
> Erm vboxvideo is in staging, does this mean all patches for
> it will now go through drm-misc-next despite it being in
> staging (*) ? Because if some patches get merged through
> drm-misc-next and some through Greg's staging repo that
> is not going to end well.

-staging doesn't work for drm. And yes this patch needs to go in through
drm-misc I think (I don't want to be at Greg's mercy for merging cleanups,
same way we don't wait for driver maintainers if they don't merge the
patch in a timely fashion).

I'd say if no one is actually working on vbox cleanup (i.e. porting to
atomic) we'll throw it out next cycle again.
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

2017-08-14 12:23:15

by Hans de Goede

[permalink] [raw]
Subject: Re: [PATCH v3 28/28] drm: vboxvideo: switch to drm_*_get(), drm_*_put() helpers

Hi,

On 14-08-17 10:58, Daniel Vetter wrote:
> On Fri, Aug 11, 2017 at 06:11:08PM +0200, Hans de Goede wrote:
>> Hi,
>>
>> On 11-08-17 18:04, Sean Paul wrote:
>>> On Fri, Aug 11, 2017 at 03:26:45PM +0200, Hans de Goede wrote:
>>>> Hi,
>>>>
>>>> On 11-08-17 14:33, 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 <[email protected]>
>>>>
>>>> Thank you for doing this, looks good to me:
>>>>
>>>> Reviewed-by: Hans de Goede <[email protected]>
>>>>
>>>
>>> Applied to drm-misc-next, thank you for the review!
>>
>> Erm vboxvideo is in staging, does this mean all patches for
>> it will now go through drm-misc-next despite it being in
>> staging (*) ? Because if some patches get merged through
>> drm-misc-next and some through Greg's staging repo that
>> is not going to end well.
>
> -staging doesn't work for drm. And yes this patch needs to go in through
> drm-misc I think (I don't want to be at Greg's mercy for merging cleanups,
> same way we don't wait for driver maintainers if they don't merge the
> patch in a timely fashion).
>
> I'd say if no one is actually working on vbox cleanup (i.e. porting to
> atomic) we'll throw it out next cycle again.

Michael Thayer from vbox upstream has said repeatedly that he is
preparing a patch-set to move vboxvideo over to the atomic APIs).

ATM I'm focusing on the other 2 vbox-guest drivers (but that is almost
done) so if Michael does not follow through on this then I will take
care of this.

Either way please don't remove the driver, we do plan to clean it up
and having it ping pong into, out of and back into the mainline kernel
is really not helpful.

Regards,

Hans

2017-08-14 19:53:16

by Eric Anholt

[permalink] [raw]
Subject: Re: [PATCH v3 24/28] drm/vc4: switch to drm_*_get(), drm_*_put() helpers

Cihangir Akturk <[email protected]> writes:

> 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.

Mind if I change the subject line to "drm/vc4: Continue the switch to
drm_*_put() helpers"? to distinguish from the patch that already landed?

(Looks like your previous patch was generated before my BO labeling code
landed, so we got another little patch here cleaning up the new code as
well)


Attachments:
signature.asc (832.00 B)

2017-08-14 20:07:53

by Cihangir Akturk

[permalink] [raw]
Subject: Re: [PATCH v3 24/28] drm/vc4: switch to drm_*_get(), drm_*_put() helpers

On Mon, Aug 14, 2017 at 12:47:01PM -0700, Eric Anholt wrote:
> Cihangir Akturk <[email protected]> writes:
>
> > 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.
>
> Mind if I change the subject line to "drm/vc4: Continue the switch to
> drm_*_put() helpers"? to distinguish from the patch that already landed?

It's OK with me. Go ahead, change to whatever you want.

>
> (Looks like your previous patch was generated before my BO labeling code
> landed, so we got another little patch here cleaning up the new code as
> well)

Thanks, Cihangir.

2017-08-14 21:17:44

by Eric Anholt

[permalink] [raw]
Subject: Re: [PATCH v3 24/28] drm/vc4: switch to drm_*_get(), drm_*_put() helpers

Cihangir Akturk <[email protected]> writes:

> On Mon, Aug 14, 2017 at 12:47:01PM -0700, Eric Anholt wrote:
>> Cihangir Akturk <[email protected]> writes:
>>
>> > 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.
>>
>> Mind if I change the subject line to "drm/vc4: Continue the switch to
>> drm_*_put() helpers"? to distinguish from the patch that already landed?
>
> It's OK with me. Go ahead, change to whatever you want.

Changed and pushed. Thanks!


Attachments:
signature.asc (832.00 B)

2017-08-17 09:13:20

by Russell King (Oracle)

[permalink] [raw]
Subject: Re: [PATCH v3 03/28] drm/armada: switch to drm_*_get(), drm_*_put() helpers

On Fri, Aug 11, 2017 at 03:32:49PM +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.

This looks trivial - provided drm-misc has no conflicts, I'm happy for
it to be applied there. Thanks.

Acked-by: Russell King <[email protected]>

>
> Generated by: scripts/coccinelle/api/drm-get-put.cocci
>
> Signed-off-by: Cihangir Akturk <[email protected]>
> ---
> drivers/gpu/drm/armada/armada_crtc.c | 22 +++++++++++-----------
> drivers/gpu/drm/armada/armada_drv.c | 2 +-
> drivers/gpu/drm/armada/armada_fb.c | 8 ++++----
> drivers/gpu/drm/armada/armada_fbdev.c | 6 +++---
> drivers/gpu/drm/armada/armada_gem.c | 14 +++++++-------
> drivers/gpu/drm/armada/armada_overlay.c | 4 ++--
> 6 files changed, 28 insertions(+), 28 deletions(-)
>
> diff --git a/drivers/gpu/drm/armada/armada_crtc.c b/drivers/gpu/drm/armada/armada_crtc.c
> index 2a4d163..2e065fa 100644
> --- a/drivers/gpu/drm/armada/armada_crtc.c
> +++ b/drivers/gpu/drm/armada/armada_crtc.c
> @@ -298,7 +298,7 @@ static void armada_drm_crtc_finish_fb(struct armada_crtc *dcrtc,
>
> if (force) {
> /* Display is disabled, so just drop the old fb */
> - drm_framebuffer_unreference(fb);
> + drm_framebuffer_put(fb);
> return;
> }
>
> @@ -321,7 +321,7 @@ static void armada_drm_crtc_finish_fb(struct armada_crtc *dcrtc,
> * the best. The worst that will happen is the buffer gets
> * reused before it has finished being displayed.
> */
> - drm_framebuffer_unreference(fb);
> + drm_framebuffer_put(fb);
> }
>
> static void armada_drm_vblank_off(struct armada_crtc *dcrtc)
> @@ -577,7 +577,7 @@ static int armada_drm_crtc_mode_set(struct drm_crtc *crtc,
> unsigned i;
> bool interlaced;
>
> - drm_framebuffer_reference(crtc->primary->fb);
> + drm_framebuffer_get(crtc->primary->fb);
>
> interlaced = !!(adj->flags & DRM_MODE_FLAG_INTERLACE);
>
> @@ -718,7 +718,7 @@ static int armada_drm_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,
> MAX_SCHEDULE_TIMEOUT);
>
> /* Take a reference to the new fb as we're using it */
> - drm_framebuffer_reference(crtc->primary->fb);
> + drm_framebuffer_get(crtc->primary->fb);
>
> /* Update the base in the CRTC */
> armada_drm_crtc_update_regs(dcrtc, regs);
> @@ -742,7 +742,7 @@ void armada_drm_crtc_plane_disable(struct armada_crtc *dcrtc,
> * primary plane.
> */
> if (plane->fb)
> - drm_framebuffer_unreference(plane->fb);
> + drm_framebuffer_put(plane->fb);
>
> /* Power down the Y/U/V FIFOs */
> sram_para1 = CFG_PDWN16x66 | CFG_PDWN32x66;
> @@ -947,13 +947,13 @@ static int armada_drm_crtc_cursor_set(struct drm_crtc *crtc,
>
> /* Must be a kernel-mapped object */
> if (!obj->addr) {
> - drm_gem_object_unreference_unlocked(&obj->obj);
> + drm_gem_object_put_unlocked(&obj->obj);
> return -EINVAL;
> }
>
> if (obj->obj.size < w * h * 4) {
> DRM_ERROR("buffer is too small\n");
> - drm_gem_object_unreference_unlocked(&obj->obj);
> + drm_gem_object_put_unlocked(&obj->obj);
> return -ENOMEM;
> }
> }
> @@ -961,7 +961,7 @@ static int armada_drm_crtc_cursor_set(struct drm_crtc *crtc,
> if (dcrtc->cursor_obj) {
> dcrtc->cursor_obj->update = NULL;
> dcrtc->cursor_obj->update_data = NULL;
> - drm_gem_object_unreference_unlocked(&dcrtc->cursor_obj->obj);
> + drm_gem_object_put_unlocked(&dcrtc->cursor_obj->obj);
> }
> dcrtc->cursor_obj = obj;
> dcrtc->cursor_w = w;
> @@ -997,7 +997,7 @@ static void armada_drm_crtc_destroy(struct drm_crtc *crtc)
> struct armada_private *priv = crtc->dev->dev_private;
>
> if (dcrtc->cursor_obj)
> - drm_gem_object_unreference_unlocked(&dcrtc->cursor_obj->obj);
> + drm_gem_object_put_unlocked(&dcrtc->cursor_obj->obj);
>
> priv->dcrtc[dcrtc->num] = NULL;
> drm_crtc_cleanup(&dcrtc->crtc);
> @@ -1045,12 +1045,12 @@ static int armada_drm_crtc_page_flip(struct drm_crtc *crtc,
> * Ensure that we hold a reference on the new framebuffer.
> * This has to match the behaviour in mode_set.
> */
> - drm_framebuffer_reference(fb);
> + drm_framebuffer_get(fb);
>
> ret = armada_drm_crtc_queue_frame_work(dcrtc, work);
> if (ret) {
> /* Undo our reference above */
> - drm_framebuffer_unreference(fb);
> + drm_framebuffer_put(fb);
> kfree(work);
> return ret;
> }
> diff --git a/drivers/gpu/drm/armada/armada_drv.c b/drivers/gpu/drm/armada/armada_drv.c
> index 0b3227c..c993bcc 100644
> --- a/drivers/gpu/drm/armada/armada_drv.c
> +++ b/drivers/gpu/drm/armada/armada_drv.c
> @@ -26,7 +26,7 @@ static void armada_drm_unref_work(struct work_struct *work)
> struct drm_framebuffer *fb;
>
> while (kfifo_get(&priv->fb_unref, &fb))
> - drm_framebuffer_unreference(fb);
> + drm_framebuffer_put(fb);
> }
>
> /* Must be called with dev->event_lock held */
> diff --git a/drivers/gpu/drm/armada/armada_fb.c b/drivers/gpu/drm/armada/armada_fb.c
> index 92e6b08..51839c1 100644
> --- a/drivers/gpu/drm/armada/armada_fb.c
> +++ b/drivers/gpu/drm/armada/armada_fb.c
> @@ -18,7 +18,7 @@ static void armada_fb_destroy(struct drm_framebuffer *fb)
> struct armada_framebuffer *dfb = drm_fb_to_armada_fb(fb);
>
> drm_framebuffer_cleanup(&dfb->fb);
> - drm_gem_object_unreference_unlocked(&dfb->obj->obj);
> + drm_gem_object_put_unlocked(&dfb->obj->obj);
> kfree(dfb);
> }
>
> @@ -95,7 +95,7 @@ struct armada_framebuffer *armada_framebuffer_create(struct drm_device *dev,
> * the above call, but the caller will drop their reference
> * to it. Hence we need to take our own reference.
> */
> - drm_gem_object_reference(&obj->obj);
> + drm_gem_object_get(&obj->obj);
>
> return dfb;
> }
> @@ -144,12 +144,12 @@ static struct drm_framebuffer *armada_fb_create(struct drm_device *dev,
> goto err;
> }
>
> - drm_gem_object_unreference_unlocked(&obj->obj);
> + drm_gem_object_put_unlocked(&obj->obj);
>
> return &dfb->fb;
>
> err_unref:
> - drm_gem_object_unreference_unlocked(&obj->obj);
> + drm_gem_object_put_unlocked(&obj->obj);
> err:
> DRM_ERROR("failed to initialize framebuffer: %d\n", ret);
> return ERR_PTR(ret);
> diff --git a/drivers/gpu/drm/armada/armada_fbdev.c b/drivers/gpu/drm/armada/armada_fbdev.c
> index 29c7d04..cf6bad1 100644
> --- a/drivers/gpu/drm/armada/armada_fbdev.c
> +++ b/drivers/gpu/drm/armada/armada_fbdev.c
> @@ -52,13 +52,13 @@ static int armada_fb_create(struct drm_fb_helper *fbh,
>
> ret = armada_gem_linear_back(dev, obj);
> if (ret) {
> - drm_gem_object_unreference_unlocked(&obj->obj);
> + drm_gem_object_put_unlocked(&obj->obj);
> return ret;
> }
>
> ptr = armada_gem_map_object(dev, obj);
> if (!ptr) {
> - drm_gem_object_unreference_unlocked(&obj->obj);
> + drm_gem_object_put_unlocked(&obj->obj);
> return -ENOMEM;
> }
>
> @@ -68,7 +68,7 @@ static int armada_fb_create(struct drm_fb_helper *fbh,
> * A reference is now held by the framebuffer object if
> * successful, otherwise this drops the ref for the error path.
> */
> - drm_gem_object_unreference_unlocked(&obj->obj);
> + drm_gem_object_put_unlocked(&obj->obj);
>
> if (IS_ERR(dfb))
> return PTR_ERR(dfb);
> diff --git a/drivers/gpu/drm/armada/armada_gem.c b/drivers/gpu/drm/armada/armada_gem.c
> index a76ca21..49d40aa 100644
> --- a/drivers/gpu/drm/armada/armada_gem.c
> +++ b/drivers/gpu/drm/armada/armada_gem.c
> @@ -266,7 +266,7 @@ int armada_gem_dumb_create(struct drm_file *file, struct drm_device *dev,
> /* drop reference from allocate - handle holds it now */
> DRM_DEBUG_DRIVER("obj %p size %zu handle %#x\n", dobj, size, handle);
> err:
> - drm_gem_object_unreference_unlocked(&dobj->obj);
> + drm_gem_object_put_unlocked(&dobj->obj);
> return ret;
> }
>
> @@ -295,7 +295,7 @@ int armada_gem_dumb_map_offset(struct drm_file *file, struct drm_device *dev,
> }
>
> err_unref:
> - drm_gem_object_unreference_unlocked(&obj->obj);
> + drm_gem_object_put_unlocked(&obj->obj);
>
> return ret;
> }
> @@ -334,7 +334,7 @@ int armada_gem_create_ioctl(struct drm_device *dev, void *data,
> /* drop reference from allocate - handle holds it now */
> DRM_DEBUG_DRIVER("obj %p size %zu handle %#x\n", dobj, size, handle);
> err:
> - drm_gem_object_unreference_unlocked(&dobj->obj);
> + drm_gem_object_put_unlocked(&dobj->obj);
> return ret;
> }
>
> @@ -351,13 +351,13 @@ int armada_gem_mmap_ioctl(struct drm_device *dev, void *data,
> return -ENOENT;
>
> if (!dobj->obj.filp) {
> - drm_gem_object_unreference_unlocked(&dobj->obj);
> + drm_gem_object_put_unlocked(&dobj->obj);
> return -EINVAL;
> }
>
> addr = vm_mmap(dobj->obj.filp, 0, args->size, PROT_READ | PROT_WRITE,
> MAP_SHARED, args->offset);
> - drm_gem_object_unreference_unlocked(&dobj->obj);
> + drm_gem_object_put_unlocked(&dobj->obj);
> if (IS_ERR_VALUE(addr))
> return addr;
>
> @@ -412,7 +412,7 @@ int armada_gem_pwrite_ioctl(struct drm_device *dev, void *data,
> }
>
> unref:
> - drm_gem_object_unreference_unlocked(&dobj->obj);
> + drm_gem_object_put_unlocked(&dobj->obj);
> return ret;
> }
>
> @@ -561,7 +561,7 @@ armada_gem_prime_import(struct drm_device *dev, struct dma_buf *buf)
> * Importing our own dmabuf(s) increases the
> * refcount on the gem object itself.
> */
> - drm_gem_object_reference(obj);
> + drm_gem_object_get(obj);
> return obj;
> }
> }
> diff --git a/drivers/gpu/drm/armada/armada_overlay.c b/drivers/gpu/drm/armada/armada_overlay.c
> index edc4491..b411b60 100644
> --- a/drivers/gpu/drm/armada/armada_overlay.c
> +++ b/drivers/gpu/drm/armada/armada_overlay.c
> @@ -177,7 +177,7 @@ armada_ovl_plane_update(struct drm_plane *plane, struct drm_crtc *crtc,
> * Take a reference on the new framebuffer - we want to
> * hold on to it while the hardware is displaying it.
> */
> - drm_framebuffer_reference(fb);
> + drm_framebuffer_get(fb);
>
> if (plane->fb)
> armada_ovl_retire_fb(dplane, plane->fb);
> @@ -278,7 +278,7 @@ static int armada_ovl_plane_disable(struct drm_plane *plane,
>
> fb = xchg(&dplane->old_fb, NULL);
> if (fb)
> - drm_framebuffer_unreference(fb);
> + drm_framebuffer_put(fb);
>
> return 0;
> }
> --
> 2.7.4
>

--
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 8.8Mbps down 630kbps up
According to speedtest.net: 8.21Mbps down 510kbps up

2017-08-17 15:33:40

by Thierry Reding

[permalink] [raw]
Subject: Re: [PATCH v3 21/28] drm/tegra: switch to drm_*_get(), drm_*_put() helpers

On Fri, Aug 11, 2017 at 03:33:07PM +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 <[email protected]>
> ---
> drivers/gpu/drm/tegra/drm.c | 12 ++++++------
> drivers/gpu/drm/tegra/fb.c | 8 ++++----
> drivers/gpu/drm/tegra/gem.c | 10 +++++-----
> 3 files changed, 15 insertions(+), 15 deletions(-)

Applied, thanks.

Thierry


Attachments:
(No filename) (744.00 B)
signature.asc (833.00 B)
Download all attachments