diff mbox series

[RFC,07/19] drm/msm: Use drm_attach_bridge() to attach a bridge to an encoder

Message ID 20190808151150.16336-8-boris.brezillon@collabora.com (mailing list archive)
State New, archived
Headers show
Series drm: Add support for bus-format negotiation | expand

Commit Message

Boris Brezillon Aug. 8, 2019, 3:11 p.m. UTC
This is part of our attempt to make the bridge chain a double-linked
list based on the generic list helpers. In order to do that, we must
patch all drivers manipulating the encoder->bridge field directly.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
---
 drivers/gpu/drm/msm/edp/edp.c   | 4 +++-
 drivers/gpu/drm/msm/hdmi/hdmi.c | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

Comments

Sam Ravnborg Aug. 19, 2019, 5:19 p.m. UTC | #1
On Thu, Aug 08, 2019 at 05:11:38PM +0200, Boris Brezillon wrote:
> This is part of our attempt to make the bridge chain a double-linked
> list based on the generic list helpers. In order to do that, we must
> patch all drivers manipulating the encoder->bridge field directly.
> 
> Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>

Sean, this patch looks like a nice cleanup we can apply
outside the series.
It would be good that drivers do not poke direct in
the encoder data that this patch fixes.

	Sam

> ---
>  drivers/gpu/drm/msm/edp/edp.c   | 4 +++-
>  drivers/gpu/drm/msm/hdmi/hdmi.c | 4 +++-
>  2 files changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/edp/edp.c b/drivers/gpu/drm/msm/edp/edp.c
> index 0f312ac5b624..ad4e963ccd9b 100644
> --- a/drivers/gpu/drm/msm/edp/edp.c
> +++ b/drivers/gpu/drm/msm/edp/edp.c
> @@ -178,7 +178,9 @@ int msm_edp_modeset_init(struct msm_edp *edp, struct drm_device *dev,
>  		goto fail;
>  	}
>  
> -	encoder->bridge = edp->bridge;
> +	ret = drm_bridge_attach(encoder, edp->bridge, NULL);
> +	if (ret)
> +		goto fail;
>  
>  	priv->bridges[priv->num_bridges++]       = edp->bridge;
>  	priv->connectors[priv->num_connectors++] = edp->connector;
> diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.c b/drivers/gpu/drm/msm/hdmi/hdmi.c
> index 0e4217be3f00..55b9a8c8312b 100644
> --- a/drivers/gpu/drm/msm/hdmi/hdmi.c
> +++ b/drivers/gpu/drm/msm/hdmi/hdmi.c
> @@ -327,7 +327,9 @@ int msm_hdmi_modeset_init(struct hdmi *hdmi,
>  		goto fail;
>  	}
>  
> -	encoder->bridge = hdmi->bridge;
> +	ret = drm_bridge_attach(encoder, hdmi->bridge, NULL);
> +	if (ret)
> +		goto fail;
>  
>  	priv->bridges[priv->num_bridges++]       = hdmi->bridge;
>  	priv->connectors[priv->num_connectors++] = hdmi->connector;
> -- 
> 2.21.0
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
Laurent Pinchart Aug. 21, 2019, 2:46 p.m. UTC | #2
On Mon, Aug 19, 2019 at 07:19:39PM +0200, Sam Ravnborg wrote:
> On Thu, Aug 08, 2019 at 05:11:38PM +0200, Boris Brezillon wrote:
> > This is part of our attempt to make the bridge chain a double-linked
> > list based on the generic list helpers. In order to do that, we must
> > patch all drivers manipulating the encoder->bridge field directly.
> > 
> > Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
> Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
> 
> Sean, this patch looks like a nice cleanup we can apply
> outside the series.
> It would be good that drivers do not poke direct in
> the encoder data that this patch fixes.

Agreed, and

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> > ---
> >  drivers/gpu/drm/msm/edp/edp.c   | 4 +++-
> >  drivers/gpu/drm/msm/hdmi/hdmi.c | 4 +++-
> >  2 files changed, 6 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/msm/edp/edp.c b/drivers/gpu/drm/msm/edp/edp.c
> > index 0f312ac5b624..ad4e963ccd9b 100644
> > --- a/drivers/gpu/drm/msm/edp/edp.c
> > +++ b/drivers/gpu/drm/msm/edp/edp.c
> > @@ -178,7 +178,9 @@ int msm_edp_modeset_init(struct msm_edp *edp, struct drm_device *dev,
> >  		goto fail;
> >  	}
> >  
> > -	encoder->bridge = edp->bridge;
> > +	ret = drm_bridge_attach(encoder, edp->bridge, NULL);
> > +	if (ret)
> > +		goto fail;
> >  
> >  	priv->bridges[priv->num_bridges++]       = edp->bridge;
> >  	priv->connectors[priv->num_connectors++] = edp->connector;
> > diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.c b/drivers/gpu/drm/msm/hdmi/hdmi.c
> > index 0e4217be3f00..55b9a8c8312b 100644
> > --- a/drivers/gpu/drm/msm/hdmi/hdmi.c
> > +++ b/drivers/gpu/drm/msm/hdmi/hdmi.c
> > @@ -327,7 +327,9 @@ int msm_hdmi_modeset_init(struct hdmi *hdmi,
> >  		goto fail;
> >  	}
> >  
> > -	encoder->bridge = hdmi->bridge;
> > +	ret = drm_bridge_attach(encoder, hdmi->bridge, NULL);
> > +	if (ret)
> > +		goto fail;
> >  
> >  	priv->bridges[priv->num_bridges++]       = hdmi->bridge;
> >  	priv->connectors[priv->num_connectors++] = hdmi->connector;
diff mbox series

Patch

diff --git a/drivers/gpu/drm/msm/edp/edp.c b/drivers/gpu/drm/msm/edp/edp.c
index 0f312ac5b624..ad4e963ccd9b 100644
--- a/drivers/gpu/drm/msm/edp/edp.c
+++ b/drivers/gpu/drm/msm/edp/edp.c
@@ -178,7 +178,9 @@  int msm_edp_modeset_init(struct msm_edp *edp, struct drm_device *dev,
 		goto fail;
 	}
 
-	encoder->bridge = edp->bridge;
+	ret = drm_bridge_attach(encoder, edp->bridge, NULL);
+	if (ret)
+		goto fail;
 
 	priv->bridges[priv->num_bridges++]       = edp->bridge;
 	priv->connectors[priv->num_connectors++] = edp->connector;
diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.c b/drivers/gpu/drm/msm/hdmi/hdmi.c
index 0e4217be3f00..55b9a8c8312b 100644
--- a/drivers/gpu/drm/msm/hdmi/hdmi.c
+++ b/drivers/gpu/drm/msm/hdmi/hdmi.c
@@ -327,7 +327,9 @@  int msm_hdmi_modeset_init(struct hdmi *hdmi,
 		goto fail;
 	}
 
-	encoder->bridge = hdmi->bridge;
+	ret = drm_bridge_attach(encoder, hdmi->bridge, NULL);
+	if (ret)
+		goto fail;
 
 	priv->bridges[priv->num_bridges++]       = hdmi->bridge;
 	priv->connectors[priv->num_connectors++] = hdmi->connector;