linux-tegra.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 01/15] genirq/devres: Add error information printing for devm_request_threaded_irq()
@ 2023-06-27  7:16 Yangtao Li
  2023-06-27  7:16 ` [PATCH 02/15] thermal/drivers/armada: remove redundant msg Yangtao Li
                   ` (15 more replies)
  0 siblings, 16 replies; 21+ messages in thread
From: Yangtao Li @ 2023-06-27  7:16 UTC (permalink / raw)
  To: miquel.raynal, rafael, daniel.lezcano, amitk, rui.zhang, mmayer,
	bcm-kernel-feedback-list, florian.fainelli, shawnguo, s.hauer,
	kernel, festevam, linux-imx, agross, andersson, konrad.dybcio,
	thara.gopinath, heiko, mcoquelin.stm32, alexandre.torgue,
	thierry.reding, jonathanh, tglx, matthias.bgg,
	angelogioacchino.delregno, srinivas.pandruvada,
	DLG-Adam.Ward.opensource, frank.li, shangxiaojing, bchihi, wenst,
	u.kleine-koenig, hayashi.kunihiko, niklas.soderlund+renesas,
	chi.minghao, johan+linaro, jernej.skrabec
  Cc: linux-pm, linux-kernel, linux-arm-kernel, linux-arm-msm,
	linux-rockchip, linux-stm32, linux-tegra, linux-mediatek

Ensure that all error handling branches print error information. In this
way, when this function fails, the upper-layer functions can directly
return an error code without missing debugging information. Otherwise,
the error message will be printed redundantly or missing.

There are more than 700 calls to the devm_request_threaded_irq method.
If error messages are printed everywhere, more than 1000 lines of code
can be saved by removing the msg in the driver.

Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
 kernel/irq/devres.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/kernel/irq/devres.c b/kernel/irq/devres.c
index f6e5515ee077..94039a915218 100644
--- a/kernel/irq/devres.c
+++ b/kernel/irq/devres.c
@@ -58,8 +58,10 @@ int devm_request_threaded_irq(struct device *dev, unsigned int irq,
 
 	dr = devres_alloc(devm_irq_release, sizeof(struct irq_devres),
 			  GFP_KERNEL);
-	if (!dr)
+	if (!dr) {
+		dev_err(dev, "Failed to allocate device resource data\n");
 		return -ENOMEM;
+	}
 
 	if (!devname)
 		devname = dev_name(dev);
@@ -67,6 +69,7 @@ int devm_request_threaded_irq(struct device *dev, unsigned int irq,
 	rc = request_threaded_irq(irq, handler, thread_fn, irqflags, devname,
 				  dev_id);
 	if (rc) {
+		dev_err(dev, "Failed to request threaded irq\n");
 		devres_free(dr);
 		return rc;
 	}
-- 
2.39.0


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

* [PATCH 02/15] thermal/drivers/armada: remove redundant msg
  2023-06-27  7:16 [PATCH 01/15] genirq/devres: Add error information printing for devm_request_threaded_irq() Yangtao Li
@ 2023-06-27  7:16 ` Yangtao Li
  2023-06-27  7:16 ` [PATCH 03/15] thermal/drivers/brcmstb_thermal: " Yangtao Li
                   ` (14 subsequent siblings)
  15 siblings, 0 replies; 21+ messages in thread
From: Yangtao Li @ 2023-06-27  7:16 UTC (permalink / raw)
  To: miquel.raynal, rafael, daniel.lezcano, amitk, rui.zhang, mmayer,
	bcm-kernel-feedback-list, florian.fainelli, shawnguo, s.hauer,
	kernel, festevam, linux-imx, agross, andersson, konrad.dybcio,
	thara.gopinath, heiko, mcoquelin.stm32, alexandre.torgue,
	thierry.reding, jonathanh, tglx, matthias.bgg,
	angelogioacchino.delregno, srinivas.pandruvada,
	DLG-Adam.Ward.opensource, frank.li, shangxiaojing, bchihi, wenst,
	u.kleine-koenig, hayashi.kunihiko, niklas.soderlund+renesas,
	chi.minghao, johan+linaro, jernej.skrabec
  Cc: linux-pm, linux-kernel, linux-arm-kernel, linux-arm-msm,
	linux-rockchip, linux-stm32, linux-tegra, linux-mediatek

The upper-layer devm_request_threaded_irq() function can directly
print error information.

Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
 drivers/thermal/armada_thermal.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/thermal/armada_thermal.c b/drivers/thermal/armada_thermal.c
index 9f6dc4fc9112..98b04158f06e 100644
--- a/drivers/thermal/armada_thermal.c
+++ b/drivers/thermal/armada_thermal.c
@@ -917,11 +917,8 @@ static int armada_thermal_probe(struct platform_device *pdev)
 						armada_overheat_isr,
 						armada_overheat_isr_thread,
 						0, NULL, priv);
-		if (ret) {
-			dev_err(&pdev->dev, "Cannot request threaded IRQ %d\n",
-				irq);
+		if (ret)
 			return ret;
-		}
 	}
 
 	/*
-- 
2.39.0


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

* [PATCH 03/15] thermal/drivers/brcmstb_thermal: remove redundant msg
  2023-06-27  7:16 [PATCH 01/15] genirq/devres: Add error information printing for devm_request_threaded_irq() Yangtao Li
  2023-06-27  7:16 ` [PATCH 02/15] thermal/drivers/armada: remove redundant msg Yangtao Li
@ 2023-06-27  7:16 ` Yangtao Li
  2023-06-27  7:16 ` [PATCH 04/15] thermal/drivers/db8500: " Yangtao Li
                   ` (13 subsequent siblings)
  15 siblings, 0 replies; 21+ messages in thread
From: Yangtao Li @ 2023-06-27  7:16 UTC (permalink / raw)
  To: miquel.raynal, rafael, daniel.lezcano, amitk, rui.zhang, mmayer,
	bcm-kernel-feedback-list, florian.fainelli, shawnguo, s.hauer,
	kernel, festevam, linux-imx, agross, andersson, konrad.dybcio,
	thara.gopinath, heiko, mcoquelin.stm32, alexandre.torgue,
	thierry.reding, jonathanh, tglx, matthias.bgg,
	angelogioacchino.delregno, srinivas.pandruvada,
	DLG-Adam.Ward.opensource, frank.li, shangxiaojing, bchihi, wenst,
	u.kleine-koenig, hayashi.kunihiko, niklas.soderlund+renesas,
	chi.minghao, johan+linaro, jernej.skrabec
  Cc: linux-pm, linux-kernel, linux-arm-kernel, linux-arm-msm,
	linux-rockchip, linux-stm32, linux-tegra, linux-mediatek

The upper-layer devm_request_threaded_irq() function can directly
print error information.

Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
 drivers/thermal/broadcom/brcmstb_thermal.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/thermal/broadcom/brcmstb_thermal.c b/drivers/thermal/broadcom/brcmstb_thermal.c
index 72d1dbe60b8f..7611094cf367 100644
--- a/drivers/thermal/broadcom/brcmstb_thermal.c
+++ b/drivers/thermal/broadcom/brcmstb_thermal.c
@@ -353,10 +353,8 @@ static int brcmstb_thermal_probe(struct platform_device *pdev)
 						brcmstb_tmon_irq_thread,
 						IRQF_ONESHOT,
 						DRV_NAME, priv);
-		if (ret < 0) {
-			dev_err(&pdev->dev, "could not request IRQ: %d\n", ret);
+		if (ret < 0)
 			return ret;
-		}
 	}
 
 	dev_info(&pdev->dev, "registered AVS TMON of-sensor driver\n");
-- 
2.39.0


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

* [PATCH 04/15] thermal/drivers/db8500: remove redundant msg
  2023-06-27  7:16 [PATCH 01/15] genirq/devres: Add error information printing for devm_request_threaded_irq() Yangtao Li
  2023-06-27  7:16 ` [PATCH 02/15] thermal/drivers/armada: remove redundant msg Yangtao Li
  2023-06-27  7:16 ` [PATCH 03/15] thermal/drivers/brcmstb_thermal: " Yangtao Li
@ 2023-06-27  7:16 ` Yangtao Li
  2023-06-27  7:16 ` [PATCH 05/15] thermal/drivers/hisi: " Yangtao Li
                   ` (12 subsequent siblings)
  15 siblings, 0 replies; 21+ messages in thread
From: Yangtao Li @ 2023-06-27  7:16 UTC (permalink / raw)
  To: miquel.raynal, rafael, daniel.lezcano, amitk, rui.zhang, mmayer,
	bcm-kernel-feedback-list, florian.fainelli, shawnguo, s.hauer,
	kernel, festevam, linux-imx, agross, andersson, konrad.dybcio,
	thara.gopinath, heiko, mcoquelin.stm32, alexandre.torgue,
	thierry.reding, jonathanh, tglx, matthias.bgg,
	angelogioacchino.delregno, srinivas.pandruvada,
	DLG-Adam.Ward.opensource, frank.li, shangxiaojing, bchihi, wenst,
	u.kleine-koenig, hayashi.kunihiko, niklas.soderlund+renesas,
	chi.minghao, johan+linaro, jernej.skrabec
  Cc: linux-pm, linux-kernel, linux-arm-kernel, linux-arm-msm,
	linux-rockchip, linux-stm32, linux-tegra, linux-mediatek

The upper-layer devm_request_threaded_irq() function can directly
print error information.

Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
 drivers/thermal/db8500_thermal.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/thermal/db8500_thermal.c b/drivers/thermal/db8500_thermal.c
index fca5c2c93bf9..0a890d1338cf 100644
--- a/drivers/thermal/db8500_thermal.c
+++ b/drivers/thermal/db8500_thermal.c
@@ -167,10 +167,8 @@ static int db8500_thermal_probe(struct platform_device *pdev)
 	ret = devm_request_threaded_irq(dev, low_irq, NULL,
 		prcmu_low_irq_handler, IRQF_NO_SUSPEND | IRQF_ONESHOT,
 		"dbx500_temp_low", th);
-	if (ret < 0) {
-		dev_err(dev, "failed to allocate temp low irq\n");
+	if (ret < 0)
 		return ret;
-	}
 
 	high_irq = platform_get_irq_byname(pdev, "IRQ_HOTMON_HIGH");
 	if (high_irq < 0)
@@ -179,10 +177,8 @@ static int db8500_thermal_probe(struct platform_device *pdev)
 	ret = devm_request_threaded_irq(dev, high_irq, NULL,
 		prcmu_high_irq_handler, IRQF_NO_SUSPEND | IRQF_ONESHOT,
 		"dbx500_temp_high", th);
-	if (ret < 0) {
-		dev_err(dev, "failed to allocate temp high irq\n");
+	if (ret < 0)
 		return ret;
-	}
 
 	/* register of thermal sensor and get info from DT */
 	th->tz = devm_thermal_of_zone_register(dev, 0, th, &thdev_ops);
-- 
2.39.0


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

* [PATCH 05/15] thermal/drivers/hisi: remove redundant msg
  2023-06-27  7:16 [PATCH 01/15] genirq/devres: Add error information printing for devm_request_threaded_irq() Yangtao Li
                   ` (2 preceding siblings ...)
  2023-06-27  7:16 ` [PATCH 04/15] thermal/drivers/db8500: " Yangtao Li
@ 2023-06-27  7:16 ` Yangtao Li
  2023-06-27  7:16 ` [PATCH 06/15] thermal/drivers/imx: " Yangtao Li
                   ` (11 subsequent siblings)
  15 siblings, 0 replies; 21+ messages in thread
From: Yangtao Li @ 2023-06-27  7:16 UTC (permalink / raw)
  To: miquel.raynal, rafael, daniel.lezcano, amitk, rui.zhang, mmayer,
	bcm-kernel-feedback-list, florian.fainelli, shawnguo, s.hauer,
	kernel, festevam, linux-imx, agross, andersson, konrad.dybcio,
	thara.gopinath, heiko, mcoquelin.stm32, alexandre.torgue,
	thierry.reding, jonathanh, tglx, matthias.bgg,
	angelogioacchino.delregno, srinivas.pandruvada,
	DLG-Adam.Ward.opensource, frank.li, shangxiaojing, bchihi, wenst,
	u.kleine-koenig, hayashi.kunihiko, niklas.soderlund+renesas,
	chi.minghao, johan+linaro, jernej.skrabec
  Cc: linux-pm, linux-kernel, linux-arm-kernel, linux-arm-msm,
	linux-rockchip, linux-stm32, linux-tegra, linux-mediatek

The upper-layer devm_request_threaded_irq() function can directly
print error information.

Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
 drivers/thermal/hisi_thermal.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/thermal/hisi_thermal.c b/drivers/thermal/hisi_thermal.c
index 3f09ef8be41a..5f20f07a7566 100644
--- a/drivers/thermal/hisi_thermal.c
+++ b/drivers/thermal/hisi_thermal.c
@@ -580,10 +580,8 @@ static int hisi_thermal_probe(struct platform_device *pdev)
 						hisi_thermal_alarm_irq_thread,
 						IRQF_ONESHOT, sensor->irq_name,
 						sensor);
-		if (ret < 0) {
-			dev_err(dev, "Failed to request alarm irq: %d\n", ret);
+		if (ret < 0)
 			return ret;
-		}
 
 		ret = data->ops->enable_sensor(sensor);
 		if (ret) {
-- 
2.39.0


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

* [PATCH 06/15] thermal/drivers/imx: remove redundant msg
  2023-06-27  7:16 [PATCH 01/15] genirq/devres: Add error information printing for devm_request_threaded_irq() Yangtao Li
                   ` (3 preceding siblings ...)
  2023-06-27  7:16 ` [PATCH 05/15] thermal/drivers/hisi: " Yangtao Li
@ 2023-06-27  7:16 ` Yangtao Li
  2023-06-27  7:16 ` [PATCH 07/15] thermal/drivers/qcom: " Yangtao Li
                   ` (10 subsequent siblings)
  15 siblings, 0 replies; 21+ messages in thread
From: Yangtao Li @ 2023-06-27  7:16 UTC (permalink / raw)
  To: miquel.raynal, rafael, daniel.lezcano, amitk, rui.zhang, mmayer,
	bcm-kernel-feedback-list, florian.fainelli, shawnguo, s.hauer,
	kernel, festevam, linux-imx, agross, andersson, konrad.dybcio,
	thara.gopinath, heiko, mcoquelin.stm32, alexandre.torgue,
	thierry.reding, jonathanh, tglx, matthias.bgg,
	angelogioacchino.delregno, srinivas.pandruvada,
	DLG-Adam.Ward.opensource, frank.li, shangxiaojing, bchihi, wenst,
	u.kleine-koenig, hayashi.kunihiko, niklas.soderlund+renesas,
	chi.minghao, johan+linaro, jernej.skrabec
  Cc: linux-pm, linux-kernel, linux-arm-kernel, linux-arm-msm,
	linux-rockchip, linux-stm32, linux-tegra, linux-mediatek

The upper-layer devm_request_threaded_irq() function can directly
print error information.

Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
 drivers/thermal/imx_thermal.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c
index a94ec0a0c9dd..9be252bea1f0 100644
--- a/drivers/thermal/imx_thermal.c
+++ b/drivers/thermal/imx_thermal.c
@@ -749,10 +749,8 @@ static int imx_thermal_probe(struct platform_device *pdev)
 	ret = devm_request_threaded_irq(&pdev->dev, data->irq,
 			imx_thermal_alarm_irq, imx_thermal_alarm_irq_thread,
 			0, "imx_thermal", data);
-	if (ret < 0) {
-		dev_err(&pdev->dev, "failed to request alarm irq: %d\n", ret);
+	if (ret < 0)
 		goto thermal_zone_unregister;
-	}
 
 	pm_runtime_put(data->dev);
 
-- 
2.39.0


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

* [PATCH 07/15] thermal/drivers/qcom: remove redundant msg
  2023-06-27  7:16 [PATCH 01/15] genirq/devres: Add error information printing for devm_request_threaded_irq() Yangtao Li
                   ` (4 preceding siblings ...)
  2023-06-27  7:16 ` [PATCH 06/15] thermal/drivers/imx: " Yangtao Li
@ 2023-06-27  7:16 ` Yangtao Li
  2023-06-27  7:16 ` [PATCH 08/15] thermal/drivers/tegra-soctherm: " Yangtao Li
                   ` (9 subsequent siblings)
  15 siblings, 0 replies; 21+ messages in thread
From: Yangtao Li @ 2023-06-27  7:16 UTC (permalink / raw)
  To: miquel.raynal, rafael, daniel.lezcano, amitk, rui.zhang, mmayer,
	bcm-kernel-feedback-list, florian.fainelli, shawnguo, s.hauer,
	kernel, festevam, linux-imx, agross, andersson, konrad.dybcio,
	thara.gopinath, heiko, mcoquelin.stm32, alexandre.torgue,
	thierry.reding, jonathanh, tglx, matthias.bgg,
	angelogioacchino.delregno, srinivas.pandruvada,
	DLG-Adam.Ward.opensource, frank.li, shangxiaojing, bchihi, wenst,
	u.kleine-koenig, hayashi.kunihiko, niklas.soderlund+renesas,
	chi.minghao, johan+linaro, jernej.skrabec
  Cc: linux-pm, linux-kernel, linux-arm-kernel, linux-arm-msm,
	linux-rockchip, linux-stm32, linux-tegra, linux-mediatek

The upper-layer devm_request_threaded_irq() function can directly
print error information.

Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
 drivers/thermal/qcom/tsens.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c
index 98c356acfe98..63a16d942b84 100644
--- a/drivers/thermal/qcom/tsens.c
+++ b/drivers/thermal/qcom/tsens.c
@@ -1182,10 +1182,7 @@ static int tsens_register_irq(struct tsens_priv *priv, char *irqname,
 							dev_name(&pdev->dev),
 							priv);
 
-		if (ret)
-			dev_err(&pdev->dev, "%s: failed to get irq\n",
-				__func__);
-		else
+		if (!ret)
 			enable_irq_wake(irq);
 	}
 
-- 
2.39.0


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

* [PATCH 08/15] thermal/drivers/tegra-soctherm: remove redundant msg
  2023-06-27  7:16 [PATCH 01/15] genirq/devres: Add error information printing for devm_request_threaded_irq() Yangtao Li
                   ` (5 preceding siblings ...)
  2023-06-27  7:16 ` [PATCH 07/15] thermal/drivers/qcom: " Yangtao Li
@ 2023-06-27  7:16 ` Yangtao Li
  2023-06-27  7:17 ` [PATCH 09/15] thermal/drivers/maxim: " Yangtao Li
                   ` (8 subsequent siblings)
  15 siblings, 0 replies; 21+ messages in thread
From: Yangtao Li @ 2023-06-27  7:16 UTC (permalink / raw)
  To: miquel.raynal, rafael, daniel.lezcano, amitk, rui.zhang, mmayer,
	bcm-kernel-feedback-list, florian.fainelli, shawnguo, s.hauer,
	kernel, festevam, linux-imx, agross, andersson, konrad.dybcio,
	thara.gopinath, heiko, mcoquelin.stm32, alexandre.torgue,
	thierry.reding, jonathanh, tglx, matthias.bgg,
	angelogioacchino.delregno, srinivas.pandruvada,
	DLG-Adam.Ward.opensource, frank.li, shangxiaojing, bchihi, wenst,
	u.kleine-koenig, hayashi.kunihiko, niklas.soderlund+renesas,
	chi.minghao, johan+linaro, jernej.skrabec
  Cc: linux-pm, linux-kernel, linux-arm-kernel, linux-arm-msm,
	linux-rockchip, linux-stm32, linux-tegra, linux-mediatek

The upper-layer devm_request_threaded_irq() function can directly
print error information.

Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
 drivers/thermal/tegra/soctherm.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/thermal/tegra/soctherm.c b/drivers/thermal/tegra/soctherm.c
index ea66cba09e56..55966c0a2610 100644
--- a/drivers/thermal/tegra/soctherm.c
+++ b/drivers/thermal/tegra/soctherm.c
@@ -2000,10 +2000,8 @@ static int soctherm_interrupts_init(struct platform_device *pdev,
 					IRQF_ONESHOT,
 					dev_name(&pdev->dev),
 					tegra);
-	if (ret < 0) {
-		dev_err(&pdev->dev, "request_irq 'thermal_irq' failed.\n");
+	if (ret < 0)
 		return ret;
-	}
 
 	ret = devm_request_threaded_irq(&pdev->dev,
 					tegra->edp_irq,
@@ -2012,10 +2010,8 @@ static int soctherm_interrupts_init(struct platform_device *pdev,
 					IRQF_ONESHOT,
 					"soctherm_edp",
 					tegra);
-	if (ret < 0) {
-		dev_err(&pdev->dev, "request_irq 'edp_irq' failed.\n");
+	if (ret < 0)
 		return ret;
-	}
 
 	return 0;
 }
-- 
2.39.0


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

* [PATCH 09/15] thermal/drivers/maxim: remove redundant msg
  2023-06-27  7:16 [PATCH 01/15] genirq/devres: Add error information printing for devm_request_threaded_irq() Yangtao Li
                   ` (6 preceding siblings ...)
  2023-06-27  7:16 ` [PATCH 08/15] thermal/drivers/tegra-soctherm: " Yangtao Li
@ 2023-06-27  7:17 ` Yangtao Li
  2023-06-27  7:17 ` [PATCH 10/15] thermal/drivers/int340x: " Yangtao Li
                   ` (7 subsequent siblings)
  15 siblings, 0 replies; 21+ messages in thread
From: Yangtao Li @ 2023-06-27  7:17 UTC (permalink / raw)
  To: miquel.raynal, rafael, daniel.lezcano, amitk, rui.zhang, mmayer,
	bcm-kernel-feedback-list, florian.fainelli, shawnguo, s.hauer,
	kernel, festevam, linux-imx, agross, andersson, konrad.dybcio,
	thara.gopinath, heiko, mcoquelin.stm32, alexandre.torgue,
	thierry.reding, jonathanh, tglx, matthias.bgg,
	angelogioacchino.delregno, srinivas.pandruvada,
	DLG-Adam.Ward.opensource, frank.li, shangxiaojing, bchihi, wenst,
	u.kleine-koenig, hayashi.kunihiko, niklas.soderlund+renesas,
	chi.minghao, johan+linaro, jernej.skrabec
  Cc: linux-pm, linux-kernel, linux-arm-kernel, linux-arm-msm,
	linux-rockchip, linux-stm32, linux-tegra, linux-mediatek

The upper-layer devm_request_threaded_irq() function can directly
print error information.

Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
 drivers/thermal/max77620_thermal.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/thermal/max77620_thermal.c b/drivers/thermal/max77620_thermal.c
index 61c7622d9945..73c251caa62d 100644
--- a/drivers/thermal/max77620_thermal.c
+++ b/drivers/thermal/max77620_thermal.c
@@ -125,19 +125,15 @@ static int max77620_thermal_probe(struct platform_device *pdev)
 					max77620_thermal_irq,
 					IRQF_ONESHOT | IRQF_SHARED,
 					dev_name(&pdev->dev), mtherm);
-	if (ret < 0) {
-		dev_err(&pdev->dev, "Failed to request irq1: %d\n", ret);
+	if (ret < 0)
 		return ret;
-	}
 
 	ret = devm_request_threaded_irq(&pdev->dev, mtherm->irq_tjalarm2, NULL,
 					max77620_thermal_irq,
 					IRQF_ONESHOT | IRQF_SHARED,
 					dev_name(&pdev->dev), mtherm);
-	if (ret < 0) {
-		dev_err(&pdev->dev, "Failed to request irq2: %d\n", ret);
+	if (ret < 0)
 		return ret;
-	}
 
 	platform_set_drvdata(pdev, mtherm);
 
-- 
2.39.0


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

* [PATCH 10/15] thermal/drivers/int340x: remove redundant msg
  2023-06-27  7:16 [PATCH 01/15] genirq/devres: Add error information printing for devm_request_threaded_irq() Yangtao Li
                   ` (7 preceding siblings ...)
  2023-06-27  7:17 ` [PATCH 09/15] thermal/drivers/maxim: " Yangtao Li
@ 2023-06-27  7:17 ` Yangtao Li
  2023-06-27  7:17 ` [PATCH 11/15] thermal/drivers/intel: " Yangtao Li
                   ` (6 subsequent siblings)
  15 siblings, 0 replies; 21+ messages in thread
From: Yangtao Li @ 2023-06-27  7:17 UTC (permalink / raw)
  To: miquel.raynal, rafael, daniel.lezcano, amitk, rui.zhang, mmayer,
	bcm-kernel-feedback-list, florian.fainelli, shawnguo, s.hauer,
	kernel, festevam, linux-imx, agross, andersson, konrad.dybcio,
	thara.gopinath, heiko, mcoquelin.stm32, alexandre.torgue,
	thierry.reding, jonathanh, tglx, matthias.bgg,
	angelogioacchino.delregno, srinivas.pandruvada,
	DLG-Adam.Ward.opensource, frank.li, shangxiaojing, bchihi, wenst,
	u.kleine-koenig, hayashi.kunihiko, niklas.soderlund+renesas,
	chi.minghao, johan+linaro, jernej.skrabec
  Cc: linux-pm, linux-kernel, linux-arm-kernel, linux-arm-msm,
	linux-rockchip, linux-stm32, linux-tegra, linux-mediatek

The upper-layer devm_request_threaded_irq() function can directly
print error information.

Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
 .../intel/int340x_thermal/processor_thermal_device_pci.c      | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c b/drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c
index 0d1e98007270..6ea9892b3660 100644
--- a/drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c
+++ b/drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c
@@ -261,10 +261,8 @@ static int proc_thermal_pci_probe(struct pci_dev *pdev, const struct pci_device_
 	ret = devm_request_threaded_irq(&pdev->dev, irq,
 					proc_thermal_irq_handler, NULL,
 					irq_flag, KBUILD_MODNAME, pci_info);
-	if (ret) {
-		dev_err(&pdev->dev, "Request IRQ %d failed\n", pdev->irq);
+	if (ret)
 		goto err_free_vectors;
-	}
 
 	ret = thermal_zone_device_enable(pci_info->tzone);
 	if (ret)
-- 
2.39.0


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

* [PATCH 11/15] thermal/drivers/intel: remove redundant msg
  2023-06-27  7:16 [PATCH 01/15] genirq/devres: Add error information printing for devm_request_threaded_irq() Yangtao Li
                   ` (8 preceding siblings ...)
  2023-06-27  7:17 ` [PATCH 10/15] thermal/drivers/int340x: " Yangtao Li
@ 2023-06-27  7:17 ` Yangtao Li
  2023-06-27  7:17 ` [PATCH 12/15] thermal/drivers/stm: " Yangtao Li
                   ` (5 subsequent siblings)
  15 siblings, 0 replies; 21+ messages in thread
From: Yangtao Li @ 2023-06-27  7:17 UTC (permalink / raw)
  To: miquel.raynal, rafael, daniel.lezcano, amitk, rui.zhang, mmayer,
	bcm-kernel-feedback-list, florian.fainelli, shawnguo, s.hauer,
	kernel, festevam, linux-imx, agross, andersson, konrad.dybcio,
	thara.gopinath, heiko, mcoquelin.stm32, alexandre.torgue,
	thierry.reding, jonathanh, tglx, matthias.bgg,
	angelogioacchino.delregno, srinivas.pandruvada,
	DLG-Adam.Ward.opensource, frank.li, shangxiaojing, bchihi, wenst,
	u.kleine-koenig, hayashi.kunihiko, niklas.soderlund+renesas,
	chi.minghao, johan+linaro, jernej.skrabec
  Cc: linux-pm, linux-kernel, linux-arm-kernel, linux-arm-msm,
	linux-rockchip, linux-stm32, linux-tegra, linux-mediatek

The upper-layer devm_request_threaded_irq() function can directly
print error information.

Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
 drivers/thermal/intel/intel_bxt_pmic_thermal.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/thermal/intel/intel_bxt_pmic_thermal.c b/drivers/thermal/intel/intel_bxt_pmic_thermal.c
index 6312c6ba081f..aeaefbbd5d8f 100644
--- a/drivers/thermal/intel/intel_bxt_pmic_thermal.c
+++ b/drivers/thermal/intel/intel_bxt_pmic_thermal.c
@@ -245,10 +245,8 @@ static int pmic_thermal_probe(struct platform_device *pdev)
 				NULL, pmic_thermal_irq_handler,
 				IRQF_ONESHOT, "pmic_thermal", pdev);
 
-		if (ret) {
-			dev_err(dev, "request irq(%d) failed: %d\n", virq, ret);
+		if (ret)
 			return ret;
-		}
 		pmic_irq_count++;
 	}
 
-- 
2.39.0


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

* [PATCH 12/15] thermal/drivers/stm: remove redundant msg
  2023-06-27  7:16 [PATCH 01/15] genirq/devres: Add error information printing for devm_request_threaded_irq() Yangtao Li
                   ` (9 preceding siblings ...)
  2023-06-27  7:17 ` [PATCH 11/15] thermal/drivers/intel: " Yangtao Li
@ 2023-06-27  7:17 ` Yangtao Li
  2023-06-27  7:17 ` [PATCH 13/15] thermal/drivers/rockchip: " Yangtao Li
                   ` (4 subsequent siblings)
  15 siblings, 0 replies; 21+ messages in thread
From: Yangtao Li @ 2023-06-27  7:17 UTC (permalink / raw)
  To: miquel.raynal, rafael, daniel.lezcano, amitk, rui.zhang, mmayer,
	bcm-kernel-feedback-list, florian.fainelli, shawnguo, s.hauer,
	kernel, festevam, linux-imx, agross, andersson, konrad.dybcio,
	thara.gopinath, heiko, mcoquelin.stm32, alexandre.torgue,
	thierry.reding, jonathanh, tglx, matthias.bgg,
	angelogioacchino.delregno, srinivas.pandruvada,
	DLG-Adam.Ward.opensource, frank.li, shangxiaojing, bchihi, wenst,
	u.kleine-koenig, hayashi.kunihiko, niklas.soderlund+renesas,
	chi.minghao, johan+linaro, jernej.skrabec
  Cc: linux-pm, linux-kernel, linux-arm-kernel, linux-arm-msm,
	linux-rockchip, linux-stm32, linux-tegra, linux-mediatek

The upper-layer devm_request_threaded_irq() function can directly
print error information.

Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
 drivers/thermal/st/st_thermal_memmap.c | 4 +---
 drivers/thermal/st/stm_thermal.c       | 5 +----
 2 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/thermal/st/st_thermal_memmap.c b/drivers/thermal/st/st_thermal_memmap.c
index e8cfa83b724a..dd52e1b9d925 100644
--- a/drivers/thermal/st/st_thermal_memmap.c
+++ b/drivers/thermal/st/st_thermal_memmap.c
@@ -101,10 +101,8 @@ static int st_mmap_register_enable_irq(struct st_thermal_sensor *sensor)
 					NULL, st_mmap_thermal_trip_handler,
 					IRQF_TRIGGER_RISING | IRQF_ONESHOT,
 					dev->driver->name, sensor);
-	if (ret) {
-		dev_err(dev, "failed to register IRQ %d\n", sensor->irq);
+	if (ret)
 		return ret;
-	}
 
 	return st_mmap_enable_irq(sensor);
 }
diff --git a/drivers/thermal/st/stm_thermal.c b/drivers/thermal/st/stm_thermal.c
index 903fcf1763f1..d72e866c0ab9 100644
--- a/drivers/thermal/st/stm_thermal.c
+++ b/drivers/thermal/st/stm_thermal.c
@@ -392,11 +392,8 @@ static int stm_register_irq(struct stm_thermal_sensor *sensor)
 					stm_thermal_irq_handler,
 					IRQF_ONESHOT,
 					dev->driver->name, sensor);
-	if (ret) {
-		dev_err(dev, "%s: Failed to register IRQ %d\n", __func__,
-			sensor->irq);
+	if (ret)
 		return ret;
-	}
 
 	dev_dbg(dev, "%s: thermal IRQ registered", __func__);
 
-- 
2.39.0


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

* [PATCH 13/15] thermal/drivers/rockchip: remove redundant msg
  2023-06-27  7:16 [PATCH 01/15] genirq/devres: Add error information printing for devm_request_threaded_irq() Yangtao Li
                   ` (10 preceding siblings ...)
  2023-06-27  7:17 ` [PATCH 12/15] thermal/drivers/stm: " Yangtao Li
@ 2023-06-27  7:17 ` Yangtao Li
  2023-06-27  7:40   ` Krzysztof Kozlowski
  2023-06-27  7:17 ` [PATCH 14/15] thermal/drivers/tegra: " Yangtao Li
                   ` (3 subsequent siblings)
  15 siblings, 1 reply; 21+ messages in thread
From: Yangtao Li @ 2023-06-27  7:17 UTC (permalink / raw)
  To: miquel.raynal, rafael, daniel.lezcano, amitk, rui.zhang, mmayer,
	bcm-kernel-feedback-list, florian.fainelli, shawnguo, s.hauer,
	kernel, festevam, linux-imx, agross, andersson, konrad.dybcio,
	thara.gopinath, heiko, mcoquelin.stm32, alexandre.torgue,
	thierry.reding, jonathanh, tglx, matthias.bgg,
	angelogioacchino.delregno, srinivas.pandruvada,
	DLG-Adam.Ward.opensource, frank.li, shangxiaojing, bchihi, wenst,
	u.kleine-koenig, hayashi.kunihiko, niklas.soderlund+renesas,
	chi.minghao, johan+linaro, jernej.skrabec
  Cc: linux-pm, linux-kernel, linux-arm-kernel, linux-arm-msm,
	linux-rockchip, linux-stm32, linux-tegra, linux-mediatek

The upper-layer devm_request_threaded_irq() function can directly
print error information.

Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
 drivers/thermal/rockchip_thermal.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/thermal/rockchip_thermal.c b/drivers/thermal/rockchip_thermal.c
index 77231a9d28ff..e741f5539389 100644
--- a/drivers/thermal/rockchip_thermal.c
+++ b/drivers/thermal/rockchip_thermal.c
@@ -1582,8 +1582,7 @@ static int rockchip_thermal_probe(struct platform_device *pdev)
 					  IRQF_ONESHOT,
 					  "rockchip_thermal", thermal);
 	if (error)
-		return dev_err_probe(&pdev->dev, error,
-				     "failed to request tsadc irq.\n");
+		return error;
 
 	thermal->chip->control(thermal->regs, true);
 
-- 
2.39.0


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

* [PATCH 14/15] thermal/drivers/tegra: remove redundant msg
  2023-06-27  7:16 [PATCH 01/15] genirq/devres: Add error information printing for devm_request_threaded_irq() Yangtao Li
                   ` (11 preceding siblings ...)
  2023-06-27  7:17 ` [PATCH 13/15] thermal/drivers/rockchip: " Yangtao Li
@ 2023-06-27  7:17 ` Yangtao Li
  2023-06-27  7:17 ` [PATCH 15/15] thermal/drivers/mediatek/lvts_thermal: " Yangtao Li
                   ` (2 subsequent siblings)
  15 siblings, 0 replies; 21+ messages in thread
From: Yangtao Li @ 2023-06-27  7:17 UTC (permalink / raw)
  To: miquel.raynal, rafael, daniel.lezcano, amitk, rui.zhang, mmayer,
	bcm-kernel-feedback-list, florian.fainelli, shawnguo, s.hauer,
	kernel, festevam, linux-imx, agross, andersson, konrad.dybcio,
	thara.gopinath, heiko, mcoquelin.stm32, alexandre.torgue,
	thierry.reding, jonathanh, tglx, matthias.bgg,
	angelogioacchino.delregno, srinivas.pandruvada,
	DLG-Adam.Ward.opensource, frank.li, shangxiaojing, bchihi, wenst,
	u.kleine-koenig, hayashi.kunihiko, niklas.soderlund+renesas,
	chi.minghao, johan+linaro, jernej.skrabec
  Cc: linux-pm, linux-kernel, linux-arm-kernel, linux-arm-msm,
	linux-rockchip, linux-stm32, linux-tegra, linux-mediatek

The upper-layer devm_request_threaded_irq() function can directly
print error information.

Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
 drivers/thermal/tegra/tegra30-tsensor.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/thermal/tegra/tegra30-tsensor.c b/drivers/thermal/tegra/tegra30-tsensor.c
index c243e9d76d3c..535a0b7304e5 100644
--- a/drivers/thermal/tegra/tegra30-tsensor.c
+++ b/drivers/thermal/tegra/tegra30-tsensor.c
@@ -597,8 +597,7 @@ static int tegra_tsensor_probe(struct platform_device *pdev)
 					tegra_tsensor_isr, IRQF_ONESHOT,
 					"tegra_tsensor", ts);
 	if (err)
-		return dev_err_probe(&pdev->dev, err,
-				     "failed to request interrupt\n");
+		return err;
 
 	return 0;
 }
-- 
2.39.0


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

* [PATCH 15/15] thermal/drivers/mediatek/lvts_thermal: remove redundant msg
  2023-06-27  7:16 [PATCH 01/15] genirq/devres: Add error information printing for devm_request_threaded_irq() Yangtao Li
                   ` (12 preceding siblings ...)
  2023-06-27  7:17 ` [PATCH 14/15] thermal/drivers/tegra: " Yangtao Li
@ 2023-06-27  7:17 ` Yangtao Li
  2023-06-27  7:43 ` [PATCH 01/15] genirq/devres: Add error information printing for devm_request_threaded_irq() Krzysztof Kozlowski
  2023-06-27  8:49 ` Uwe Kleine-König
  15 siblings, 0 replies; 21+ messages in thread
From: Yangtao Li @ 2023-06-27  7:17 UTC (permalink / raw)
  To: miquel.raynal, rafael, daniel.lezcano, amitk, rui.zhang, mmayer,
	bcm-kernel-feedback-list, florian.fainelli, shawnguo, s.hauer,
	kernel, festevam, linux-imx, agross, andersson, konrad.dybcio,
	thara.gopinath, heiko, mcoquelin.stm32, alexandre.torgue,
	thierry.reding, jonathanh, tglx, matthias.bgg,
	angelogioacchino.delregno, srinivas.pandruvada,
	DLG-Adam.Ward.opensource, frank.li, shangxiaojing, bchihi, wenst,
	u.kleine-koenig, hayashi.kunihiko, niklas.soderlund+renesas,
	chi.minghao, johan+linaro, jernej.skrabec
  Cc: linux-pm, linux-kernel, linux-arm-kernel, linux-arm-msm,
	linux-rockchip, linux-stm32, linux-tegra, linux-mediatek

The upper-layer devm_request_threaded_irq() function can directly
print error information.

Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
 drivers/thermal/mediatek/lvts_thermal.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/thermal/mediatek/lvts_thermal.c b/drivers/thermal/mediatek/lvts_thermal.c
index b693fac2d677..bd503fbcba51 100644
--- a/drivers/thermal/mediatek/lvts_thermal.c
+++ b/drivers/thermal/mediatek/lvts_thermal.c
@@ -1151,7 +1151,7 @@ static int lvts_probe(struct platform_device *pdev)
 	ret = devm_request_threaded_irq(dev, irq, NULL, lvts_irq_handler,
 					IRQF_ONESHOT, dev_name(dev), lvts_td);
 	if (ret)
-		return dev_err_probe(dev, ret, "Failed to request interrupt\n");
+		return ret;
 
 	platform_set_drvdata(pdev, lvts_td);
 
-- 
2.39.0


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

* Re: [PATCH 13/15] thermal/drivers/rockchip: remove redundant msg
  2023-06-27  7:17 ` [PATCH 13/15] thermal/drivers/rockchip: " Yangtao Li
@ 2023-06-27  7:40   ` Krzysztof Kozlowski
  2023-06-27  7:44     ` Krzysztof Kozlowski
  0 siblings, 1 reply; 21+ messages in thread
From: Krzysztof Kozlowski @ 2023-06-27  7:40 UTC (permalink / raw)
  To: Yangtao Li, miquel.raynal, rafael, daniel.lezcano, amitk,
	rui.zhang, mmayer, bcm-kernel-feedback-list, florian.fainelli,
	shawnguo, s.hauer, kernel, festevam, linux-imx, agross,
	andersson, konrad.dybcio, thara.gopinath, heiko, mcoquelin.stm32,
	alexandre.torgue, thierry.reding, jonathanh, tglx, matthias.bgg,
	angelogioacchino.delregno, srinivas.pandruvada,
	DLG-Adam.Ward.opensource, shangxiaojing, bchihi, wenst,
	u.kleine-koenig, hayashi.kunihiko, niklas.soderlund+renesas,
	chi.minghao, johan+linaro, jernej.skrabec
  Cc: linux-pm, linux-kernel, linux-arm-kernel, linux-arm-msm,
	linux-rockchip, linux-stm32, linux-tegra, linux-mediatek

On 27/06/2023 09:17, Yangtao Li wrote:
> The upper-layer devm_request_threaded_irq() function can directly
> print error information.

I don't understand. "Can print"? It does not matter if it can, if it
does not. Currently it doesn't, therefore change is not correct.
Otherwise explain a bit better why this is redundant.

> 
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
> ---

Best regards,
Krzysztof


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

* Re: [PATCH 01/15] genirq/devres: Add error information printing for devm_request_threaded_irq()
  2023-06-27  7:16 [PATCH 01/15] genirq/devres: Add error information printing for devm_request_threaded_irq() Yangtao Li
                   ` (13 preceding siblings ...)
  2023-06-27  7:17 ` [PATCH 15/15] thermal/drivers/mediatek/lvts_thermal: " Yangtao Li
@ 2023-06-27  7:43 ` Krzysztof Kozlowski
  2023-07-03  9:10   ` Yangtao Li
  2023-06-27  8:49 ` Uwe Kleine-König
  15 siblings, 1 reply; 21+ messages in thread
From: Krzysztof Kozlowski @ 2023-06-27  7:43 UTC (permalink / raw)
  To: Yangtao Li, miquel.raynal, rafael, daniel.lezcano, amitk,
	rui.zhang, mmayer, bcm-kernel-feedback-list, florian.fainelli,
	shawnguo, s.hauer, kernel, festevam, linux-imx, agross,
	andersson, konrad.dybcio, thara.gopinath, heiko, mcoquelin.stm32,
	alexandre.torgue, thierry.reding, jonathanh, tglx, matthias.bgg,
	angelogioacchino.delregno, srinivas.pandruvada,
	DLG-Adam.Ward.opensource, shangxiaojing, bchihi, wenst,
	u.kleine-koenig, hayashi.kunihiko, niklas.soderlund+renesas,
	chi.minghao, johan+linaro, jernej.skrabec
  Cc: linux-pm, linux-kernel, linux-arm-kernel, linux-arm-msm,
	linux-rockchip, linux-stm32, linux-tegra, linux-mediatek

On 27/06/2023 09:16, Yangtao Li wrote:
> Ensure that all error handling branches print error information. In this
> way, when this function fails, the upper-layer functions can directly
> return an error code without missing debugging information. Otherwise,
> the error message will be printed redundantly or missing.
> 
> There are more than 700 calls to the devm_request_threaded_irq method.
> If error messages are printed everywhere, more than 1000 lines of code
> can be saved by removing the msg in the driver.
> 
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
> ---
>  kernel/irq/devres.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/kernel/irq/devres.c b/kernel/irq/devres.c
> index f6e5515ee077..94039a915218 100644
> --- a/kernel/irq/devres.c
> +++ b/kernel/irq/devres.c
> @@ -58,8 +58,10 @@ int devm_request_threaded_irq(struct device *dev, unsigned int irq,
>  
>  	dr = devres_alloc(devm_irq_release, sizeof(struct irq_devres),
>  			  GFP_KERNEL);
> -	if (!dr)
> +	if (!dr) {
> +		dev_err(dev, "Failed to allocate device resource data\n");

Just like any memory allocation, I don't think we print anything for
devres failures. Why do you think we should start doing it?

>  		return -ENOMEM;
> +	}
>  
>  	if (!devname)
>  		devname = dev_name(dev);
> @@ -67,6 +69,7 @@ int devm_request_threaded_irq(struct device *dev, unsigned int irq,
>  	rc = request_threaded_irq(irq, handler, thread_fn, irqflags, devname,
>  				  dev_id);
>  	if (rc) {
> +		dev_err(dev, "Failed to request threaded irq\n");

I don't like that one path - devm() managed - prints error, but regular
path does not. Code should be here consistent. Also error message is too
generic. You need to print at least irq number, maybe also devname?

Best regards,
Krzysztof


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

* Re: [PATCH 13/15] thermal/drivers/rockchip: remove redundant msg
  2023-06-27  7:40   ` Krzysztof Kozlowski
@ 2023-06-27  7:44     ` Krzysztof Kozlowski
  0 siblings, 0 replies; 21+ messages in thread
From: Krzysztof Kozlowski @ 2023-06-27  7:44 UTC (permalink / raw)
  To: Yangtao Li, miquel.raynal, rafael, daniel.lezcano, amitk,
	rui.zhang, mmayer, bcm-kernel-feedback-list, florian.fainelli,
	shawnguo, s.hauer, kernel, festevam, linux-imx, agross,
	andersson, konrad.dybcio, thara.gopinath, heiko, mcoquelin.stm32,
	alexandre.torgue, thierry.reding, jonathanh, tglx, matthias.bgg,
	angelogioacchino.delregno, srinivas.pandruvada,
	DLG-Adam.Ward.opensource, shangxiaojing, bchihi, wenst,
	u.kleine-koenig, hayashi.kunihiko, niklas.soderlund+renesas,
	chi.minghao, johan+linaro, jernej.skrabec
  Cc: linux-pm, linux-kernel, linux-arm-kernel, linux-arm-msm,
	linux-rockchip, linux-stm32, linux-tegra, linux-mediatek

On 27/06/2023 09:40, Krzysztof Kozlowski wrote:
> On 27/06/2023 09:17, Yangtao Li wrote:
>> The upper-layer devm_request_threaded_irq() function can directly
>> print error information.
> 
> I don't understand. "Can print"? It does not matter if it can, if it
> does not. Currently it doesn't, therefore change is not correct.
> Otherwise explain a bit better why this is redundant.

All your patches ended up in spam, so now I found your patch one.
Anyway, if this stays, please replace "can" with statement - "prints".

Best regards,
Krzysztof


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

* Re: [PATCH 01/15] genirq/devres: Add error information printing for devm_request_threaded_irq()
  2023-06-27  7:16 [PATCH 01/15] genirq/devres: Add error information printing for devm_request_threaded_irq() Yangtao Li
                   ` (14 preceding siblings ...)
  2023-06-27  7:43 ` [PATCH 01/15] genirq/devres: Add error information printing for devm_request_threaded_irq() Krzysztof Kozlowski
@ 2023-06-27  8:49 ` Uwe Kleine-König
  15 siblings, 0 replies; 21+ messages in thread
From: Uwe Kleine-König @ 2023-06-27  8:49 UTC (permalink / raw)
  To: Yangtao Li
  Cc: miquel.raynal, rafael, daniel.lezcano, amitk, rui.zhang, mmayer,
	bcm-kernel-feedback-list, florian.fainelli, shawnguo, s.hauer,
	kernel, festevam, linux-imx, agross, andersson, konrad.dybcio,
	thara.gopinath, heiko, mcoquelin.stm32, alexandre.torgue,
	thierry.reding, jonathanh, tglx, matthias.bgg,
	angelogioacchino.delregno, srinivas.pandruvada,
	DLG-Adam.Ward.opensource, shangxiaojing, bchihi, wenst,
	hayashi.kunihiko, niklas.soderlund+renesas, chi.minghao,
	johan+linaro, jernej.skrabec, linux-pm, linux-arm-msm,
	linux-kernel, linux-rockchip, linux-mediatek, linux-tegra,
	linux-stm32, linux-arm-kernel

[-- Attachment #1: Type: text/plain, Size: 2635 bytes --]

Hello,

On Tue, Jun 27, 2023 at 03:16:52PM +0800, Yangtao Li wrote:
> Ensure that all error handling branches print error information. In this
> way, when this function fails, the upper-layer functions can directly
> return an error code without missing debugging information. Otherwise,
> the error message will be printed redundantly or missing.
> 
> There are more than 700 calls to the devm_request_threaded_irq method.
> If error messages are printed everywhere, more than 1000 lines of code
> can be saved by removing the msg in the driver.
> 
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
> ---
>  kernel/irq/devres.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/kernel/irq/devres.c b/kernel/irq/devres.c
> index f6e5515ee077..94039a915218 100644
> --- a/kernel/irq/devres.c
> +++ b/kernel/irq/devres.c
> @@ -58,8 +58,10 @@ int devm_request_threaded_irq(struct device *dev, unsigned int irq,
>  
>  	dr = devres_alloc(devm_irq_release, sizeof(struct irq_devres),
>  			  GFP_KERNEL);
> -	if (!dr)
> +	if (!dr) {
> +		dev_err(dev, "Failed to allocate device resource data\n");
>  		return -ENOMEM;
> +	}
>  
>  	if (!devname)
>  		devname = dev_name(dev);
> @@ -67,6 +69,7 @@ int devm_request_threaded_irq(struct device *dev, unsigned int irq,
>  	rc = request_threaded_irq(irq, handler, thread_fn, irqflags, devname,
>  				  dev_id);
>  	if (rc) {
> +		dev_err(dev, "Failed to request threaded irq\n");
>  		devres_free(dr);
>  		return rc;
>  	}

My personal opinion is that generic allocation functions should be
silent. The reason is that the consuming driver is in a better position
to emit a helpful error message.

While there is some room to improvment in this generic variant (by
mentioning the error code and maybe also the irq number), consider a
device that has up to 3 irqs and sometimes only 1. So the driver might
want to handle some irq requesting silently. And also for non-optional
irqs

	mybus:mydev: Failed to request TX irq (EBUSY)

is much more helpful than

	mybus:mydev: Failed to request threaded irq

(Hint: "threaded" is not a helpful information here either.)

Yes, a message in the driver has the downside of making the kernel image
(or module) bigger, but the added value is IMHO worth that.

Also you might want to handle -EPROBE_DEFER and not emit a message then?
(Not sure if request_threaded_irq can return that.)

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH 01/15] genirq/devres: Add error information printing for devm_request_threaded_irq()
  2023-06-27  7:43 ` [PATCH 01/15] genirq/devres: Add error information printing for devm_request_threaded_irq() Krzysztof Kozlowski
@ 2023-07-03  9:10   ` Yangtao Li
  2023-07-03 11:38     ` Krzysztof Kozlowski
  0 siblings, 1 reply; 21+ messages in thread
From: Yangtao Li @ 2023-07-03  9:10 UTC (permalink / raw)
  To: Krzysztof Kozlowski, miquel.raynal, rafael, daniel.lezcano,
	amitk, rui.zhang, mmayer, bcm-kernel-feedback-list,
	florian.fainelli, shawnguo, s.hauer, kernel, festevam, linux-imx,
	agross, andersson, konrad.dybcio, thara.gopinath, heiko,
	mcoquelin.stm32, alexandre.torgue, thierry.reding, jonathanh,
	tglx, matthias.bgg, angelogioacchino.delregno,
	srinivas.pandruvada, DLG-Adam.Ward.opensource, shangxiaojing,
	bchihi, wenst, u.kleine-koenig, hayashi.kunihiko,
	niklas.soderlund+renesas, chi.minghao, johan+linaro,
	jernej.skrabec
  Cc: linux-pm, linux-kernel, linux-arm-kernel, linux-arm-msm,
	linux-rockchip, linux-stm32, linux-tegra, linux-mediatek

On 2023/6/27 15:43, Krzysztof Kozlowski wrote:

> On 27/06/2023 09:16, Yangtao Li wrote:
>> Ensure that all error handling branches print error information. In this
>> way, when this function fails, the upper-layer functions can directly
>> return an error code without missing debugging information. Otherwise,
>> the error message will be printed redundantly or missing.
>>
>> There are more than 700 calls to the devm_request_threaded_irq method.
>> If error messages are printed everywhere, more than 1000 lines of code
>> can be saved by removing the msg in the driver.
>>
>> Signed-off-by: Yangtao Li <frank.li@vivo.com>
>> ---
>>   kernel/irq/devres.c | 5 ++++-
>>   1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/kernel/irq/devres.c b/kernel/irq/devres.c
>> index f6e5515ee077..94039a915218 100644
>> --- a/kernel/irq/devres.c
>> +++ b/kernel/irq/devres.c
>> @@ -58,8 +58,10 @@ int devm_request_threaded_irq(struct device *dev, unsigned int irq,
>>   
>>   	dr = devres_alloc(devm_irq_release, sizeof(struct irq_devres),
>>   			  GFP_KERNEL);
>> -	if (!dr)
>> +	if (!dr) {
>> +		dev_err(dev, "Failed to allocate device resource data\n");
> Just like any memory allocation, I don't think we print anything for
> devres failures. Why do you think we should start doing it?


And tglx point out that:

Having proper and consistent information why the device cannot be used 
_is_ useful.

>
>>   		return -ENOMEM;
>> +	}
>>   
>>   	if (!devname)
>>   		devname = dev_name(dev);
>> @@ -67,6 +69,7 @@ int devm_request_threaded_irq(struct device *dev, unsigned int irq,
>>   	rc = request_threaded_irq(irq, handler, thread_fn, irqflags, devname,
>>   				  dev_id);
>>   	if (rc) {
>> +		dev_err(dev, "Failed to request threaded irq\n");
> I don't like that one path - devm() managed - prints error, but regular
> path does not. Code should be here consistent. Also error message is too
> generic. You need to print at least irq number, maybe also devname?


v3 has been added.


Thx,

Yangtao


>
> Best regards,
> Krzysztof
>

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

* Re: [PATCH 01/15] genirq/devres: Add error information printing for devm_request_threaded_irq()
  2023-07-03  9:10   ` Yangtao Li
@ 2023-07-03 11:38     ` Krzysztof Kozlowski
  0 siblings, 0 replies; 21+ messages in thread
From: Krzysztof Kozlowski @ 2023-07-03 11:38 UTC (permalink / raw)
  To: Yangtao Li, miquel.raynal, rafael, daniel.lezcano, amitk,
	rui.zhang, mmayer, bcm-kernel-feedback-list, florian.fainelli,
	shawnguo, s.hauer, kernel, festevam, linux-imx, agross,
	andersson, konrad.dybcio, thara.gopinath, heiko, mcoquelin.stm32,
	alexandre.torgue, thierry.reding, jonathanh, tglx, matthias.bgg,
	angelogioacchino.delregno, srinivas.pandruvada,
	DLG-Adam.Ward.opensource, shangxiaojing, bchihi, wenst,
	u.kleine-koenig, hayashi.kunihiko, niklas.soderlund+renesas,
	chi.minghao, johan+linaro, jernej.skrabec
  Cc: linux-pm, linux-kernel, linux-arm-kernel, linux-arm-msm,
	linux-rockchip, linux-stm32, linux-tegra, linux-mediatek

On 03/07/2023 11:10, Yangtao Li wrote:
> On 2023/6/27 15:43, Krzysztof Kozlowski wrote:
> 
>> On 27/06/2023 09:16, Yangtao Li wrote:
>>> Ensure that all error handling branches print error information. In this
>>> way, when this function fails, the upper-layer functions can directly
>>> return an error code without missing debugging information. Otherwise,
>>> the error message will be printed redundantly or missing.
>>>
>>> There are more than 700 calls to the devm_request_threaded_irq method.
>>> If error messages are printed everywhere, more than 1000 lines of code
>>> can be saved by removing the msg in the driver.
>>>
>>> Signed-off-by: Yangtao Li <frank.li@vivo.com>
>>> ---
>>>   kernel/irq/devres.c | 5 ++++-
>>>   1 file changed, 4 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/kernel/irq/devres.c b/kernel/irq/devres.c
>>> index f6e5515ee077..94039a915218 100644
>>> --- a/kernel/irq/devres.c
>>> +++ b/kernel/irq/devres.c
>>> @@ -58,8 +58,10 @@ int devm_request_threaded_irq(struct device *dev, unsigned int irq,
>>>   
>>>   	dr = devres_alloc(devm_irq_release, sizeof(struct irq_devres),
>>>   			  GFP_KERNEL);
>>> -	if (!dr)
>>> +	if (!dr) {
>>> +		dev_err(dev, "Failed to allocate device resource data\n");
>> Just like any memory allocation, I don't think we print anything for
>> devres failures. Why do you think we should start doing it?
> 
> 
> And tglx point out that:
> 
> Having proper and consistent information why the device cannot be used 
> _is_ useful.

Where did tglx suggest printing devres allocation ENOMEM errors?

Best regards,
Krzysztof


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

end of thread, other threads:[~2023-07-03 11:38 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-27  7:16 [PATCH 01/15] genirq/devres: Add error information printing for devm_request_threaded_irq() Yangtao Li
2023-06-27  7:16 ` [PATCH 02/15] thermal/drivers/armada: remove redundant msg Yangtao Li
2023-06-27  7:16 ` [PATCH 03/15] thermal/drivers/brcmstb_thermal: " Yangtao Li
2023-06-27  7:16 ` [PATCH 04/15] thermal/drivers/db8500: " Yangtao Li
2023-06-27  7:16 ` [PATCH 05/15] thermal/drivers/hisi: " Yangtao Li
2023-06-27  7:16 ` [PATCH 06/15] thermal/drivers/imx: " Yangtao Li
2023-06-27  7:16 ` [PATCH 07/15] thermal/drivers/qcom: " Yangtao Li
2023-06-27  7:16 ` [PATCH 08/15] thermal/drivers/tegra-soctherm: " Yangtao Li
2023-06-27  7:17 ` [PATCH 09/15] thermal/drivers/maxim: " Yangtao Li
2023-06-27  7:17 ` [PATCH 10/15] thermal/drivers/int340x: " Yangtao Li
2023-06-27  7:17 ` [PATCH 11/15] thermal/drivers/intel: " Yangtao Li
2023-06-27  7:17 ` [PATCH 12/15] thermal/drivers/stm: " Yangtao Li
2023-06-27  7:17 ` [PATCH 13/15] thermal/drivers/rockchip: " Yangtao Li
2023-06-27  7:40   ` Krzysztof Kozlowski
2023-06-27  7:44     ` Krzysztof Kozlowski
2023-06-27  7:17 ` [PATCH 14/15] thermal/drivers/tegra: " Yangtao Li
2023-06-27  7:17 ` [PATCH 15/15] thermal/drivers/mediatek/lvts_thermal: " Yangtao Li
2023-06-27  7:43 ` [PATCH 01/15] genirq/devres: Add error information printing for devm_request_threaded_irq() Krzysztof Kozlowski
2023-07-03  9:10   ` Yangtao Li
2023-07-03 11:38     ` Krzysztof Kozlowski
2023-06-27  8:49 ` Uwe Kleine-König

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