Bug 152792 - [acpica] [patch] move temperature conversion macros to a common header
Summary: [acpica] [patch] move temperature conversion macros to a common header
Status: Closed Not Accepted
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 1.0-CURRENT
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-acpi (Nobody)
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2010-12-02 21:10 UTC by Mark Johnston
Modified: 2019-01-18 22:54 UTC (History)
5 users (show)

See Also:


Attachments
file.diff (3.10 KB, patch)
2010-12-02 21:10 UTC, Mark Johnston
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.