Fix the C -> K temperature conversion for the dev.cpu.0.temperature sysctl.

Previous code was discarding the last digit.

Remove the unused temperature conversion macros.
This commit is contained in:
Luiz Otavio O Souza 2015-01-15 01:05:05 +00:00
parent 02a42e683f
commit e4b6eaf73a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=277207

View File

@ -64,8 +64,6 @@ __FBSDID("$FreeBSD$");
#define MHZ2HZ(freq) ((freq) * (1000 * 1000))
#define OFFSET2MVOLT(val) (1200 + ((val) * 25))
#define MVOLT2OFFSET(val) (((val) - 1200) / 25)
#define RAW2K(temp) (((temp) + 273150) / 1000)
#define K2RAW(temp) (((temp) * 1000) - 273150)
#define DEFAULT_ARM_FREQUENCY 700
#define DEFAULT_CORE_FREQUENCY 250
@ -77,6 +75,7 @@ __FBSDID("$FreeBSD$");
#define MSG_ERROR -999999999
#define MHZSTEP 100
#define HZSTEP (MHZ2HZ(MHZSTEP))
#define TZ_ZEROC 2732
#define VC_LOCK(sc) do { \
sema_wait(&vc_sema); \
@ -1215,7 +1214,7 @@ sysctl_bcm2835_devcpu_temperature(SYSCTL_HANDLER_ARGS)
return (EIO);
/* 1/1000 celsius (raw) to 1/10 kelvin */
val = RAW2K(val) * 10;
val = val / 100 + TZ_ZEROC;
err = sysctl_handle_int(oidp, &val, 0, req);
if (err || !req->newptr) /* error || read request */