Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 8 Feb 2018 09:24:24 +0000 (UTC)
From:      Ravi Pokala <rpokala@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r329015 - stable/10/sys/dev/jedec_ts
Message-ID:  <201802080924.w189OOtd095298@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rpokala
Date: Thu Feb  8 09:24:23 2018
New Revision: 329015
URL: https://svnweb.freebsd.org/changeset/base/329015

Log:
  jedec_ts(4) uses a sysctl format specifier of "IK4", to indicate that it
  reports milliKelvin. However, sysctl(8) on stable/10 only knows about "IK",
  without a numeric suffix, which represents deciKelvin.
  
  Adjust the format specifier, and round the temperature value reported.
  
  Reviewed by:	avg
  Sponsored by:	Panasas
  Differential Revision:	https://reviews.freebsd.org/D14055

Modified:
  stable/10/sys/dev/jedec_ts/jedec_ts.c

Modified: stable/10/sys/dev/jedec_ts/jedec_ts.c
==============================================================================
--- stable/10/sys/dev/jedec_ts/jedec_ts.c	Thu Feb  8 07:52:30 2018	(r329014)
+++ stable/10/sys/dev/jedec_ts/jedec_ts.c	Thu Feb  8 09:24:23 2018	(r329015)
@@ -192,6 +192,10 @@ ts_temp_sysctl(SYSCTL_HANDLER_ARGS)
 	if ((val & 0x1000) != 0)
 		temp = -temp;
 	temp = temp * 625 + 2731500;
+
+	/* sysctl(8) reports deciKelvin, so round accordingly. */
+	temp = (temp + 500) / 1000;
+
 	err = sysctl_handle_int(oidp, &temp, 0, req);
 	return (err);
 }
@@ -245,7 +249,7 @@ ts_attach(device_t dev)
 	tree = SYSCTL_CHILDREN(device_get_sysctl_tree(dev));
 	SYSCTL_ADD_PROC(ctx, tree, OID_AUTO, "temp",
 	    CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, dev, 0,
-	    ts_temp_sysctl, "IK4", "Current temperature");
+	    ts_temp_sysctl, "IK", "Current temperature");
 
 	return (0);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201802080924.w189OOtd095298>