[PATCH 11/17] drm/imx: imx-ldb: release ldb-channel resources within encoder destroy
Marco Felsch
m.felsch at pengutronix.de
Thu Feb 27 16:21:19 UTC 2020
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 at pengutronix.de>
---
drivers/gpu/drm/imx/imx-ldb.c | 29 +++++++++++------------------
1 file changed, 11 insertions(+), 18 deletions(-)
diff --git a/drivers/gpu/drm/imx/imx-ldb.c b/drivers/gpu/drm/imx/imx-ldb.c
index 06b435f9b6c9..87bf659990da 100644
--- a/drivers/gpu/drm/imx/imx-ldb.c
+++ b/drivers/gpu/drm/imx/imx-ldb.c
@@ -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)
--
2.20.1
More information about the dri-devel
mailing list