From owner-svn-src-all@freebsd.org Thu Feb 8 09:24:24 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 85321F1245C; Thu, 8 Feb 2018 09:24:24 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 335C87CE33; Thu, 8 Feb 2018 09:24:24 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2E2E4141BC; Thu, 8 Feb 2018 09:24:24 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w189OOVv095299; Thu, 8 Feb 2018 09:24:24 GMT (envelope-from rpokala@FreeBSD.org) Received: (from rpokala@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w189OOtd095298; Thu, 8 Feb 2018 09:24:24 GMT (envelope-from rpokala@FreeBSD.org) Message-Id: <201802080924.w189OOtd095298@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rpokala set sender to rpokala@FreeBSD.org using -f From: Ravi Pokala Date: Thu, 8 Feb 2018 09:24:24 +0000 (UTC) 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 X-SVN-Group: stable-10 X-SVN-Commit-Author: rpokala X-SVN-Commit-Paths: stable/10/sys/dev/jedec_ts X-SVN-Commit-Revision: 329015 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Feb 2018 09:24:24 -0000 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); }