[PATCH 04/17] drm/imx: parallel-display: detach panel within drm_encoder destroy

Marco Felsch m.felsch at pengutronix.de
Thu Feb 27 16:21:12 UTC 2020


There is no reason why this should be done within the
component.unbind() call so let the drm-core do the cleanup during a
drm_mode_config_cleanup() call.

Signed-off-by: Marco Felsch <m.felsch at pengutronix.de>
Reviewed-by: Philipp Zabel <p.zabel at pengutronix.de>
---
 drivers/gpu/drm/imx/parallel-display.c | 23 ++++++++++-------------
 1 file changed, 10 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/imx/parallel-display.c b/drivers/gpu/drm/imx/parallel-display.c
index 6ee028faa9a8..e731b19fd6b2 100644
--- a/drivers/gpu/drm/imx/parallel-display.c
+++ b/drivers/gpu/drm/imx/parallel-display.c
@@ -81,6 +81,15 @@ static int imx_pd_connector_get_modes(struct drm_connector *connector)
 	return num_modes;
 }
 
+static void imx_pd_encoder_destroy(struct drm_encoder *encoder)
+{
+	struct imx_parallel_display *imxpd = enc_to_imxpd(encoder);
+
+	if (imxpd->panel)
+		drm_panel_detach(imxpd->panel);
+	drm_encoder_cleanup(encoder);
+}
+
 static void imx_pd_encoder_enable(struct drm_encoder *encoder)
 {
 	struct imx_parallel_display *imxpd = enc_to_imxpd(encoder);
@@ -131,7 +140,7 @@ static const struct drm_connector_helper_funcs imx_pd_connector_helper_funcs = {
 };
 
 static const struct drm_encoder_funcs imx_pd_encoder_funcs = {
-	.destroy = imx_drm_encoder_destroy,
+	.destroy = imx_pd_encoder_destroy,
 };
 
 static const struct drm_encoder_helper_funcs imx_pd_encoder_helper_funcs = {
@@ -230,23 +239,11 @@ static int imx_pd_bind(struct device *dev, struct device *master, void *data)
 	if (ret)
 		return ret;
 
-	dev_set_drvdata(dev, imxpd);
-
 	return 0;
 }
 
-static void imx_pd_unbind(struct device *dev, struct device *master,
-	void *data)
-{
-	struct imx_parallel_display *imxpd = dev_get_drvdata(dev);
-
-	if (imxpd->panel)
-		drm_panel_detach(imxpd->panel);
-}
-
 static const struct component_ops imx_pd_ops = {
 	.bind	= imx_pd_bind,
-	.unbind	= imx_pd_unbind,
 };
 
 static int imx_pd_probe(struct platform_device *pdev)
-- 
2.20.1



More information about the dri-devel mailing list