Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

thermal/drivers/bcm2711: Don't clamp temperature at zero

The thermal sensor on BCM2711 is capable of negative temperatures, so don't
clamp the measurements at zero. Since this was the only use for variable t,
drop it.

This change based on a patch by Dom Cobley, who also tested the fix.

Fixes: 59b781352dc4 ("thermal: Add BCM2711 thermal driver")
Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Link: https://lore.kernel.org/r/20220412195423.104511-1-stefan.wahren@i2se.com
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>

authored by

Stefan Wahren and committed by
Daniel Lezcano
106e0121 2caf7396

+1 -4
+1 -4
drivers/thermal/broadcom/bcm2711_thermal.c
··· 38 38 int offset = thermal_zone_get_offset(priv->thermal); 39 39 u32 val; 40 40 int ret; 41 - long t; 42 41 43 42 ret = regmap_read(priv->regmap, AVS_RO_TEMP_STATUS, &val); 44 43 if (ret) ··· 49 50 val &= AVS_RO_TEMP_STATUS_DATA_MSK; 50 51 51 52 /* Convert a HW code to a temperature reading (millidegree celsius) */ 52 - t = slope * val + offset; 53 - 54 - *temp = t < 0 ? 0 : t; 53 + *temp = slope * val + offset; 55 54 56 55 return 0; 57 56 }