Bug 152792

Summary: [acpica] [patch] move temperature conversion macros to a common header
Product: Base System Reporter: Mark Johnston <markjdb>
Component: kernAssignee: freebsd-acpi (Nobody) <acpi>
Status: Closed Not Accepted    
Severity: Affects Only Me CC: gonzo, imp, jhb, jkim, markj
Priority: Normal Keywords: patch
Version: 1.0-CURRENT   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description Mark Johnston 2010-12-02 21:10:09 UTC
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:
Comment 1 Mark Johnston 2010-12-04 18:16:54 UTC
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
Comment 2 John Baldwin freebsd_committer freebsd_triage 2015-04-06 18:20:45 UTC
jkim@, I think this patch is probably fine, what do you think?
Comment 3 Jung-uk Kim freebsd_committer freebsd_triage 2015-04-06 20:06:32 UTC
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.
Comment 4 Eitan Adler freebsd_committer freebsd_triage 2018-05-23 10:27:22 UTC
batch change of PRs untouched in 2018 marked "in progress" back to open.
Comment 5 Oleksandr Tymoshenko freebsd_committer freebsd_triage 2019-01-18 22:08:35 UTC
Is this PR still valid? Does patch need rework before it can be committed?
Comment 6 Warner Losh freebsd_committer freebsd_triage 2019-01-18 22:52:01 UTC
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.
Comment 7 Mark Johnston freebsd_committer freebsd_triage 2019-01-18 22:54:36 UTC
(In reply to Warner Losh from comment #6)
Ok.