[PATCH 2/7] drm: Replace drm_framebuffer_{un/reference} with drm_framebuffer_{put, get}

Thomas Zimmermann tdz at users.sourceforge.net
Sat Jun 9 13:18:00 UTC 2018


This patch unifies the naming of DRM functions for reference counting
of struct drm_framebuffer. The resulting code is more aligned with the
rest of the Linux kernel interfaces.

The patch also deletes the old functions and removes them from the
Coccinelle script.

Signed-off-by: Thomas Zimmermann <tdz at users.sourceforge.net>
---
 drivers/gpu/drm/armada/armada_crtc.c       |  8 ++++----
 drivers/gpu/drm/armada/armada_overlay.c    |  2 +-
 drivers/gpu/drm/exynos/exynos_drm_plane.c  |  2 +-
 drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c |  4 ++--
 drivers/gpu/drm/nouveau/nouveau_fbcon.c    |  2 +-
 include/drm/drm_framebuffer.h              | 24 ------------------------
 scripts/coccinelle/api/drm-get-put.cocci   | 10 ----------
 7 files changed, 9 insertions(+), 43 deletions(-)

diff --git a/drivers/gpu/drm/armada/armada_crtc.c b/drivers/gpu/drm/armada/armada_crtc.c
index 03eeee11dd5b..38724b554a54 100644
--- a/drivers/gpu/drm/armada/armada_crtc.c
+++ b/drivers/gpu/drm/armada/armada_crtc.c
@@ -1220,7 +1220,7 @@ static int armada_drm_primary_update(struct drm_plane *plane,
 		 * 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);
 
 		work->old_fb = plane->fb;
 	} else {
@@ -1239,7 +1239,7 @@ static int armada_drm_primary_update(struct drm_plane *plane,
 	if (!dplane->state.vsync_update) {
 		work->fn(dcrtc, work);
 		if (work->old_fb)
-			drm_framebuffer_unreference(work->old_fb);
+			drm_framebuffer_put(work->old_fb);
 		return 0;
 	}
 
@@ -1248,7 +1248,7 @@ static int armada_drm_primary_update(struct drm_plane *plane,
 	if (ret) {
 		work->fn(dcrtc, work);
 		if (work->old_fb)
-			drm_framebuffer_unreference(work->old_fb);
+			drm_framebuffer_put(work->old_fb);
 	}
 
 	dplane->next_work = !dplane->next_work;
@@ -1308,7 +1308,7 @@ int armada_drm_plane_disable(struct drm_plane *plane,
 	if (armada_drm_plane_work_queue(dcrtc, work)) {
 		work->fn(dcrtc, work);
 		if (work->old_fb)
-			drm_framebuffer_unreference(work->old_fb);
+			drm_framebuffer_put(work->old_fb);
 	}
 
 	dplane->next_work = !dplane->next_work;
diff --git a/drivers/gpu/drm/armada/armada_overlay.c b/drivers/gpu/drm/armada/armada_overlay.c
index c391955009d6..bb2874d84d74 100644
--- a/drivers/gpu/drm/armada/armada_overlay.c
+++ b/drivers/gpu/drm/armada/armada_overlay.c
@@ -228,7 +228,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);
 
 		work->old_fb = plane->fb;
 	} else {
diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.c b/drivers/gpu/drm/exynos/exynos_drm_plane.c
index 38a2a7f1204b..7098c6d35266 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;
 	}
diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c
index 36aa1738b67a..96af796abc05 100644
--- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c
+++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c
@@ -185,7 +185,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);
@@ -228,7 +228,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/nouveau/nouveau_fbcon.c b/drivers/gpu/drm/nouveau/nouveau_fbcon.c
index 85c1f10bc2b6..844498c4267c 100644
--- a/drivers/gpu/drm/nouveau/nouveau_fbcon.c
+++ b/drivers/gpu/drm/nouveau/nouveau_fbcon.c
@@ -429,7 +429,7 @@ nouveau_fbcon_destroy(struct drm_device *dev, struct nouveau_fbdev *fbcon)
 		nouveau_vma_del(&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/include/drm/drm_framebuffer.h b/include/drm/drm_framebuffer.h
index c50502c656e5..c94acedfb08e 100644
--- a/include/drm/drm_framebuffer.h
+++ b/include/drm/drm_framebuffer.h
@@ -240,30 +240,6 @@ static inline void drm_framebuffer_put(struct drm_framebuffer *fb)
 	drm_mode_object_put(&fb->base);
 }
 
-/**
- * drm_framebuffer_reference - acquire a framebuffer reference
- * @fb: DRM framebuffer
- *
- * This is a compatibility alias for drm_framebuffer_get() and should not be
- * used by new code.
- */
-static inline void drm_framebuffer_reference(struct drm_framebuffer *fb)
-{
-	drm_framebuffer_get(fb);
-}
-
-/**
- * drm_framebuffer_unreference - release a framebuffer reference
- * @fb: DRM framebuffer
- *
- * This is a compatibility alias for drm_framebuffer_put() and should not be
- * used by new code.
- */
-static inline void drm_framebuffer_unreference(struct drm_framebuffer *fb)
-{
-	drm_framebuffer_put(fb);
-}
-
 /**
  * drm_framebuffer_read_refcount - read the framebuffer reference count.
  * @fb: framebuffer
diff --git a/scripts/coccinelle/api/drm-get-put.cocci b/scripts/coccinelle/api/drm-get-put.cocci
index 1b1c5344b07f..1bfebbe9c4ff 100644
--- a/scripts/coccinelle/api/drm-get-put.cocci
+++ b/scripts/coccinelle/api/drm-get-put.cocci
@@ -16,12 +16,6 @@ expression object;
 @@
 
 (
-- drm_framebuffer_reference(object)
-+ drm_framebuffer_get(object)
-|
-- drm_framebuffer_unreference(object)
-+ drm_framebuffer_put(object)
-|
 - drm_gem_object_reference(object)
 + drm_gem_object_get(object)
 |
@@ -44,10 +38,6 @@ position p;
 @@
 
 (
-drm_framebuffer_unreference at p(object)
-|
-drm_framebuffer_reference at p(object)
-|
 drm_gem_object_unreference at p(object)
 |
 drm_gem_object_reference at p(object)
-- 
2.14.4



More information about the dri-devel mailing list