Skip to contentSkip to conversation

Thermal/int3403: Fix thermal hysteresis unit conversion

PATCH New Lan Tianyu 1 participant 1 message Apr 3, 2014 Thermal

lore
Share & tools
lore

Lan Tianyu

author
#0 lore raw

PATCH 1/1 Thermal/int3403: Fix thermal hysteresis unit conversion

Thermal hysteresis represents a temperature difference. But the original code treats it as a temperature value, Convert it from tenths of degree Kelvin to Milli-Celsius by deducing 273200. This is not right.

Kelvin and Celsius have same degree size. From temperature difference view, the conversion between tenths of degree Kelvin unit and Milli-Celsius unit is just to multiply 100.

---
 drivers/thermal/int3403_thermal.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/thermal/int3403_thermal.c +7 -1
index 1301681..e93f025 100644
@@ -62,7 +62,13 @@ static int sys_get_trip_hyst(struct thermal_zone_device *tzone,
 	if (ACPI_FAILURE(status))
 		return -EIO;
 
-	*temp = DECI_KELVIN_TO_MILLI_CELSIUS(hyst, KELVIN_OFFSET);
+	/*
+	 * Thermal hysteresis represents a temperature difference.
+	 * Kelvin and Celsius have same degree size. So the
+	 * conversion here between tenths of degree Kelvin unit
+	 * and Milli-Celsius unit is just to multiply 100.
+	 */
+	*temp = hyst * 100;
 
 	return 0;
 }
Signature · 1 line
1.8.4.rc0.1.g8f6a3e5.dirty