2023-07-08 12:05:32

by Ahmad Fatoum

[permalink] [raw]
Subject: [PATCH] thermal: imx8mm: suppress log message on probe deferral

nvmem_cell_read_u32() may return -EPROBE_DEFER if NVMEM supplier has not
yet been probed. Future reprobe may succeed, so printing:

i.mx8mm_thermal 30260000.tmu: Failed to read OCOTP nvmem cell (-517).

to the log is confusing. Fix this by using dev_err_probe. This also
elevates the message from warning to error, which is more correct: The
log message is only ever printed in probe error path and probe aborts
afterwards, so it really warrants an error-level message.

Fixes: 403291648823 ("thermal/drivers/imx: Add support for loading calibration data from OCOTP")
Signed-off-by: Ahmad Fatoum <[email protected]>
---
drivers/thermal/imx8mm_thermal.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/thermal/imx8mm_thermal.c b/drivers/thermal/imx8mm_thermal.c
index d8005e9ec992..1f780c4a1c89 100644
--- a/drivers/thermal/imx8mm_thermal.c
+++ b/drivers/thermal/imx8mm_thermal.c
@@ -179,10 +179,8 @@ static int imx8mm_tmu_probe_set_calib_v1(struct platform_device *pdev,
int ret;

ret = nvmem_cell_read_u32(&pdev->dev, "calib", &ana0);
- if (ret) {
- dev_warn(dev, "Failed to read OCOTP nvmem cell (%d).\n", ret);
- return ret;
- }
+ if (ret)
+ return dev_err_probe(dev, ret, "Failed to read OCOTP nvmem cell\n");

writel(FIELD_PREP(TASR_BUF_VREF_MASK,
FIELD_GET(ANA0_BUF_VREF_MASK, ana0)) |
--
2.39.2



2023-07-08 13:19:08

by Marek Vasut

[permalink] [raw]
Subject: Re: [PATCH] thermal: imx8mm: suppress log message on probe deferral

On 7/8/23 13:26, Ahmad Fatoum wrote:
> nvmem_cell_read_u32() may return -EPROBE_DEFER if NVMEM supplier has not
> yet been probed. Future reprobe may succeed, so printing:
>
> i.mx8mm_thermal 30260000.tmu: Failed to read OCOTP nvmem cell (-517).
>
> to the log is confusing. Fix this by using dev_err_probe. This also
> elevates the message from warning to error, which is more correct: The
> log message is only ever printed in probe error path and probe aborts
> afterwards, so it really warrants an error-level message.
>
> Fixes: 403291648823 ("thermal/drivers/imx: Add support for loading calibration data from OCOTP")
> Signed-off-by: Ahmad Fatoum <[email protected]>

Reviewed-by: Marek Vasut <[email protected]>

Thanks

2023-07-09 23:51:49

by Peng Fan

[permalink] [raw]
Subject: RE: [PATCH] thermal: imx8mm: suppress log message on probe deferral


> Subject: [PATCH] thermal: imx8mm: suppress log message on probe deferral
>
> nvmem_cell_read_u32() may return -EPROBE_DEFER if NVMEM supplier has
> not yet been probed. Future reprobe may succeed, so printing:
>
> i.mx8mm_thermal 30260000.tmu: Failed to read OCOTP nvmem cell (-517).
>
> to the log is confusing. Fix this by using dev_err_probe. This also elevates
> the message from warning to error, which is more correct: The log message
> is only ever printed in probe error path and probe aborts afterwards, so it
> really warrants an error-level message.
>
> Fixes: 403291648823 ("thermal/drivers/imx: Add support for loading
> calibration data from OCOTP")
> Signed-off-by: Ahmad Fatoum <[email protected]>
[Peng Fan]

Reviewed-by: Peng Fan <[email protected]>

> ---
> drivers/thermal/imx8mm_thermal.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/thermal/imx8mm_thermal.c
> b/drivers/thermal/imx8mm_thermal.c
> index d8005e9ec992..1f780c4a1c89 100644
> --- a/drivers/thermal/imx8mm_thermal.c
> +++ b/drivers/thermal/imx8mm_thermal.c
> @@ -179,10 +179,8 @@ static int imx8mm_tmu_probe_set_calib_v1(struct
> platform_device *pdev,
> int ret;
>
> ret = nvmem_cell_read_u32(&pdev->dev, "calib", &ana0);
> - if (ret) {
> - dev_warn(dev, "Failed to read OCOTP nvmem cell (%d).\n",
> ret);
> - return ret;
> - }
> + if (ret)
> + return dev_err_probe(dev, ret, "Failed to read OCOTP
> nvmem cell\n");
>
> writel(FIELD_PREP(TASR_BUF_VREF_MASK,
> FIELD_GET(ANA0_BUF_VREF_MASK, ana0)) |
> --
> 2.39.2


2023-07-13 09:41:22

by Daniel Lezcano

[permalink] [raw]
Subject: Re: [PATCH] thermal: imx8mm: suppress log message on probe deferral

On 08/07/2023 13:26, Ahmad Fatoum wrote:
> nvmem_cell_read_u32() may return -EPROBE_DEFER if NVMEM supplier has not
> yet been probed. Future reprobe may succeed, so printing:
>
> i.mx8mm_thermal 30260000.tmu: Failed to read OCOTP nvmem cell (-517).
>
> to the log is confusing. Fix this by using dev_err_probe. This also
> elevates the message from warning to error, which is more correct: The
> log message is only ever printed in probe error path and probe aborts
> afterwards, so it really warrants an error-level message.
>
> Fixes: 403291648823 ("thermal/drivers/imx: Add support for loading calibration data from OCOTP")
> Signed-off-by: Ahmad Fatoum <[email protected]>
> ---

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