@@ -155,6 +155,16 @@ static int imx_ldb_connector_get_modes(struct drm_connector *connector)
return num_modes;
}
+static void imx_ldb_encoder_destroy(struct drm_encoder *encoder)
+{
+ struct imx_ldb_channel *channel = enc_to_imx_ldb_ch(encoder);
+
+ if (channel->panel)
+ drm_panel_detach(channel->panel);
+ drm_encoder_cleanup(encoder);
+ i2c_put_adapter(channel->ddc);
+}
+
static void imx_ldb_set_clock(struct imx_ldb *ldb, int mux, int chno,
unsigned long serial_clk, unsigned long di_clk)
{
@@ -385,7 +395,7 @@ static const struct drm_connector_helper_funcs imx_ldb_connector_helper_funcs =
};
static const struct drm_encoder_funcs imx_ldb_encoder_funcs = {
- .destroy = imx_drm_encoder_destroy,
+ .destroy = imx_ldb_encoder_destroy,
};
static const struct drm_encoder_helper_funcs imx_ldb_encoder_helper_funcs = {
@@ -699,25 +709,8 @@ static int imx_ldb_bind(struct device *dev, struct device *master, void *data)
return ret;
}
-static void imx_ldb_unbind(struct device *dev, struct device *master,
- void *data)
-{
- struct imx_ldb *imx_ldb = dev_get_drvdata(dev);
- int i;
-
- for (i = 0; i < 2; i++) {
- struct imx_ldb_channel *channel = &imx_ldb->channel[i];
-
- if (channel->panel)
- drm_panel_detach(channel->panel);
-
- i2c_put_adapter(channel->ddc);
- }
-}
-
static const struct component_ops imx_ldb_ops = {
.bind = imx_ldb_bind,
- .unbind = imx_ldb_unbind,
};
static int imx_ldb_probe(struct platform_device *pdev)
There is no reason why the resoruces should be freed manually within the component.unbind() call instead it is easier to use the drm-core destroy helper. The destroy helper gets called for each registered encoder during a drm_mode_config_cleanup() call. Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> --- drivers/gpu/drm/imx/imx-ldb.c | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-)