diff mbox series

[4/9] drm/msm: Don't track planes in msm private struct

Message ID 20181205162958.25025-4-sean@poorly.run (mailing list archive)
State New, archived
Headers show
Series [1/9] drm/msm: Don't track crtcs in msm private struct | expand

Commit Message

Sean Paul Dec. 5, 2018, 4:29 p.m. UTC
From: Sean Paul <seanpaul@chromium.org>

drm core already tracks this, so we can just lean on that instead of
tracking ourselves.

Signed-off-by: Sean Paul <seanpaul@chromium.org>
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c  | 7 +++----
 drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c | 2 --
 drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 2 --
 drivers/gpu/drm/msm/msm_drv.h            | 3 ---
 4 files changed, 3 insertions(+), 11 deletions(-)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
index cbebc04e2d6ef..8dede6cb9b7d7 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
@@ -496,6 +496,7 @@  static void _dpu_kms_drm_obj_destroy(struct dpu_kms *dpu_kms)
 {
 	struct msm_drm_private *priv;
 	struct drm_crtc *crtc;
+	struct drm_plane *plane;
 	struct drm_encoder *encoder;
 	int i;
 
@@ -514,9 +515,8 @@  static void _dpu_kms_drm_obj_destroy(struct dpu_kms *dpu_kms)
 	drm_for_each_crtc(crtc, dpu_kms->dev)
 		crtc->funcs->destroy(crtc);
 
-	for (i = 0; i < priv->num_planes; i++)
-		priv->planes[i]->funcs->destroy(priv->planes[i]);
-	priv->num_planes = 0;
+	drm_for_each_plane(plane, dpu_kms->dev)
+		plane->funcs->destroy(plane);
 
 	for (i = 0; i < priv->num_connectors; i++)
 		priv->connectors[i]->funcs->destroy(priv->connectors[i]);
@@ -581,7 +581,6 @@  static int _dpu_kms_drm_obj_init(struct dpu_kms *dpu_kms)
 			ret = PTR_ERR(plane);
 			goto fail;
 		}
-		priv->planes[priv->num_planes++] = plane;
 
 		if (type == DRM_PLANE_TYPE_CURSOR)
 			cursor_planes[cursor_planes_idx++] = plane;
diff --git a/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c b/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c
index 527a4ee06819f..40e2b462a03e1 100644
--- a/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c
+++ b/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c
@@ -325,7 +325,6 @@  static int mdp4_modeset_init_intf(struct mdp4_kms *mdp4_kms,
 static int modeset_init(struct mdp4_kms *mdp4_kms)
 {
 	struct drm_device *dev = mdp4_kms->dev;
-	struct msm_drm_private *priv = dev->dev_private;
 	struct drm_plane *plane;
 	struct drm_crtc *crtc;
 	int i, ret;
@@ -356,7 +355,6 @@  static int modeset_init(struct mdp4_kms *mdp4_kms)
 			ret = PTR_ERR(plane);
 			goto fail;
 		}
-		priv->planes[priv->num_planes++] = plane;
 	}
 
 	for (i = 0; i < ARRAY_SIZE(mdp4_crtcs); i++) {
diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
index 7cf54737944e4..0a1fa40d375ce 100644
--- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
+++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
@@ -451,7 +451,6 @@  static int modeset_init_intf(struct mdp5_kms *mdp5_kms,
 static int modeset_init(struct mdp5_kms *mdp5_kms)
 {
 	struct drm_device *dev = mdp5_kms->dev;
-	struct msm_drm_private *priv = dev->dev_private;
 	struct drm_encoder *encoder;
 	const struct mdp5_cfg_hw *hw_cfg;
 	unsigned int num_crtcs;
@@ -502,7 +501,6 @@  static int modeset_init(struct mdp5_kms *mdp5_kms)
 			DRM_DEV_ERROR(dev->dev, "failed to construct plane %d (%d)\n", i, ret);
 			goto fail;
 		}
-		priv->planes[priv->num_planes++] = plane;
 
 		if (type == DRM_PLANE_TYPE_PRIMARY)
 			primary[pi++] = plane;
diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h
index 1902713ed84b0..6cd61199d20a0 100644
--- a/drivers/gpu/drm/msm/msm_drv.h
+++ b/drivers/gpu/drm/msm/msm_drv.h
@@ -191,9 +191,6 @@  struct msm_drm_private {
 
 	struct workqueue_struct *wq;
 
-	unsigned int num_planes;
-	struct drm_plane *planes[MAX_PLANES];
-
 	struct msm_drm_thread disp_thread[MAX_CRTCS];
 	struct msm_drm_thread event_thread[MAX_CRTCS];