Blob Blame History Raw
From 106ed79e4fa86f45b4691de7e9bdfd65ed0622a6 Mon Sep 17 00:00:00 2001
From: owen <qwt9588@gmail.com>
Date: Mon, 17 Jan 2022 18:09:49 +0800
Subject: drm/bridge: anx7625: Return -EPROBE_DEFER if the dsi host was not
 found
Git-commit: 269332997a160b3785690a32d2c5496bce7dae51
Patch-mainline: v5.18-rc1
References: jsc#PED-1166 jsc#PED-1168 jsc#PED-1170 jsc#PED-1218 jsc#PED-1220 jsc#PED-1222 jsc#PED-1223 jsc#PED-1225

It will connect to the mipi dsi host and find the corresponding
mipi dsi host node, but the node registered by the mipi dsi host
has not been loaded yet. of_find_mipi_dsi_host_by_node() returns -EINVAL
which causes the calling driver to fail.

If the anx7625 driver is loaded afterwards the driver requesting
the mipi dsi host will not notice this.

Better approach is to return -EPROBE_DEFER in such case.
Then when the anx7625 driver appears the driver requesting
the mipi dsi host will be probed again.

Signed-off-by: owen <qwt9588@gmail.com>
Signed-off-by: Robert Foss <robert.foss@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20220117100949.9542-1-qwt9588@gamil.com
Reviewed-by: Robert Foss <robert.foss@linaro.org>
Acked-by: Patrik Jakobsson <pjakobsson@suse.de>
---
 drivers/gpu/drm/bridge/analogix/anx7625.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/bridge/analogix/anx7625.c
index 0528c3c6168d..76662fce4ce6 100644
--- a/drivers/gpu/drm/bridge/analogix/anx7625.c
+++ b/drivers/gpu/drm/bridge/analogix/anx7625.c
@@ -1917,7 +1917,7 @@ static int anx7625_attach_dsi(struct anx7625_data *ctx)
 	host = of_find_mipi_dsi_host_by_node(ctx->pdata.mipi_host_node);
 	if (!host) {
 		DRM_DEV_ERROR(dev, "fail to find dsi host.\n");
-		return -EINVAL;
+		return -EPROBE_DEFER;
 	}
 
 	dsi = devm_mipi_dsi_device_register_full(dev, host, &info);
-- 
2.38.1