Re: [PATCH 30/64] drm/vc4: dsi: Switch to DRM-managed encoder initialization

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 10 Jun 2022 at 10:30, Maxime Ripard <maxime@xxxxxxxxxx> wrote:
>
> 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.
>
> Signed-off-by: Maxime Ripard <maxime@xxxxxxxxxx>

Reviewed-by: Dave Stevenson <dave.stevenson@xxxxxxxxxxxxxxx>

> ---
>  drivers/gpu/drm/vc4/vc4_dsi.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/vc4/vc4_dsi.c b/drivers/gpu/drm/vc4/vc4_dsi.c
> index dbb3f6fb39b4..bcaf87b43cbd 100644
> --- a/drivers/gpu/drm/vc4/vc4_dsi.c
> +++ b/drivers/gpu/drm/vc4/vc4_dsi.c
> @@ -1599,7 +1599,10 @@ 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_simple_encoder_init(drm, encoder, DRM_MODE_ENCODER_DSI);
> +       if (ret)
> +               return ret;
> +
>         drm_encoder_helper_add(encoder, &vc4_dsi_encoder_helper_funcs);
>
>         ret = drm_bridge_attach(encoder, dsi->bridge, NULL, 0);
> @@ -1632,7 +1635,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 = {
> --
> 2.36.1
>



[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux