[PATCH 5/9] drm/msm: Don't track connectors in msm private struct
Sean Paul
sean at poorly.run
Wed Dec 5 16:29:37 UTC 2018
From: Sean Paul <seanpaul at chromium.org>
drm core already tracks this, so we can just lean on that instead of
tracking ourselves.
Signed-off-by: Sean Paul <seanpaul at chromium.org>
---
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 10 ++++++----
drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c | 3 ---
drivers/gpu/drm/msm/dsi/dsi.c | 2 --
drivers/gpu/drm/msm/edp/edp.c | 3 ---
drivers/gpu/drm/msm/hdmi/hdmi.c | 3 ---
drivers/gpu/drm/msm/msm_drv.h | 3 ---
drivers/gpu/drm/msm/msm_fbdev.c | 2 +-
7 files changed, 7 insertions(+), 19 deletions(-)
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
index 8dede6cb9b7d7..4f2fcdfe2644e 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
@@ -498,7 +498,8 @@ static void _dpu_kms_drm_obj_destroy(struct dpu_kms *dpu_kms)
struct drm_crtc *crtc;
struct drm_plane *plane;
struct drm_encoder *encoder;
- int i;
+ struct drm_connector_list_iter conn_iter;
+ struct drm_connector *connector;
if (!dpu_kms) {
DPU_ERROR("invalid dpu_kms\n");
@@ -518,9 +519,10 @@ static void _dpu_kms_drm_obj_destroy(struct dpu_kms *dpu_kms)
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]);
- priv->num_connectors = 0;
+ drm_connector_list_iter_begin(dpu_kms->dev, &conn_iter);
+ drm_for_each_connector_iter(connector, &conn_iter)
+ connector->funcs->destroy(connector);
+ drm_connector_list_iter_end(&conn_iter);
drm_for_each_encoder(encoder, dpu_kms->dev)
encoder->funcs->destroy(encoder);
diff --git a/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c b/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c
index 40e2b462a03e1..e86134fed2244 100644
--- a/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c
+++ b/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c
@@ -265,9 +265,6 @@ static int mdp4_modeset_init_intf(struct mdp4_kms *mdp4_kms,
DRM_DEV_ERROR(dev->dev, "failed to initialize LVDS connector\n");
return PTR_ERR(connector);
}
-
- priv->connectors[priv->num_connectors++] = connector;
-
break;
case DRM_MODE_ENCODER_TMDS:
encoder = mdp4_dtv_encoder_init(dev);
diff --git a/drivers/gpu/drm/msm/dsi/dsi.c b/drivers/gpu/drm/msm/dsi/dsi.c
index 97b906a9b3945..e1d990f316732 100644
--- a/drivers/gpu/drm/msm/dsi/dsi.c
+++ b/drivers/gpu/drm/msm/dsi/dsi.c
@@ -250,8 +250,6 @@ int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct drm_device *dev,
goto fail;
}
- priv->connectors[priv->num_connectors++] = msm_dsi->connector;
-
return 0;
fail:
/* bridge/connector are normally destroyed by drm: */
diff --git a/drivers/gpu/drm/msm/edp/edp.c b/drivers/gpu/drm/msm/edp/edp.c
index 694c2d43011f6..10adf89d5d469 100644
--- a/drivers/gpu/drm/msm/edp/edp.c
+++ b/drivers/gpu/drm/msm/edp/edp.c
@@ -148,7 +148,6 @@ int msm_edp_modeset_init(struct msm_edp *edp, struct drm_device *dev,
struct drm_encoder *encoder)
{
struct platform_device *pdev = edp->pdev;
- struct msm_drm_private *priv = dev->dev_private;
int ret;
edp->encoder = encoder;
@@ -188,8 +187,6 @@ int msm_edp_modeset_init(struct msm_edp *edp, struct drm_device *dev,
encoder->bridge = edp->bridge;
- priv->connectors[priv->num_connectors++] = edp->connector;
-
return 0;
fail:
diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.c b/drivers/gpu/drm/msm/hdmi/hdmi.c
index 1901ae820ef0b..ce564331e6080 100644
--- a/drivers/gpu/drm/msm/hdmi/hdmi.c
+++ b/drivers/gpu/drm/msm/hdmi/hdmi.c
@@ -291,7 +291,6 @@ static struct hdmi *msm_hdmi_init(struct platform_device *pdev)
int msm_hdmi_modeset_init(struct hdmi *hdmi,
struct drm_device *dev, struct drm_encoder *encoder)
{
- struct msm_drm_private *priv = dev->dev_private;
struct platform_device *pdev = hdmi->pdev;
int ret;
@@ -340,8 +339,6 @@ int msm_hdmi_modeset_init(struct hdmi *hdmi,
encoder->bridge = hdmi->bridge;
- priv->connectors[priv->num_connectors++] = hdmi->connector;
-
platform_set_drvdata(pdev, hdmi);
return 0;
diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h
index 6cd61199d20a0..6c013addce68c 100644
--- a/drivers/gpu/drm/msm/msm_drv.h
+++ b/drivers/gpu/drm/msm/msm_drv.h
@@ -194,9 +194,6 @@ struct msm_drm_private {
struct msm_drm_thread disp_thread[MAX_CRTCS];
struct msm_drm_thread event_thread[MAX_CRTCS];
- unsigned int num_connectors;
- struct drm_connector *connectors[MAX_CONNECTORS];
-
/* Properties */
struct drm_property *plane_property[PLANE_PROP_MAX_NUM];
diff --git a/drivers/gpu/drm/msm/msm_fbdev.c b/drivers/gpu/drm/msm/msm_fbdev.c
index c03e860ba737f..a62ef39d65f25 100644
--- a/drivers/gpu/drm/msm/msm_fbdev.c
+++ b/drivers/gpu/drm/msm/msm_fbdev.c
@@ -174,7 +174,7 @@ struct drm_fb_helper *msm_fbdev_init(struct drm_device *dev)
drm_fb_helper_prepare(dev, helper, &msm_fb_helper_funcs);
- ret = drm_fb_helper_init(dev, helper, priv->num_connectors);
+ ret = drm_fb_helper_init(dev, helper, dev->mode_config.num_connector);
if (ret) {
DRM_DEV_ERROR(dev->dev, "could not init fbdev: ret=%d\n", ret);
goto fail;
--
Sean Paul, Software Engineer, Google / Chromium OS
More information about the dri-devel
mailing list