drm/imx: don't destroy mode objects manually on driver unbind
authorLucas Stach <l.stach@pengutronix.de>
Thu, 11 Aug 2016 09:18:49 +0000 (11:18 +0200)
committerPhilipp Zabel <p.zabel@pengutronix.de>
Mon, 29 Aug 2016 10:45:05 +0000 (12:45 +0200)
Instead let drm_mode_config_cleanup() do the work when taking down
the master device. This requires all cleanup functions to be
properly hooked up to the mode object .destroy callback.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
drivers/gpu/drm/bridge/dw-hdmi.c
drivers/gpu/drm/imx/imx-drm-core.c
drivers/gpu/drm/imx/imx-ldb.c
drivers/gpu/drm/imx/imx-tve.c
drivers/gpu/drm/imx/ipuv3-crtc.c
drivers/gpu/drm/imx/parallel-display.c

index 77ab47341658a2e109b323ee9393fc5456bdda12..56f3d86a4be68389a716de2c342f5d8b0ba202ad 100644 (file)
@@ -1812,9 +1812,6 @@ void dw_hdmi_unbind(struct device *dev, struct device *master, void *data)
        /* Disable all interrupts */
        hdmi_writeb(hdmi, ~0, HDMI_IH_MUTE_PHY_STAT0);
 
-       hdmi->connector.funcs->destroy(&hdmi->connector);
-       hdmi->encoder->funcs->destroy(hdmi->encoder);
-
        clk_disable_unprepare(hdmi->iahb_clk);
        clk_disable_unprepare(hdmi->isfr_clk);
        i2c_put_adapter(hdmi->ddc);
index 7a1ddf8b04cff86978658316c90a4c00e8e3487c..3cc8e4ad639b17ca3d7d32c69da938c9ba14a29f 100644 (file)
@@ -469,11 +469,11 @@ static void imx_drm_unbind(struct device *dev)
        if (imxdrm->fbhelper)
                drm_fbdev_cma_fini(imxdrm->fbhelper);
 
+       drm_mode_config_cleanup(drm);
+
        component_unbind_all(drm->dev, drm);
        dev_set_drvdata(dev, NULL);
 
-       drm_mode_config_cleanup(drm);
-
        drm_dev_unref(drm);
 }
 
index 4eed3a6addadf6f028055f98f47c1684f07c7cb4..87b83bd787169cb15cbaf1c37ef598b93d107955 100644 (file)
@@ -757,12 +757,6 @@ static void imx_ldb_unbind(struct device *dev, struct device *master,
        for (i = 0; i < 2; i++) {
                struct imx_ldb_channel *channel = &imx_ldb->channel[i];
 
-               if (!channel->connector.funcs)
-                       continue;
-
-               channel->connector.funcs->destroy(&channel->connector);
-               channel->encoder.funcs->destroy(&channel->encoder);
-
                kfree(channel->edid);
                i2c_put_adapter(channel->ddc);
        }
index 5e875944ffa214f48f06d7ed8b687aabd1705ffb..8fc088843e553c2def5353e74bdd47171824478e 100644 (file)
@@ -685,9 +685,6 @@ static void imx_tve_unbind(struct device *dev, struct device *master,
 {
        struct imx_tve *tve = dev_get_drvdata(dev);
 
-       tve->connector.funcs->destroy(&tve->connector);
-       tve->encoder.funcs->destroy(&tve->encoder);
-
        if (!IS_ERR(tve->dac_reg))
                regulator_disable(tve->dac_reg);
 }
index c3d5933cb6635d7cb47c2391637cf35b69143892..9df29f1cb16af029a7bcbdd93a56562be464a2ef 100644 (file)
@@ -124,9 +124,14 @@ static void imx_drm_crtc_destroy_state(struct drm_crtc *crtc,
        kfree(to_imx_crtc_state(state));
 }
 
+static void imx_drm_crtc_destroy(struct drm_crtc *crtc)
+{
+       imx_drm_remove_crtc(to_ipu_crtc(crtc)->imx_crtc);
+}
+
 static const struct drm_crtc_funcs ipu_crtc_funcs = {
        .set_config = drm_atomic_helper_set_config,
-       .destroy = drm_crtc_cleanup,
+       .destroy = imx_drm_crtc_destroy,
        .page_flip = drm_atomic_helper_page_flip,
        .reset = imx_drm_crtc_reset,
        .atomic_duplicate_state = imx_drm_crtc_duplicate_state,
@@ -413,8 +418,6 @@ static void ipu_drm_unbind(struct device *dev, struct device *master,
 {
        struct ipu_crtc *ipu_crtc = dev_get_drvdata(dev);
 
-       imx_drm_remove_crtc(ipu_crtc->imx_crtc);
-
        ipu_put_resources(ipu_crtc);
        if (ipu_crtc->plane[1])
                ipu_plane_put_resources(ipu_crtc->plane[1]);
index 74b0ac06fdab57fcd69218e9c45be3f7d88276e0..f2033379072837c6fa77f5b0c0e991b20ef0ef84 100644 (file)
@@ -293,9 +293,6 @@ static void imx_pd_unbind(struct device *dev, struct device *master,
 {
        struct imx_parallel_display *imxpd = dev_get_drvdata(dev);
 
-       imxpd->encoder.funcs->destroy(&imxpd->encoder);
-       imxpd->connector.funcs->destroy(&imxpd->connector);
-
        kfree(imxpd->edid);
 }