diff mbox series

[v2,02/16] thermal/core: Show a debug message when get_temp() fails

Message ID 20230221180710.2781027-3-daniel.lezcano@linaro.org (mailing list archive)
State Superseded, archived
Headers show
Series Self-encapsulate the thermal zone device structure | expand

Commit Message

Daniel Lezcano Feb. 21, 2023, 6:06 p.m. UTC
The different thermal drivers are showing an error in case the
get_temp() fails. Actually no traces should be displayed in the
backend ops but in the call site of this ops.

Furthermore, the message is often a dev_dbg message where the
tz->device is used, thus using the internal of the structure from the
driver.

Show a debug message if the thermal_zone_get_temp() fails to read the
sensor temperature, so code showing the message is factored out and
the tz->device accesss is in the scope of the thermal core framework.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
 drivers/thermal/thermal_helpers.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Rafael J. Wysocki Feb. 22, 2023, 7:25 p.m. UTC | #1
On Tue, Feb 21, 2023 at 7:07 PM Daniel Lezcano
<daniel.lezcano@linaro.org> wrote:
>
> The different thermal drivers are showing an error in case the
> get_temp() fails. Actually no traces should be displayed in the
> backend ops but in the call site of this ops.
>
> Furthermore, the message is often a dev_dbg message where the
> tz->device is used, thus using the internal of the structure from the
> driver.
>
> Show a debug message if the thermal_zone_get_temp() fails to read the
> sensor temperature, so code showing the message is factored out and
> the tz->device accesss is in the scope of the thermal core framework.
>
> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>

Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

> ---
>  drivers/thermal/thermal_helpers.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/drivers/thermal/thermal_helpers.c b/drivers/thermal/thermal_helpers.c
> index 0f648131b0b5..9558339f5633 100644
> --- a/drivers/thermal/thermal_helpers.c
> +++ b/drivers/thermal/thermal_helpers.c
> @@ -107,6 +107,9 @@ int __thermal_zone_get_temp(struct thermal_zone_device *tz, int *temp)
>                         *temp = tz->emul_temperature;
>         }
>
> +       if (ret)
> +               dev_dbg(&tz->device, "Failed to get temperature: %d\n", ret);
> +
>         return ret;
>  }
>
> --
> 2.34.1
>
diff mbox series

Patch

diff --git a/drivers/thermal/thermal_helpers.c b/drivers/thermal/thermal_helpers.c
index 0f648131b0b5..9558339f5633 100644
--- a/drivers/thermal/thermal_helpers.c
+++ b/drivers/thermal/thermal_helpers.c
@@ -107,6 +107,9 @@  int __thermal_zone_get_temp(struct thermal_zone_device *tz, int *temp)
 			*temp = tz->emul_temperature;
 	}
 
+	if (ret)
+		dev_dbg(&tz->device, "Failed to get temperature: %d\n", ret);
+	
 	return ret;
 }