drm/bridge: Silence error messages upon probe deferral
Subsystems (3)
PATCH 1/1 drm/bridge: Silence error messages upon probe deferral
When -EPROBE_DEFER is returned do not raise an error, but silently return
this error instead. Fixes error like this:
[drm:drm_bridge_attach] *ERROR* failed to attach bridge /soc@0/bus@30800000/mipi-dsi@30a00000 to encoder None-34: -517 [drm:drm_bridge_attach] *ERROR* failed to attach bridge /soc@0/bus@30800000/mipi-dsi@30a00000 to encoder None-34: -517
---dev_err_probe() would be the best, but I am not sure if this function is always used within a driver's probe() call.
drivers/gpu/drm/drm_bridge.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/drm_bridge.c +2 -0
@@ -350,6 +350,7 @@ int drm_bridge_attach(struct drm_encoder *encoder, struct drm_bridge *bridge, bridge->encoder =NULL ;list_del (&bridge->chain_node); +if (ret != -EPROBE_DEFER ) {#ifdef CONFIG_OF DRM_ERROR ("failed to attach bridge %pOF to encoder %s: %d\n" , bridge->of_node, encoder->name, ret);
@@ -357,6 +358,7 @@ int drm_bridge_attach(struct drm_encoder *encoder, struct drm_bridge *bridge,DRM_ERROR ("failed to attach bridge to encoder %s: %d\n" , encoder->name, ret);#endif + }return ret; }
Signature · 1 line
2.34.1
Laurent Pinchart
reviewerHi Alexander,
Thank you for the patch.
Quoted 18 lines · Alexander Stein
When -EPROBE_DEFER is returned do not raise an error, but silently return
this error instead. Fixes error like this:
[drm:drm_bridge_attach] *ERROR* failed to attach bridge /soc@0/bus@30800000/mipi-dsi@30a00000 to encoder None-34: -517 [drm:drm_bridge_attach] *ERROR* failed to attach bridge /soc@0/bus@30800000/mipi-dsi@30a00000 to encoder None-34: -517Signed-off-by Alexander Stein <[email protected]>---
dev_err_probe()would be the best, but I am not sure if this function is always used within a driver'sprobe()call.drivers/gpu/drm/drm_bridge.c | 2 ++ 1 file changed, 2 insertions(+)drivers/gpu/drm/drm_bridge.c +0
-0
drivers/gpu/drm/drm_bridge.c int drm_bridge_attach(struct drm_encoder *encoder, struct drm_bridge *bridge, · line 356
Quoted 7 lines
drivers/gpu/drm/drm_bridge.c +1
-0@@ -350,6 +350,7 @@ int drm_bridge_attach(struct drm_encoder *encoder, struct drm_bridge *bridge, bridge->encoder =NULL ;list_del (&bridge->chain_node); +if (ret != -EPROBE_DEFER ) {#ifdef CONFIG_OF DRM_ERROR ("failed to attach bridge %pOF to encoder %s: %d\n" , bridge->of_node, encoder->name, ret);
Wrong indentation.
dev_err_probe() could be useful, but this function is likely not called from probe paths only :-S
When not called from a probe path, dropping the message will result in a silent error, which would be hard to debug :-(
Quoted 8 lines
drivers/gpu/drm/drm_bridge.c +1
-0@@ -357,6 +358,7 @@ int drm_bridge_attach(struct drm_encoder *encoder, struct drm_bridge *bridge,DRM_ERROR ("failed to attach bridge to encoder %s: %d\n" , encoder->name, ret);#endif + }return ret; }
Signature · 3 lines
Regards, Laurent Pinchart
Hi Laurent,
Am Dienstag, 6. Juni 2023, 17:12:29 CEST schrieb Laurent Pinchart:
Quoted 31 lines
Hi Alexander,
Thank you for the patch.
Quoted 26 lines · Alexander Stein
When -EPROBE_DEFER is returned do not raise an error, but silently return this error instead. Fixes error like this:
[drm:drm_bridge_attach] *ERROR* failed to attach bridge /soc@0/bus@30800000/mipi-dsi@30a00000 to encoder None-34: -517 [drm:drm_bridge_attach] *ERROR* failed to attach bridge /soc@0/bus@30800000/mipi-dsi@30a00000 to encoder None-34: -517Signed-off-by Alexander Stein <[email protected]>---
dev_err_probe()would be the best, but I am not sure if this function is always used within a driver'sprobe()call.drivers/gpu/drm/drm_bridge.c | 2 ++ 1 file changed, 2 insertions(+)drivers/gpu/drm/drm_bridge.c +0
-0@@ -350,6 +350,7 @@ int drm_bridge_attach(struct drm_encoder *encoder,struct
drm_bridge*bridge,>drivers/gpu/drm/drm_bridge.c +1
-0bridge->encoder =NULL ;list_del (&bridge->chain_node); +if (ret != -EPROBE_DEFER ) {
Quoted 7 lines
drivers/gpu/drm/drm_bridge.c int drm_bridge_attach(struct drm_encoder *encoder, struct drm_bridge *bridge, · line 356
Quoted 5 lines
#ifdef
CONFIG_OFdrivers/gpu/drm/drm_bridge.c +0
-0DRM_ERROR ("failed to attach bridge %pOF to encoder %s: %d\n" , bridge->of_node, encoder->name, ret);Wrong indentation.
Ah, right. Thanks for pointing out.
Quoted 2 lines
dev_err_probe()could be useful, but this function is likely not called from probe paths only :-S
I was afraid this might be the cause. But I'm wondering in which situation this can be the case, hence -EPROBE_DEFER could be returned then.
Quoted 2 lines
When not called from a probe path, dropping the message will result in a silent error, which would be hard to debug :-(
On the other hand -EPROBE_DEFER is invalid on non-probe path also. Assuming dev_err_probe is used here, an error will still be raised, - EPROBE_DEFER should not occur then.
Best regards,
Alexander
Quoted 13 lines
Quoted 13 lines
drivers/gpu/drm/drm_bridge.c +0
-0@@ -357,6 +358,7 @@ int drm_bridge_attach(struct drm_encoder *encoder,struct
drm_bridge*bridge,>drivers/gpu/drm/drm_bridge.c +1
-0DRM_ERROR ("failed to attach bridge to encoder %s: %d\n" , encoder->name, ret);#endif + }return ret; }
Signature · 4 lines
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany Amtsgericht München, HRB 105018 Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider http://www.tq-group.com/
Laurent Pinchart
reviewerHi Alexander,
Quoted 36 lines · Alexander Stein
Am Dienstag, 6. Juni 2023, 17:12:29 CEST schrieb Laurent Pinchart:
Quoted 27 lines · Alexander Stein
Quoted 26 lines
When -EPROBE_DEFER is returned do not raise an error, but silently return this error instead. Fixes error like this:
[drm:drm_bridge_attach] *ERROR* failed to attach bridge /soc@0/bus@30800000/mipi-dsi@30a00000 to encoder None-34: -517 [drm:drm_bridge_attach] *ERROR* failed to attach bridge /soc@0/bus@30800000/mipi-dsi@30a00000 to encoder None-34: -517Signed-off-by Alexander Stein <[email protected]>---
dev_err_probe()would be the best, but I am not sure if this function is always used within a driver'sprobe()call.drivers/gpu/drm/drm_bridge.c | 2 ++ 1 file changed, 2 insertions(+)drivers/gpu/drm/drm_bridge.c +0
-0@@ -350,6 +350,7 @@ int drm_bridge_attach(struct drm_encoder *encoder,struct
drm_bridge*bridge,>drivers/gpu/drm/drm_bridge.c +1
-0bridge->encoder =NULL ;list_del (&bridge->chain_node); +if (ret != -EPROBE_DEFER ) {Quoted 7 lines
drivers/gpu/drm/drm_bridge.c int drm_bridge_attach(struct drm_encoder *encoder, struct drm_bridge *bridge, · line 356
Quoted 5 lines
#ifdef
CONFIG_OFdrivers/gpu/drm/drm_bridge.c +0
-0DRM_ERROR ("failed to attach bridge %pOF to encoder %s: %d\n" , bridge->of_node, encoder->name, ret);Wrong indentation.
Quoted 7 lines
Ah, right. Thanks for pointing out.
Quoted 2 lines
dev_err_probe()could be useful, but this function is likely not called from probe paths only :-SI was afraid this might be the cause. But I'm wondering in which situation this can be the case, hence -EPROBE_DEFER could be returned then.
I've had a quick look, and one example of a non-probe path is in mcde_modeset_init(), with the call to drm_simple_display_pipe_attach_bridge() which calls drm_bridge_attach(). mcde_modeset_init() is called from mcde_drm_bind(), the handler for the .bind() operation in component_master_ops.
I'd argue that we should really drop the component framework and replace it with something better, but that's beyond the scope of this patch :-)
Quoted 6 lines
Quoted 2 lines
When not called from a probe path, dropping the message will result in a silent error, which would be hard to debug :-(
On the other hand -EPROBE_DEFER is invalid on non-probe path also. Assuming
dev_err_probeis used here, an error will still be raised, -EPROBE_DEFERshould not occur then.
I agree that -EPROBE_DEFER shouldn't occur, and in many cases, it won't for drivers that use the component framework, as the whole purpose of the framework is to make sure the bridges are available before we try to attach to them. The framework (or at least the way it's used in drivers) however doesn't handle chains of components: the main DRM driver will have its next bridge available by the time it calls drm_bridge_attach(), but the bridge may then try to acquire the next bridge in the chain, and get an error that results in a probe deferral. Maybe that's not supposed to happen though, bridges probably should acquire the next bridge at probe time, but I can't guarantee this will always be done.
And this is my point: I'm scared that this patch will cause silent and hard to debug failures in some cases. Those cases may be incorrect usage of APIs by drivers, but making them silent will make it more difficult to fix them.
If everybody thinks I'm over-concerned, please feel free to move forward with this patch, and I'll do my best not to lose sleep :-)
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
drivers/gpu/drm/drm_bridge.c +0
-0@@ -357,6 +358,7 @@ int drm_bridge_attach(struct drm_encoder *encoder,struct
drm_bridge*bridge,>drivers/gpu/drm/drm_bridge.c +1
-0DRM_ERROR ("failed to attach bridge to encoder %s: %d\n" , encoder->name, ret);#endif + }return ret; }
Signature · 3 lines
Regards, Laurent Pinchart