diff mbox series

[09/16] drm/exynos: call probe helper from bind

Message ID 20200903165717.1272492-10-m.tretter@pengutronix.de (mailing list archive)
State New, archived
Headers show
Series drm/exynos: Convert driver to drm bridge | expand

Commit Message

Michael Tretter Sept. 3, 2020, 4:57 p.m. UTC
The probe shall only register the driver at the component framework. The
actual probing happens when the driver is bound.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
---
 drivers/gpu/drm/exynos/exynos_drm_dsi.c | 27 +++++++++++++------------
 1 file changed, 14 insertions(+), 13 deletions(-)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
index 2e8142464b74..7485097472dc 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
@@ -1730,16 +1730,26 @@  static int exynos_dsi_parse_dt(struct exynos_dsi *dsi)
 	return 0;
 }
 
+static struct exynos_dsi *__exynos_dsi_probe(struct platform_device *pdev);
+static void __exynos_dsi_remove(struct exynos_dsi *dsi);
+
 static int exynos_dsi_bind(struct device *dev, struct device *master,
 				void *data)
 {
-	struct exynos_dsi *dsi = dev_get_drvdata(dev);
-	struct drm_encoder *encoder = &dsi->encoder;
+	struct platform_device *pdev = to_platform_device(dev);
+	struct exynos_dsi *dsi;
+	struct drm_encoder *encoder;
 	struct drm_device *drm_dev = data;
 	struct device_node *in_bridge_node;
 	struct drm_bridge *in_bridge;
 	int ret;
 
+	dsi = __exynos_dsi_probe(pdev);
+	if (IS_ERR(dsi))
+		return PTR_ERR(dsi);
+	platform_set_drvdata(pdev, dsi);
+
+	encoder = &dsi->encoder;
 	drm_simple_encoder_init(drm_dev, encoder, DRM_MODE_ENCODER_TMDS);
 
 	ret = exynos_drm_set_possible_crtcs(encoder, EXYNOS_DISPLAY_TYPE_LCD);
@@ -1768,6 +1778,8 @@  static void exynos_dsi_unbind(struct device *dev, struct device *master,
 
 	exynos_dsi_disable(dsi);
 
+	__exynos_dsi_remove(dsi);
+
 	mipi_dsi_host_unregister(&dsi->dsi_host);
 }
 
@@ -1885,22 +1897,11 @@  static void __exynos_dsi_remove(struct exynos_dsi *dsi)
 
 static int exynos_dsi_probe(struct platform_device *pdev)
 {
-	struct exynos_dsi *dsi;
-
-	dsi = __exynos_dsi_probe(pdev);
-	if (IS_ERR(dsi))
-		return PTR_ERR(dsi);
-	platform_set_drvdata(pdev, dsi);
-
 	return component_add(&pdev->dev, &exynos_dsi_component_ops);
 }
 
 static int exynos_dsi_remove(struct platform_device *pdev)
 {
-	struct exynos_dsi *dsi = platform_get_drvdata(pdev);
-
-	__exynos_dsi_remove(dsi);
-
 	component_del(&pdev->dev, &exynos_dsi_component_ops);
 
 	return 0;