diff mbox series

drm/mediatek: Don't print error if EDEFER_PROBE returned on component_add

Message ID 20240605-mtk-disp-rdma-dev-err-probe-v1-1-91259e1d3a93@collabora.com (mailing list archive)
State New, archived
Headers show
Series drm/mediatek: Don't print error if EDEFER_PROBE returned on component_add | expand

Commit Message

Nícolas F. R. A. Prado June 5, 2024, 4:50 p.m. UTC
Use dev_err_probe() in the component_add() error path to prevent
printing an error when the probe is deferred. This was observed on
mt8195 with the disp-rdma driver:

  mediatek-disp-rdma 1c002000.rdma: Failed to add component: -517

But the same pattern is used across many other drivers, so update them
all.

Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
---
 drivers/gpu/drm/mediatek/mtk_disp_aal.c         | 2 +-
 drivers/gpu/drm/mediatek/mtk_disp_ccorr.c       | 2 +-
 drivers/gpu/drm/mediatek/mtk_disp_color.c       | 2 +-
 drivers/gpu/drm/mediatek/mtk_disp_gamma.c       | 2 +-
 drivers/gpu/drm/mediatek/mtk_disp_merge.c       | 2 +-
 drivers/gpu/drm/mediatek/mtk_disp_ovl.c         | 2 +-
 drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c | 2 +-
 drivers/gpu/drm/mediatek/mtk_disp_rdma.c        | 2 +-
 drivers/gpu/drm/mediatek/mtk_ethdr.c            | 2 +-
 drivers/gpu/drm/mediatek/mtk_mdp_rdma.c         | 2 +-
 10 files changed, 10 insertions(+), 10 deletions(-)


---
base-commit: d97496ca23a2d4ee80b7302849404859d9058bcd
change-id: 20240605-mtk-disp-rdma-dev-err-probe-ef9c10a1a91e

Best regards,

Comments

AngeloGioacchino Del Regno June 6, 2024, 9:40 a.m. UTC | #1
Il 05/06/24 18:50, Nícolas F. R. A. Prado ha scritto:
> Use dev_err_probe() in the component_add() error path to prevent
> printing an error when the probe is deferred. This was observed on
> mt8195 with the disp-rdma driver:
> 
>    mediatek-disp-rdma 1c002000.rdma: Failed to add component: -517
> 
> But the same pattern is used across many other drivers, so update them
> all.

While I agree with this commit, it makes little sense to change only one print.

Can you take care of converting all of the dev_err() prints to dev_err_probe()?

P.S.: Also please do it on top of my OF graph series [1]
P.P.S.: It's -EPROBE_DEFER, not EDEFER_PROBE :-P

Thanks,
Angelo

[1]: 
https://lore.kernel.org/all/20240516081104.83458-1-angelogioacchino.delregno@collabora.com/


> 
> Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
> ---
>   drivers/gpu/drm/mediatek/mtk_disp_aal.c         | 2 +-
>   drivers/gpu/drm/mediatek/mtk_disp_ccorr.c       | 2 +-
>   drivers/gpu/drm/mediatek/mtk_disp_color.c       | 2 +-
>   drivers/gpu/drm/mediatek/mtk_disp_gamma.c       | 2 +-
>   drivers/gpu/drm/mediatek/mtk_disp_merge.c       | 2 +-
>   drivers/gpu/drm/mediatek/mtk_disp_ovl.c         | 2 +-
>   drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c | 2 +-
>   drivers/gpu/drm/mediatek/mtk_disp_rdma.c        | 2 +-
>   drivers/gpu/drm/mediatek/mtk_ethdr.c            | 2 +-
>   drivers/gpu/drm/mediatek/mtk_mdp_rdma.c         | 2 +-
>   10 files changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/gpu/drm/mediatek/mtk_disp_aal.c b/drivers/gpu/drm/mediatek/mtk_disp_aal.c
> index 3ce8f32b06d5..892dc40458fb 100644
> --- a/drivers/gpu/drm/mediatek/mtk_disp_aal.c
> +++ b/drivers/gpu/drm/mediatek/mtk_disp_aal.c
> @@ -197,7 +197,7 @@ static int mtk_disp_aal_probe(struct platform_device *pdev)
>   
>   	ret = component_add(dev, &mtk_disp_aal_component_ops);
>   	if (ret)
> -		dev_err(dev, "Failed to add component: %d\n", ret);
> +		dev_err_probe(dev, ret, "Failed to add component\n");
>   
>   	return ret;
>   }
> diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ccorr.c b/drivers/gpu/drm/mediatek/mtk_disp_ccorr.c
> index df35e90dd25f..fc273ebdbcd2 100644
> --- a/drivers/gpu/drm/mediatek/mtk_disp_ccorr.c
> +++ b/drivers/gpu/drm/mediatek/mtk_disp_ccorr.c
> @@ -182,7 +182,7 @@ static int mtk_disp_ccorr_probe(struct platform_device *pdev)
>   
>   	ret = component_add(dev, &mtk_disp_ccorr_component_ops);
>   	if (ret)
> -		dev_err(dev, "Failed to add component: %d\n", ret);
> +		dev_err_probe(dev, ret, "Failed to add component\n");
>   
>   	return ret;
>   }
> diff --git a/drivers/gpu/drm/mediatek/mtk_disp_color.c b/drivers/gpu/drm/mediatek/mtk_disp_color.c
> index 7f0085be5671..c2c374e9a8e3 100644
> --- a/drivers/gpu/drm/mediatek/mtk_disp_color.c
> +++ b/drivers/gpu/drm/mediatek/mtk_disp_color.c
> @@ -126,7 +126,7 @@ static int mtk_disp_color_probe(struct platform_device *pdev)
>   
>   	ret = component_add(dev, &mtk_disp_color_component_ops);
>   	if (ret)
> -		dev_err(dev, "Failed to add component: %d\n", ret);
> +		dev_err_probe(dev, ret, "Failed to add component\n");
>   
>   	return ret;
>   }
> diff --git a/drivers/gpu/drm/mediatek/mtk_disp_gamma.c b/drivers/gpu/drm/mediatek/mtk_disp_gamma.c
> index ca8d1f3aca03..ec926b32c34d 100644
> --- a/drivers/gpu/drm/mediatek/mtk_disp_gamma.c
> +++ b/drivers/gpu/drm/mediatek/mtk_disp_gamma.c
> @@ -287,7 +287,7 @@ static int mtk_disp_gamma_probe(struct platform_device *pdev)
>   
>   	ret = component_add(dev, &mtk_disp_gamma_component_ops);
>   	if (ret)
> -		dev_err(dev, "Failed to add component: %d\n", ret);
> +		dev_err_probe(dev, ret, "Failed to add component\n");
>   
>   	return ret;
>   }
> diff --git a/drivers/gpu/drm/mediatek/mtk_disp_merge.c b/drivers/gpu/drm/mediatek/mtk_disp_merge.c
> index 77c057e0e671..2f6a605542d5 100644
> --- a/drivers/gpu/drm/mediatek/mtk_disp_merge.c
> +++ b/drivers/gpu/drm/mediatek/mtk_disp_merge.c
> @@ -354,7 +354,7 @@ static int mtk_disp_merge_probe(struct platform_device *pdev)
>   
>   	ret = component_add(dev, &mtk_disp_merge_component_ops);
>   	if (ret != 0)
> -		dev_err(dev, "Failed to add component: %d\n", ret);
> +		dev_err_probe(dev, ret, "Failed to add component\n");
>   
>   	return ret;
>   }
> diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
> index b552a02d7eae..ffdc9ca5b6f5 100644
> --- a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
> +++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
> @@ -555,7 +555,7 @@ static int mtk_disp_ovl_probe(struct platform_device *pdev)
>   	ret = component_add(dev, &mtk_disp_ovl_component_ops);
>   	if (ret) {
>   		pm_runtime_disable(dev);
> -		dev_err(dev, "Failed to add component: %d\n", ret);
> +		dev_err_probe(dev, ret, "Failed to add component\n");
>   	}
>   
>   	return ret;
> diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c b/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c
> index 02dd7dcdfedb..c9d6f2b39e92 100644
> --- a/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c
> +++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c
> @@ -612,7 +612,7 @@ static int mtk_disp_ovl_adaptor_probe(struct platform_device *pdev)
>   	ret = component_add(dev, &mtk_disp_ovl_adaptor_comp_ops);
>   	if (ret != 0) {
>   		pm_runtime_disable(dev);
> -		dev_err(dev, "Failed to add component: %d\n", ret);
> +		dev_err_probe(dev, ret, "Failed to add component\n");
>   	}
>   
>   	return ret;
> diff --git a/drivers/gpu/drm/mediatek/mtk_disp_rdma.c b/drivers/gpu/drm/mediatek/mtk_disp_rdma.c
> index 7b1a6e631200..ac83e89e39d2 100644
> --- a/drivers/gpu/drm/mediatek/mtk_disp_rdma.c
> +++ b/drivers/gpu/drm/mediatek/mtk_disp_rdma.c
> @@ -373,7 +373,7 @@ static int mtk_disp_rdma_probe(struct platform_device *pdev)
>   	ret = component_add(dev, &mtk_disp_rdma_component_ops);
>   	if (ret) {
>   		pm_runtime_disable(dev);
> -		dev_err(dev, "Failed to add component: %d\n", ret);
> +		dev_err_probe(dev, ret, "Failed to add component\n");
>   	}
>   
>   	return ret;
> diff --git a/drivers/gpu/drm/mediatek/mtk_ethdr.c b/drivers/gpu/drm/mediatek/mtk_ethdr.c
> index 156c6ff547e8..25b305bff97e 100644
> --- a/drivers/gpu/drm/mediatek/mtk_ethdr.c
> +++ b/drivers/gpu/drm/mediatek/mtk_ethdr.c
> @@ -341,7 +341,7 @@ static int mtk_ethdr_probe(struct platform_device *pdev)
>   
>   	ret = component_add(dev, &mtk_ethdr_component_ops);
>   	if (ret)
> -		dev_notice(dev, "Failed to add component: %d\n", ret);
> +		dev_err_probe(dev, ret, "Failed to add component\n");
>   
>   	return ret;
>   }
> diff --git a/drivers/gpu/drm/mediatek/mtk_mdp_rdma.c b/drivers/gpu/drm/mediatek/mtk_mdp_rdma.c
> index 925cbb7471ec..3a0944bee134 100644
> --- a/drivers/gpu/drm/mediatek/mtk_mdp_rdma.c
> +++ b/drivers/gpu/drm/mediatek/mtk_mdp_rdma.c
> @@ -324,7 +324,7 @@ static int mtk_mdp_rdma_probe(struct platform_device *pdev)
>   	ret = component_add(dev, &mtk_mdp_rdma_component_ops);
>   	if (ret != 0) {
>   		pm_runtime_disable(dev);
> -		dev_err(dev, "Failed to add component: %d\n", ret);
> +		dev_err_probe(dev, ret, "Failed to add component\n");
>   	}
>   	return ret;
>   }
> 
> ---
> base-commit: d97496ca23a2d4ee80b7302849404859d9058bcd
> change-id: 20240605-mtk-disp-rdma-dev-err-probe-ef9c10a1a91e
> 
> Best regards,
Jonathan Cameron June 6, 2024, 12:35 p.m. UTC | #2
On Wed, 05 Jun 2024 12:50:25 -0400
Nícolas F. R. A. Prado <nfraprado@collabora.com> wrote:

> Use dev_err_probe() in the component_add() error path to prevent
> printing an error when the probe is deferred. This was observed on
> mt8195 with the disp-rdma driver:
> 
>   mediatek-disp-rdma 1c002000.rdma: Failed to add component: -517
> 
> But the same pattern is used across many other drivers, so update them
> all.
> 
> Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
> ---
>  drivers/gpu/drm/mediatek/mtk_disp_aal.c         | 2 +-
>  drivers/gpu/drm/mediatek/mtk_disp_ccorr.c       | 2 +-
>  drivers/gpu/drm/mediatek/mtk_disp_color.c       | 2 +-
>  drivers/gpu/drm/mediatek/mtk_disp_gamma.c       | 2 +-
>  drivers/gpu/drm/mediatek/mtk_disp_merge.c       | 2 +-
>  drivers/gpu/drm/mediatek/mtk_disp_ovl.c         | 2 +-
>  drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c | 2 +-
>  drivers/gpu/drm/mediatek/mtk_disp_rdma.c        | 2 +-
>  drivers/gpu/drm/mediatek/mtk_ethdr.c            | 2 +-
>  drivers/gpu/drm/mediatek/mtk_mdp_rdma.c         | 2 +-
>  10 files changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/gpu/drm/mediatek/mtk_disp_aal.c b/drivers/gpu/drm/mediatek/mtk_disp_aal.c
> index 3ce8f32b06d5..892dc40458fb 100644
> --- a/drivers/gpu/drm/mediatek/mtk_disp_aal.c
> +++ b/drivers/gpu/drm/mediatek/mtk_disp_aal.c
> @@ -197,7 +197,7 @@ static int mtk_disp_aal_probe(struct platform_device *pdev)
>  
>  	ret = component_add(dev, &mtk_disp_aal_component_ops);
>  	if (ret)
> -		dev_err(dev, "Failed to add component: %d\n", ret);
> +		dev_err_probe(dev, ret, "Failed to add component\n");
Perhaps
		return dev_err_probe(...)

	return 0;

Whilst I can see you are focused on this one problem case, it
might be better to use dev_err_probe() for all the similar
cases earlier in these functions.

Then that return dev_err_probe() pattern will make more sense
as it will be consistent with all the other calls.
diff mbox series

Patch

diff --git a/drivers/gpu/drm/mediatek/mtk_disp_aal.c b/drivers/gpu/drm/mediatek/mtk_disp_aal.c
index 3ce8f32b06d5..892dc40458fb 100644
--- a/drivers/gpu/drm/mediatek/mtk_disp_aal.c
+++ b/drivers/gpu/drm/mediatek/mtk_disp_aal.c
@@ -197,7 +197,7 @@  static int mtk_disp_aal_probe(struct platform_device *pdev)
 
 	ret = component_add(dev, &mtk_disp_aal_component_ops);
 	if (ret)
-		dev_err(dev, "Failed to add component: %d\n", ret);
+		dev_err_probe(dev, ret, "Failed to add component\n");
 
 	return ret;
 }
diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ccorr.c b/drivers/gpu/drm/mediatek/mtk_disp_ccorr.c
index df35e90dd25f..fc273ebdbcd2 100644
--- a/drivers/gpu/drm/mediatek/mtk_disp_ccorr.c
+++ b/drivers/gpu/drm/mediatek/mtk_disp_ccorr.c
@@ -182,7 +182,7 @@  static int mtk_disp_ccorr_probe(struct platform_device *pdev)
 
 	ret = component_add(dev, &mtk_disp_ccorr_component_ops);
 	if (ret)
-		dev_err(dev, "Failed to add component: %d\n", ret);
+		dev_err_probe(dev, ret, "Failed to add component\n");
 
 	return ret;
 }
diff --git a/drivers/gpu/drm/mediatek/mtk_disp_color.c b/drivers/gpu/drm/mediatek/mtk_disp_color.c
index 7f0085be5671..c2c374e9a8e3 100644
--- a/drivers/gpu/drm/mediatek/mtk_disp_color.c
+++ b/drivers/gpu/drm/mediatek/mtk_disp_color.c
@@ -126,7 +126,7 @@  static int mtk_disp_color_probe(struct platform_device *pdev)
 
 	ret = component_add(dev, &mtk_disp_color_component_ops);
 	if (ret)
-		dev_err(dev, "Failed to add component: %d\n", ret);
+		dev_err_probe(dev, ret, "Failed to add component\n");
 
 	return ret;
 }
diff --git a/drivers/gpu/drm/mediatek/mtk_disp_gamma.c b/drivers/gpu/drm/mediatek/mtk_disp_gamma.c
index ca8d1f3aca03..ec926b32c34d 100644
--- a/drivers/gpu/drm/mediatek/mtk_disp_gamma.c
+++ b/drivers/gpu/drm/mediatek/mtk_disp_gamma.c
@@ -287,7 +287,7 @@  static int mtk_disp_gamma_probe(struct platform_device *pdev)
 
 	ret = component_add(dev, &mtk_disp_gamma_component_ops);
 	if (ret)
-		dev_err(dev, "Failed to add component: %d\n", ret);
+		dev_err_probe(dev, ret, "Failed to add component\n");
 
 	return ret;
 }
diff --git a/drivers/gpu/drm/mediatek/mtk_disp_merge.c b/drivers/gpu/drm/mediatek/mtk_disp_merge.c
index 77c057e0e671..2f6a605542d5 100644
--- a/drivers/gpu/drm/mediatek/mtk_disp_merge.c
+++ b/drivers/gpu/drm/mediatek/mtk_disp_merge.c
@@ -354,7 +354,7 @@  static int mtk_disp_merge_probe(struct platform_device *pdev)
 
 	ret = component_add(dev, &mtk_disp_merge_component_ops);
 	if (ret != 0)
-		dev_err(dev, "Failed to add component: %d\n", ret);
+		dev_err_probe(dev, ret, "Failed to add component\n");
 
 	return ret;
 }
diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
index b552a02d7eae..ffdc9ca5b6f5 100644
--- a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
+++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
@@ -555,7 +555,7 @@  static int mtk_disp_ovl_probe(struct platform_device *pdev)
 	ret = component_add(dev, &mtk_disp_ovl_component_ops);
 	if (ret) {
 		pm_runtime_disable(dev);
-		dev_err(dev, "Failed to add component: %d\n", ret);
+		dev_err_probe(dev, ret, "Failed to add component\n");
 	}
 
 	return ret;
diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c b/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c
index 02dd7dcdfedb..c9d6f2b39e92 100644
--- a/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c
+++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c
@@ -612,7 +612,7 @@  static int mtk_disp_ovl_adaptor_probe(struct platform_device *pdev)
 	ret = component_add(dev, &mtk_disp_ovl_adaptor_comp_ops);
 	if (ret != 0) {
 		pm_runtime_disable(dev);
-		dev_err(dev, "Failed to add component: %d\n", ret);
+		dev_err_probe(dev, ret, "Failed to add component\n");
 	}
 
 	return ret;
diff --git a/drivers/gpu/drm/mediatek/mtk_disp_rdma.c b/drivers/gpu/drm/mediatek/mtk_disp_rdma.c
index 7b1a6e631200..ac83e89e39d2 100644
--- a/drivers/gpu/drm/mediatek/mtk_disp_rdma.c
+++ b/drivers/gpu/drm/mediatek/mtk_disp_rdma.c
@@ -373,7 +373,7 @@  static int mtk_disp_rdma_probe(struct platform_device *pdev)
 	ret = component_add(dev, &mtk_disp_rdma_component_ops);
 	if (ret) {
 		pm_runtime_disable(dev);
-		dev_err(dev, "Failed to add component: %d\n", ret);
+		dev_err_probe(dev, ret, "Failed to add component\n");
 	}
 
 	return ret;
diff --git a/drivers/gpu/drm/mediatek/mtk_ethdr.c b/drivers/gpu/drm/mediatek/mtk_ethdr.c
index 156c6ff547e8..25b305bff97e 100644
--- a/drivers/gpu/drm/mediatek/mtk_ethdr.c
+++ b/drivers/gpu/drm/mediatek/mtk_ethdr.c
@@ -341,7 +341,7 @@  static int mtk_ethdr_probe(struct platform_device *pdev)
 
 	ret = component_add(dev, &mtk_ethdr_component_ops);
 	if (ret)
-		dev_notice(dev, "Failed to add component: %d\n", ret);
+		dev_err_probe(dev, ret, "Failed to add component\n");
 
 	return ret;
 }
diff --git a/drivers/gpu/drm/mediatek/mtk_mdp_rdma.c b/drivers/gpu/drm/mediatek/mtk_mdp_rdma.c
index 925cbb7471ec..3a0944bee134 100644
--- a/drivers/gpu/drm/mediatek/mtk_mdp_rdma.c
+++ b/drivers/gpu/drm/mediatek/mtk_mdp_rdma.c
@@ -324,7 +324,7 @@  static int mtk_mdp_rdma_probe(struct platform_device *pdev)
 	ret = component_add(dev, &mtk_mdp_rdma_component_ops);
 	if (ret != 0) {
 		pm_runtime_disable(dev);
-		dev_err(dev, "Failed to add component: %d\n", ret);
+		dev_err_probe(dev, ret, "Failed to add component\n");
 	}
 	return ret;
 }