summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/vc4/vc4_dsi.c
diff options
context:
space:
mode:
authorMaxime Ripard <maxime@cerno.tech>2022-07-11 19:39:03 +0200
committerMaxime Ripard <maxime@cerno.tech>2022-07-13 10:46:09 +0200
commit6f0ca506c30e2b2c8d3b86fe33989c5257aaa34b (patch)
treeac4957dffede0758315e8e8f32c53781b5122423 /drivers/gpu/drm/vc4/vc4_dsi.c
parent73b68b28a9e819e600ca2d0640721ae61bdaf55a (diff)
downloadlinux-6f0ca506c30e2b2c8d3b86fe33989c5257aaa34b.tar.bz2
drm/vc4: dsi: Switch to DRM-managed encoder initialization
The current code will call drm_encoder_cleanup() when the device is unbound. However, by then, there might still be some references held to that encoder, including by the userspace that might still have the DRM device open. Let's switch to a DRM-managed initialization to clean up after ourselves only once the DRM device has been last closed. Acked-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com> Signed-off-by: Maxime Ripard <maxime@cerno.tech> Link: https://lore.kernel.org/r/20220711173939.1132294-34-maxime@cerno.tech
Diffstat (limited to 'drivers/gpu/drm/vc4/vc4_dsi.c')
-rw-r--r--drivers/gpu/drm/vc4/vc4_dsi.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/gpu/drm/vc4/vc4_dsi.c b/drivers/gpu/drm/vc4/vc4_dsi.c
index 72889524540e..1a55b7ea52a8 100644
--- a/drivers/gpu/drm/vc4/vc4_dsi.c
+++ b/drivers/gpu/drm/vc4/vc4_dsi.c
@@ -1687,7 +1687,13 @@ static int vc4_dsi_bind(struct device *dev, struct device *master, void *data)
if (ret)
return ret;
- drm_simple_encoder_init(drm, encoder, DRM_MODE_ENCODER_DSI);
+ ret = drmm_encoder_init(drm, encoder,
+ NULL,
+ DRM_MODE_ENCODER_DSI,
+ NULL);
+ if (ret)
+ return ret;
+
drm_encoder_helper_add(encoder, &vc4_dsi_encoder_helper_funcs);
ret = drm_bridge_attach(encoder, dsi->bridge, NULL, 0);
@@ -1720,7 +1726,6 @@ static void vc4_dsi_unbind(struct device *dev, struct device *master,
* normally.
*/
list_splice_init(&dsi->bridge_chain, &encoder->bridge_chain);
- drm_encoder_cleanup(encoder);
}
static const struct component_ops vc4_dsi_ops = {