Commit 8e3b16e2 authored by Lucas Stach's avatar Lucas Stach Committed by Philipp Zabel

drm/imx: don't destroy mode objects manually on driver unbind

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: default avatarLucas Stach <l.stach@pengutronix.de>
Signed-off-by: default avatarPhilipp Zabel <p.zabel@pengutronix.de>
parent 54db5dec
...@@ -1812,9 +1812,6 @@ void dw_hdmi_unbind(struct device *dev, struct device *master, void *data) ...@@ -1812,9 +1812,6 @@ void dw_hdmi_unbind(struct device *dev, struct device *master, void *data)
/* Disable all interrupts */ /* Disable all interrupts */
hdmi_writeb(hdmi, ~0, HDMI_IH_MUTE_PHY_STAT0); 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->iahb_clk);
clk_disable_unprepare(hdmi->isfr_clk); clk_disable_unprepare(hdmi->isfr_clk);
i2c_put_adapter(hdmi->ddc); i2c_put_adapter(hdmi->ddc);
......
...@@ -469,11 +469,11 @@ static void imx_drm_unbind(struct device *dev) ...@@ -469,11 +469,11 @@ static void imx_drm_unbind(struct device *dev)
if (imxdrm->fbhelper) if (imxdrm->fbhelper)
drm_fbdev_cma_fini(imxdrm->fbhelper); drm_fbdev_cma_fini(imxdrm->fbhelper);
drm_mode_config_cleanup(drm);
component_unbind_all(drm->dev, drm); component_unbind_all(drm->dev, drm);
dev_set_drvdata(dev, NULL); dev_set_drvdata(dev, NULL);
drm_mode_config_cleanup(drm);
drm_dev_unref(drm); drm_dev_unref(drm);
} }
......
...@@ -757,12 +757,6 @@ static void imx_ldb_unbind(struct device *dev, struct device *master, ...@@ -757,12 +757,6 @@ static void imx_ldb_unbind(struct device *dev, struct device *master,
for (i = 0; i < 2; i++) { for (i = 0; i < 2; i++) {
struct imx_ldb_channel *channel = &imx_ldb->channel[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); kfree(channel->edid);
i2c_put_adapter(channel->ddc); i2c_put_adapter(channel->ddc);
} }
......
...@@ -685,9 +685,6 @@ static void imx_tve_unbind(struct device *dev, struct device *master, ...@@ -685,9 +685,6 @@ static void imx_tve_unbind(struct device *dev, struct device *master,
{ {
struct imx_tve *tve = dev_get_drvdata(dev); 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)) if (!IS_ERR(tve->dac_reg))
regulator_disable(tve->dac_reg); regulator_disable(tve->dac_reg);
} }
......
...@@ -124,9 +124,14 @@ static void imx_drm_crtc_destroy_state(struct drm_crtc *crtc, ...@@ -124,9 +124,14 @@ static void imx_drm_crtc_destroy_state(struct drm_crtc *crtc,
kfree(to_imx_crtc_state(state)); 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 = { static const struct drm_crtc_funcs ipu_crtc_funcs = {
.set_config = drm_atomic_helper_set_config, .set_config = drm_atomic_helper_set_config,
.destroy = drm_crtc_cleanup, .destroy = imx_drm_crtc_destroy,
.page_flip = drm_atomic_helper_page_flip, .page_flip = drm_atomic_helper_page_flip,
.reset = imx_drm_crtc_reset, .reset = imx_drm_crtc_reset,
.atomic_duplicate_state = imx_drm_crtc_duplicate_state, .atomic_duplicate_state = imx_drm_crtc_duplicate_state,
...@@ -413,8 +418,6 @@ static void ipu_drm_unbind(struct device *dev, struct device *master, ...@@ -413,8 +418,6 @@ static void ipu_drm_unbind(struct device *dev, struct device *master,
{ {
struct ipu_crtc *ipu_crtc = dev_get_drvdata(dev); struct ipu_crtc *ipu_crtc = dev_get_drvdata(dev);
imx_drm_remove_crtc(ipu_crtc->imx_crtc);
ipu_put_resources(ipu_crtc); ipu_put_resources(ipu_crtc);
if (ipu_crtc->plane[1]) if (ipu_crtc->plane[1])
ipu_plane_put_resources(ipu_crtc->plane[1]); ipu_plane_put_resources(ipu_crtc->plane[1]);
......
...@@ -293,9 +293,6 @@ static void imx_pd_unbind(struct device *dev, struct device *master, ...@@ -293,9 +293,6 @@ static void imx_pd_unbind(struct device *dev, struct device *master,
{ {
struct imx_parallel_display *imxpd = dev_get_drvdata(dev); struct imx_parallel_display *imxpd = dev_get_drvdata(dev);
imxpd->encoder.funcs->destroy(&imxpd->encoder);
imxpd->connector.funcs->destroy(&imxpd->connector);
kfree(imxpd->edid); kfree(imxpd->edid);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment