Skip to contentSkip to conversation

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

PATCH Superseded Rob Clark 2 participants 2 messages Dec 7, 2021

Subsystems (5)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Rob Clark

author
#0 lore raw

PATCH v2 1/1 drm/bridge: sn65dsi86: defer if there is no dsi host

From: Rob Clark <[email protected]>

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")

---
v2: Drop DRM_ERROR() in favor of drm_err_probe() and shift around the
spot where we report the error

 drivers/gpu/drm/bridge/ti-sn65dsi86.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/bridge/ti-sn65dsi86.c +5 -5
index 02b490671f8f..8f1321ca819e 100644
@@ -714,10 +714,8 @@ 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)) {
@@ -1267,8 +1265,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");
 		goto err_remove_bridge;
+	}
 
 	return 0;
 
Signature · 1 line
2.33.1
reviewer
#1 lore raw

Hi,

Quoted 37 lines · Rob Clark

From: Rob Clark <[email protected]>

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")

---
v2: Drop DRM_ERROR() in favor of drm_err_probe() and shift around the
spot where we report the error

 drivers/gpu/drm/bridge/ti-sn65dsi86.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/bridge/ti-sn65dsi86.c +2 -4
index 02b490671f8f..8f1321ca819e 100644
@@ -714,10 +714,8 @@ 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)) {

drivers/gpu/drm/bridge/ti-sn65dsi86.c static int ti_sn_bridge_probe(struct auxiliary_device *adev, · line 1269

Quoted 6 lines
drivers/gpu/drm/bridge/ti-sn65dsi86.c +2 -1
@@ -1267,8 +1265,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");

nit: Needs a "\n" at the end, doesn't it?

drivers/gpu/drm/bridge/ti-sn65dsi86.c static int ti_sn_bridge_probe(struct auxiliary_device *adev, · line 1271

Quoted 2 lines
drivers/gpu/drm/bridge/ti-sn65dsi86.c +1 -0
                goto err_remove_bridge;
+       }

It's going to be a little funny now because if the devm_mipi_dsi_attach() call fails you'll report "failed to attach dsi host" twice (once using DRM_ERROR in ti_sn_attach_host() and once here). Probably all the error messages could be removed from ti_sn_attach_host() and you could rely on this new one because:
* devm_mipi_dsi_device_register_full() already appears plenty chatty.
* this is the same message that devm_mipi_dsi_attach() was printing out anyway.

In any case, it's not really a big deal, so with the "\n" added I'm happy with my Reviewed-by.

I'm happy to apply this to to drm-misc-next tomorrow if there are no objections. I can always add the "\n" myself unless you want to send a v3 with it and/or want to remove more error messages. ;-)

-Doug