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);
 }
_______________________________________________
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"

Reply via email to