linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3] drm/bridge: sn65dsi86: defer if there is no dsi host
@ 2021-12-07 21:57 Rob Clark
  2021-12-07 21:59 ` Doug Anderson
  2021-12-08  4:43 ` Stephen Boyd
  0 siblings, 2 replies; 4+ messages in thread
From: Rob Clark @ 2021-12-07 21:57 UTC (permalink / raw)
  To: dri-devel
  Cc: linux-arm-msm, Maxime Ripard, Douglas Anderson, Stephen Boyd,
	Jernej Škrabec, Rob Clark, Andrzej Hajda, Neil Armstrong,
	Robert Foss, Laurent Pinchart, Jonas Karlman, David Airlie,
	Daniel Vetter, Sam Ravnborg, open list

From: Rob Clark <robdclark@chromium.org>

Otherwise we don't get another shot at it if the bridge probes before
the dsi host is registered.  It seems like this is what *most* (but not
all) of the other bridges do.

It looks like this was missed in the conversion to attach dsi host at
probe time.

Fixes: c3b75d4734cb ("drm/bridge: sn65dsi86: Register and attach our DSI device at probe")
Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Doug Anderson <dianders@chromium.org>
---
v2: Drop DRM_ERROR() in favor of drm_err_probe() and shift around the
    spot where we report the error
v3: Add \n and cull error msgs a bit further

 drivers/gpu/drm/bridge/ti-sn65dsi86.c | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi86.c b/drivers/gpu/drm/bridge/ti-sn65dsi86.c
index 02b490671f8f..c2928a6409b1 100644
--- a/drivers/gpu/drm/bridge/ti-sn65dsi86.c
+++ b/drivers/gpu/drm/bridge/ti-sn65dsi86.c
@@ -714,16 +714,12 @@ static int ti_sn_attach_host(struct ti_sn65dsi86 *pdata)
 	};
 
 	host = of_find_mipi_dsi_host_by_node(pdata->host_node);
-	if (!host) {
-		DRM_ERROR("failed to find dsi host\n");
-		return -ENODEV;
-	}
+	if (!host)
+		return -EPROBE_DEFER;
 
 	dsi = devm_mipi_dsi_device_register_full(dev, host, &info);
-	if (IS_ERR(dsi)) {
-		DRM_ERROR("failed to create dsi device\n");
+	if (IS_ERR(dsi))
 		return PTR_ERR(dsi);
-	}
 
 	/* TODO: setting to 4 MIPI lanes always for now */
 	dsi->lanes = 4;
@@ -740,10 +736,8 @@ static int ti_sn_attach_host(struct ti_sn65dsi86 *pdata)
 	pdata->dsi = dsi;
 
 	ret = devm_mipi_dsi_attach(dev, dsi);
-	if (ret < 0) {
-		DRM_ERROR("failed to attach dsi to host\n");
+	if (ret < 0)
 		return ret;
-	}
 
 	return 0;
 }
@@ -1267,8 +1261,10 @@ static int ti_sn_bridge_probe(struct auxiliary_device *adev,
 	drm_bridge_add(&pdata->bridge);
 
 	ret = ti_sn_attach_host(pdata);
-	if (ret)
+	if (ret) {
+		dev_err_probe(pdata->dev, ret, "failed to attach dsi host\n");
 		goto err_remove_bridge;
+	}
 
 	return 0;
 
-- 
2.33.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v3] drm/bridge: sn65dsi86: defer if there is no dsi host
  2021-12-07 21:57 [PATCH v3] drm/bridge: sn65dsi86: defer if there is no dsi host Rob Clark
@ 2021-12-07 21:59 ` Doug Anderson
  2021-12-08  4:43 ` Stephen Boyd
  1 sibling, 0 replies; 4+ messages in thread
From: Doug Anderson @ 2021-12-07 21:59 UTC (permalink / raw)
  To: Rob Clark
  Cc: dri-devel, linux-arm-msm, Maxime Ripard, Stephen Boyd,
	Jernej Škrabec, Rob Clark, Andrzej Hajda, Neil Armstrong,
	Robert Foss, Laurent Pinchart, Jonas Karlman, David Airlie,
	Daniel Vetter, Sam Ravnborg, open list

Hi,

On Tue, Dec 7, 2021 at 1:52 PM Rob Clark <robdclark@gmail.com> wrote:
>
> From: Rob Clark <robdclark@chromium.org>
>
> Otherwise we don't get another shot at it if the bridge probes before
> the dsi host is registered.  It seems like this is what *most* (but not
> all) of the other bridges do.
>
> It looks like this was missed in the conversion to attach dsi host at
> probe time.
>
> Fixes: c3b75d4734cb ("drm/bridge: sn65dsi86: Register and attach our DSI device at probe")
> Signed-off-by: Rob Clark <robdclark@chromium.org>
> Reviewed-by: Doug Anderson <dianders@chromium.org>
> ---
> v2: Drop DRM_ERROR() in favor of drm_err_probe() and shift around the
>     spot where we report the error
> v3: Add \n and cull error msgs a bit further
>
>  drivers/gpu/drm/bridge/ti-sn65dsi86.c | 18 +++++++-----------
>  1 file changed, 7 insertions(+), 11 deletions(-)

I can add a further:

Tested-by: Doug Anderson <dianders@chromium.org>

Since it's pretty straightforward and I don't expect it to be
controversial, I'll plan to land it tomorrow in drm-misc-next unless I
hear otherwise.

-Doug

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v3] drm/bridge: sn65dsi86: defer if there is no dsi host
  2021-12-07 21:57 [PATCH v3] drm/bridge: sn65dsi86: defer if there is no dsi host Rob Clark
  2021-12-07 21:59 ` Doug Anderson
@ 2021-12-08  4:43 ` Stephen Boyd
  2021-12-08 16:53   ` Doug Anderson
  1 sibling, 1 reply; 4+ messages in thread
From: Stephen Boyd @ 2021-12-08  4:43 UTC (permalink / raw)
  To: Rob Clark, dri-devel
  Cc: linux-arm-msm, Maxime Ripard, Douglas Anderson,
	Jernej Škrabec, Rob Clark, Andrzej Hajda, Neil Armstrong,
	Robert Foss, Laurent Pinchart, Jonas Karlman, David Airlie,
	Daniel Vetter, Sam Ravnborg, linux-kernel

Quoting Rob Clark (2021-12-07 13:57:52)
> From: Rob Clark <robdclark@chromium.org>
>
> Otherwise we don't get another shot at it if the bridge probes before
> the dsi host is registered.  It seems like this is what *most* (but not
> all) of the other bridges do.
>
> It looks like this was missed in the conversion to attach dsi host at
> probe time.
>
> Fixes: c3b75d4734cb ("drm/bridge: sn65dsi86: Register and attach our DSI device at probe")
> Signed-off-by: Rob Clark <robdclark@chromium.org>
> Reviewed-by: Doug Anderson <dianders@chromium.org>
> ---

Reviewed-by: Stephen Boyd <swboyd@chromium.org>

One more nit below

> v2: Drop DRM_ERROR() in favor of drm_err_probe() and shift around the
>     spot where we report the error
> v3: Add \n and cull error msgs a bit further
>
>  drivers/gpu/drm/bridge/ti-sn65dsi86.c | 18 +++++++-----------
>  1 file changed, 7 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi86.c b/drivers/gpu/drm/bridge/ti-sn65dsi86.c
> index 02b490671f8f..c2928a6409b1 100644
> --- a/drivers/gpu/drm/bridge/ti-sn65dsi86.c
> +++ b/drivers/gpu/drm/bridge/ti-sn65dsi86.c
> @@ -740,10 +736,8 @@ static int ti_sn_attach_host(struct ti_sn65dsi86 *pdata)
>         pdata->dsi = dsi;
>
>         ret = devm_mipi_dsi_attach(dev, dsi);
> -       if (ret < 0) {
> -               DRM_ERROR("failed to attach dsi to host\n");
> +       if (ret < 0)
>                 return ret;
> -       }
>
>         return 0;

This can be simplified further to

	return devm_mipi_dsi_attach(dev, dsi);

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v3] drm/bridge: sn65dsi86: defer if there is no dsi host
  2021-12-08  4:43 ` Stephen Boyd
@ 2021-12-08 16:53   ` Doug Anderson
  0 siblings, 0 replies; 4+ messages in thread
From: Doug Anderson @ 2021-12-08 16:53 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Rob Clark, dri-devel, linux-arm-msm, Maxime Ripard,
	Jernej Škrabec, Rob Clark, Andrzej Hajda, Neil Armstrong,
	Robert Foss, Laurent Pinchart, Jonas Karlman, David Airlie,
	Daniel Vetter, Sam Ravnborg, linux-kernel

Hi,

On Tue, Dec 7, 2021 at 8:44 PM Stephen Boyd <swboyd@chromium.org> wrote:
>
> Quoting Rob Clark (2021-12-07 13:57:52)
> > From: Rob Clark <robdclark@chromium.org>
> >
> > Otherwise we don't get another shot at it if the bridge probes before
> > the dsi host is registered.  It seems like this is what *most* (but not
> > all) of the other bridges do.
> >
> > It looks like this was missed in the conversion to attach dsi host at
> > probe time.
> >
> > Fixes: c3b75d4734cb ("drm/bridge: sn65dsi86: Register and attach our DSI device at probe")
> > Signed-off-by: Rob Clark <robdclark@chromium.org>
> > Reviewed-by: Doug Anderson <dianders@chromium.org>
> > ---
>
> Reviewed-by: Stephen Boyd <swboyd@chromium.org>
>
> One more nit below
>
> > v2: Drop DRM_ERROR() in favor of drm_err_probe() and shift around the
> >     spot where we report the error
> > v3: Add \n and cull error msgs a bit further
> >
> >  drivers/gpu/drm/bridge/ti-sn65dsi86.c | 18 +++++++-----------
> >  1 file changed, 7 insertions(+), 11 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi86.c b/drivers/gpu/drm/bridge/ti-sn65dsi86.c
> > index 02b490671f8f..c2928a6409b1 100644
> > --- a/drivers/gpu/drm/bridge/ti-sn65dsi86.c
> > +++ b/drivers/gpu/drm/bridge/ti-sn65dsi86.c
> > @@ -740,10 +736,8 @@ static int ti_sn_attach_host(struct ti_sn65dsi86 *pdata)
> >         pdata->dsi = dsi;
> >
> >         ret = devm_mipi_dsi_attach(dev, dsi);
> > -       if (ret < 0) {
> > -               DRM_ERROR("failed to attach dsi to host\n");
> > +       if (ret < 0)
> >                 return ret;
> > -       }
> >
> >         return 0;
>
> This can be simplified further to
>
>         return devm_mipi_dsi_attach(dev, dsi);

Squahsed in Stephen's fix and pushed. Had to also remove "ret" which
was no longer used in this function after Stephen's change.

03848335b5b1 drm/bridge: sn65dsi86: defer if there is no dsi host

-Doug

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-12-08 16:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-07 21:57 [PATCH v3] drm/bridge: sn65dsi86: defer if there is no dsi host Rob Clark
2021-12-07 21:59 ` Doug Anderson
2021-12-08  4:43 ` Stephen Boyd
2021-12-08 16:53   ` Doug Anderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).