There are a few drivers that report system temperatures through sysctls using the "IK" format. This format expects values that are converted into multiples of 0.1 degrees Kelvin, and since most sensors report values in Celsius, they have to be converted. The drivers (acpi, coretemp and amdtemp) all have their own macros for doing this. This change puts a set of macros in sysctl.h for all drivers to use; moreover, they allow userspace programs to read temperature sysctls without having to redefine the macros yet again. Fix: Attached is a patch against HEAD (csup'ed about 2 days ago). Patch attached with submission follows:
Oops... TZ_CEL_TO_KEL should be replaced with TZ_CTOKELV in the patch. Not sure how that got into the patch. -- Mark Johnston markjdb@gmail.com
jkim@, I think this patch is probably fine, what do you think?
Generally, I am okay with the change. However, I don't like TZ_KELVTOC* macros. These stuff should stay in acpi_thermal.c. At least, TZ_KELVTOC() macro should not be moved. Also, I don't like TZ_* prefixes. These macros should be prefixed with something else. Actually, I am not even sure whether sysctl.h is the right file to put these misc. utility macros.
batch change of PRs untouched in 2018 marked "in progress" back to open.
Is this PR still valid? Does patch need rework before it can be committed?
I think that we shouldn't commit this. The reason is that 0K is -273.15C. The .15 always throws people for a loop. Some devices assume it's -273.0, others -273.1 others -273.2 and others -273.15. That makes having a common macro hard. Although the exact conversion is known, how the device rounds is a device-specific thing.
(In reply to Warner Losh from comment #6) Ok.