linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] thermal/drivers/qcom/temp-alarm: Use dev_err_probe
@ 2023-06-25 11:11 Luca Weiss
  2023-06-26  9:47 ` Konrad Dybcio
  2023-06-26 11:20 ` Daniel Lezcano
  0 siblings, 2 replies; 3+ messages in thread
From: Luca Weiss @ 2023-06-25 11:11 UTC (permalink / raw)
  To: ~postmarketos/upstreaming, phone-devel, Amit Kucheria,
	Thara Gopinath, Andy Gross, Bjorn Andersson, Konrad Dybcio,
	Rafael J. Wysocki, Daniel Lezcano, Zhang Rui
  Cc: linux-arm-msm, linux-pm, linux-kernel, Luca Weiss

Use the dev_err_probe function instead of dev_err in the probe function
so that the printed message includes the return value and also handles
-EPROBE_DEFER nicely.

Signed-off-by: Luca Weiss <luca@z3ntu.xyz>
---
 drivers/thermal/qcom/qcom-spmi-temp-alarm.c | 34 ++++++++++++-----------------
 1 file changed, 14 insertions(+), 20 deletions(-)

diff --git a/drivers/thermal/qcom/qcom-spmi-temp-alarm.c b/drivers/thermal/qcom/qcom-spmi-temp-alarm.c
index 2a3b3e21260f..0e8ebfcd84c5 100644
--- a/drivers/thermal/qcom/qcom-spmi-temp-alarm.c
+++ b/drivers/thermal/qcom/qcom-spmi-temp-alarm.c
@@ -411,22 +411,19 @@ static int qpnp_tm_probe(struct platform_device *pdev)
 	chip->base = res;
 
 	ret = qpnp_tm_read(chip, QPNP_TM_REG_TYPE, &type);
-	if (ret < 0) {
-		dev_err(&pdev->dev, "could not read type\n");
-		return ret;
-	}
+	if (ret < 0)
+		return dev_err_probe(&pdev->dev, ret,
+				     "could not read type\n");
 
 	ret = qpnp_tm_read(chip, QPNP_TM_REG_SUBTYPE, &subtype);
-	if (ret < 0) {
-		dev_err(&pdev->dev, "could not read subtype\n");
-		return ret;
-	}
+	if (ret < 0)
+		return dev_err_probe(&pdev->dev, ret,
+				     "could not read subtype\n");
 
 	ret = qpnp_tm_read(chip, QPNP_TM_REG_DIG_MAJOR, &dig_major);
-	if (ret < 0) {
-		dev_err(&pdev->dev, "could not read dig_major\n");
-		return ret;
-	}
+	if (ret < 0)
+		return dev_err_probe(&pdev->dev, ret,
+				     "could not read dig_major\n");
 
 	if (type != QPNP_TM_TYPE || (subtype != QPNP_TM_SUBTYPE_GEN1
 				     && subtype != QPNP_TM_SUBTYPE_GEN2)) {
@@ -448,16 +445,13 @@ static int qpnp_tm_probe(struct platform_device *pdev)
 	 */
 	chip->tz_dev = devm_thermal_of_zone_register(
 		&pdev->dev, 0, chip, &qpnp_tm_sensor_ops);
-	if (IS_ERR(chip->tz_dev)) {
-		dev_err(&pdev->dev, "failed to register sensor\n");
-		return PTR_ERR(chip->tz_dev);
-	}
+	if (IS_ERR(chip->tz_dev))
+		return dev_err_probe(&pdev->dev, PTR_ERR(chip->tz_dev),
+				     "failed to register sensor\n");
 
 	ret = qpnp_tm_init(chip);
-	if (ret < 0) {
-		dev_err(&pdev->dev, "init failed\n");
-		return ret;
-	}
+	if (ret < 0)
+		return dev_err_probe(&pdev->dev, ret, "init failed\n");
 
 	devm_thermal_add_hwmon_sysfs(&pdev->dev, chip->tz_dev);
 

---
base-commit: 8d2be868b42c08290509c60515865f4de24ea704
change-id: 20230625-spmi-temp-alarm-defer-0889b80544e3

Best regards,
-- 
Luca Weiss <luca@z3ntu.xyz>


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

* Re: [PATCH] thermal/drivers/qcom/temp-alarm: Use dev_err_probe
  2023-06-25 11:11 [PATCH] thermal/drivers/qcom/temp-alarm: Use dev_err_probe Luca Weiss
@ 2023-06-26  9:47 ` Konrad Dybcio
  2023-06-26 11:20 ` Daniel Lezcano
  1 sibling, 0 replies; 3+ messages in thread
From: Konrad Dybcio @ 2023-06-26  9:47 UTC (permalink / raw)
  To: Luca Weiss, ~postmarketos/upstreaming, phone-devel,
	Amit Kucheria, Thara Gopinath, Andy Gross, Bjorn Andersson,
	Rafael J. Wysocki, Daniel Lezcano, Zhang Rui
  Cc: linux-arm-msm, linux-pm, linux-kernel

On 25.06.2023 13:11, Luca Weiss wrote:
> Use the dev_err_probe function instead of dev_err in the probe function
> so that the printed message includes the return value and also handles
> -EPROBE_DEFER nicely.
> 
> Signed-off-by: Luca Weiss <luca@z3ntu.xyz>
> ---
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>

Konrad
>  drivers/thermal/qcom/qcom-spmi-temp-alarm.c | 34 ++++++++++++-----------------
>  1 file changed, 14 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/thermal/qcom/qcom-spmi-temp-alarm.c b/drivers/thermal/qcom/qcom-spmi-temp-alarm.c
> index 2a3b3e21260f..0e8ebfcd84c5 100644
> --- a/drivers/thermal/qcom/qcom-spmi-temp-alarm.c
> +++ b/drivers/thermal/qcom/qcom-spmi-temp-alarm.c
> @@ -411,22 +411,19 @@ static int qpnp_tm_probe(struct platform_device *pdev)
>  	chip->base = res;
>  
>  	ret = qpnp_tm_read(chip, QPNP_TM_REG_TYPE, &type);
> -	if (ret < 0) {
> -		dev_err(&pdev->dev, "could not read type\n");
> -		return ret;
> -	}
> +	if (ret < 0)
> +		return dev_err_probe(&pdev->dev, ret,
> +				     "could not read type\n");
>  
>  	ret = qpnp_tm_read(chip, QPNP_TM_REG_SUBTYPE, &subtype);
> -	if (ret < 0) {
> -		dev_err(&pdev->dev, "could not read subtype\n");
> -		return ret;
> -	}
> +	if (ret < 0)
> +		return dev_err_probe(&pdev->dev, ret,
> +				     "could not read subtype\n");
>  
>  	ret = qpnp_tm_read(chip, QPNP_TM_REG_DIG_MAJOR, &dig_major);
> -	if (ret < 0) {
> -		dev_err(&pdev->dev, "could not read dig_major\n");
> -		return ret;
> -	}
> +	if (ret < 0)
> +		return dev_err_probe(&pdev->dev, ret,
> +				     "could not read dig_major\n");
>  
>  	if (type != QPNP_TM_TYPE || (subtype != QPNP_TM_SUBTYPE_GEN1
>  				     && subtype != QPNP_TM_SUBTYPE_GEN2)) {
> @@ -448,16 +445,13 @@ static int qpnp_tm_probe(struct platform_device *pdev)
>  	 */
>  	chip->tz_dev = devm_thermal_of_zone_register(
>  		&pdev->dev, 0, chip, &qpnp_tm_sensor_ops);
> -	if (IS_ERR(chip->tz_dev)) {
> -		dev_err(&pdev->dev, "failed to register sensor\n");
> -		return PTR_ERR(chip->tz_dev);
> -	}
> +	if (IS_ERR(chip->tz_dev))
> +		return dev_err_probe(&pdev->dev, PTR_ERR(chip->tz_dev),
> +				     "failed to register sensor\n");
>  
>  	ret = qpnp_tm_init(chip);
> -	if (ret < 0) {
> -		dev_err(&pdev->dev, "init failed\n");
> -		return ret;
> -	}
> +	if (ret < 0)
> +		return dev_err_probe(&pdev->dev, ret, "init failed\n");
>  
>  	devm_thermal_add_hwmon_sysfs(&pdev->dev, chip->tz_dev);
>  
> 
> ---
> base-commit: 8d2be868b42c08290509c60515865f4de24ea704
> change-id: 20230625-spmi-temp-alarm-defer-0889b80544e3
> 
> Best regards,

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

* Re: [PATCH] thermal/drivers/qcom/temp-alarm: Use dev_err_probe
  2023-06-25 11:11 [PATCH] thermal/drivers/qcom/temp-alarm: Use dev_err_probe Luca Weiss
  2023-06-26  9:47 ` Konrad Dybcio
@ 2023-06-26 11:20 ` Daniel Lezcano
  1 sibling, 0 replies; 3+ messages in thread
From: Daniel Lezcano @ 2023-06-26 11:20 UTC (permalink / raw)
  To: Luca Weiss, ~postmarketos/upstreaming, phone-devel,
	Amit Kucheria, Thara Gopinath, Andy Gross, Bjorn Andersson,
	Konrad Dybcio, Rafael J. Wysocki, Zhang Rui
  Cc: linux-arm-msm, linux-pm, linux-kernel

On 25/06/2023 13:11, Luca Weiss wrote:
> Use the dev_err_probe function instead of dev_err in the probe function
> so that the printed message includes the return value and also handles
> -EPROBE_DEFER nicely.
> 
> Signed-off-by: Luca Weiss <luca@z3ntu.xyz>
> ---

Applied, thanks

-- 
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog


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

end of thread, other threads:[~2023-06-26 11:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-25 11:11 [PATCH] thermal/drivers/qcom/temp-alarm: Use dev_err_probe Luca Weiss
2023-06-26  9:47 ` Konrad Dybcio
2023-06-26 11:20 ` Daniel Lezcano

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