Re: thermal driver patch

From: Steven J Abner
Date: Thu Sep 01 2022 - 08:14:27 EST



On Thu, Sep 1, 2022 at 05:59, Daniel Lezcano <daniel.lezcano@xxxxxxxxxx> wrote:
Could it be related to this bug?

https://bugzilla.kernel.org/show_bug.cgi?id=201761

Is it possible to give the thermal zone 'type'

Did verify that that my thermal_zone0 is my wifi:
used lm-sensor and cat /sys/class/thermal/thermal_zone0/temp
along with wifi load to heat to temps different then others to check outputs.
The above mentioned bug page could have lead to this, I can't say or track.

Prefix the following with I'm not an expert, just info provider:

My guess is not supposed to be calling function during initial kernel loading, based on following:

from thermal_core.c:
18:
#include <linux/thermal.h>

397:
static void update_temperature(struct thermal_zone_device *tz)
{
int temp, ret;

ret = thermal_zone_get_temp(tz, &temp);
if (ret) {
if (ret != -EAGAIN)
dev_warn(&tz->device,
"failed to read out thermal zone (%d)\n",
ret);
return;
}

mutex_lock(&tz->lock);
tz->last_temperature = tz->temperature;
tz->temperature = temp;
mutex_unlock(&tz->lock);

trace_thermal_temperature(tz);

thermal_genl_sampling_temp(tz->id, temp);
}

from linux/thermal.h:
429:
static inline int thermal_zone_get_temp(
struct thermal_zone_device *tz, int *temp)
{ return -ENODEV; }


compiler should then read:
static void update_temperature(struct thermal_zone_device *tz)
{
int temp, ret;

ret = -ENODEV;
if (ret) {
if (ret != -EAGAIN)
dev_warn(&tz->device,
"failed to read out thermal zone (%d)\n",
ret);
return;
}

however did find with extra search:
in /drivers/thermal/thermal_helpers.c:
78:
int thermal_zone_get_temp(struct thermal_zone_device *tz, int *temp)
and
115:
EXPORT_SYMBOL_GPL(thermal_zone_get_temp);


so is this bootup vs system hand off?
where bootup call thermal_zone_get_temp() shouldn't occur?

Steve