From patchwork Mon Jul 3 04:28:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tom Levens X-Patchwork-Id: 9821919 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4495F60237 for ; Mon, 3 Jul 2017 04:29:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 27B752823D for ; Mon, 3 Jul 2017 04:29:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1A356283C5; Mon, 3 Jul 2017 04:29:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B3D172823D for ; Mon, 3 Jul 2017 04:29:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750972AbdGCE3O (ORCPT ); Mon, 3 Jul 2017 00:29:14 -0400 Received: from mail-eopbgr00043.outbound.protection.outlook.com ([40.107.0.43]:26624 "EHLO EUR02-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750776AbdGCE3K (ORCPT ); Mon, 3 Jul 2017 00:29:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cern.onmicrosoft.com; s=selector1-cern-ch; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=IWiKVLiW0iXcrKcALsqm0/POKdBzDP1akWact9U4HNY=; b=gECPdoNuhC3joLA1wHbnjyt60U9Li29U6jc3FOTk8gbcP35NaAXQtbRBQhNycURYtR3610TFvVrdxeO3o5OSxTJ4HBXcR1ZFbND5xiDdn21bDuicxyvByaG4QuIdZhzGuOORifZ6raoZeXG/1jZHiKiimXKKu8MVVkZiw0hXf/0= Received: from AM5PR0601CA0026.eurprd06.prod.outlook.com (2603:10a6:203:68::12) by DBXPR06MB462.eurprd06.prod.outlook.com (2a01:111:e400:9423::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1220.11; Mon, 3 Jul 2017 04:29:07 +0000 Received: from AM5EUR02FT050.eop-EUR02.prod.protection.outlook.com (2a01:111:f400:7e1e::200) by AM5PR0601CA0026.outlook.office365.com (2603:10a6:203:68::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1220.11 via Frontend Transport; Mon, 3 Jul 2017 04:29:06 +0000 Authentication-Results: spf=none (sender IP is 188.184.36.17) smtp.mailfrom=mail.cern.ch; vger.kernel.org; dkim=none (message not signed) header.d=none; vger.kernel.org; dmarc=none action=none header.from=cern.ch; Received-SPF: None (protection.outlook.com: mail.cern.ch does not designate permitted sender hosts) Received: from cernmx.cern.ch (188.184.36.17) by AM5EUR02FT050.mail.protection.outlook.com (10.152.9.252) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.1220.9 via Frontend Transport; Mon, 3 Jul 2017 04:29:03 +0000 Received: from pcbe13573-vm.dyndns.cern.ch (128.141.154.213) by cernmx.cern.ch (188.184.36.24) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 3 Jul 2017 06:29:01 +0200 Received: from pcbe13573-vm.dyndns.cern.ch (localhost [127.0.0.1]) by pcbe13573-vm.dyndns.cern.ch (8.14.7/8.14.7) with ESMTP id v634T1Ao006102; Mon, 3 Jul 2017 06:29:01 +0200 Received: (from tlevens@localhost) by pcbe13573-vm.dyndns.cern.ch (8.14.7/8.14.7/Submit) id v634T0X0006101; Mon, 3 Jul 2017 06:29:00 +0200 From: Tom Levens To: Rob Herring , Mark Rutland , Jean Delvare , Guenter Roeck , "Mike Looijmans" CC: , , Subject: [PATCH v3 1/3] hwmon: ltc2990: refactor value conversion Date: Mon, 3 Jul 2017 06:28:58 +0200 Message-ID: <1499056140-6064-1-git-send-email-tom.levens@cern.ch> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:188.184.36.17; IPV:NLI; CTRY:CH; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(39850400002)(39400400002)(39860400002)(39410400002)(39450400003)(39840400002)(2980300002)(428002)(189002)(199003)(50986999)(356003)(50226002)(87636003)(189998001)(42186005)(7636002)(305945005)(8676002)(4326008)(101416001)(23676002)(33646002)(5660300001)(626005)(105586002)(508600001)(2870700001)(106466001)(36756003)(47776003)(74482002)(5820100001)(50466002)(54906002)(2906002)(38730400002)(8936002)(86362001)(4720700003); DIR:OUT; SFP:1101; SCL:1; SRVR:DBXPR06MB462; H:cernmx.cern.ch; FPR:; SPF:None; MLV:sfv; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; AM5EUR02FT050; 1:YgSPxFi2jWCmmtQFl+xefrV6hjYSYzCIYgmii8jjIYi7pD4GOu4+IweQ5+AFx+0M7iTm4nXeWnqAewQBPBYuxGpL3aDlzUNGGyEW7Vgz0BaNNWB7ezxNN3gsF+hVkHJ19g6fteK4ALxPmn1KWmfv9qaZDlEqXq6Ngx4vhBtuoCB7ZWX/8ZZAHlpxsBHkvyibjC6PirjvWTczXHMOb9wc5RGDzTqlcsKJ+hgelHfF1y70PhUoH3PPHNo/GMpafkrW010gNxTtkniN5bML13p+1Di3O6QOcIvAqj8g2NghrR8EPbDbF1zF2s85GCVxY0nkACNxkN2O1gZYrUw1SoC/nfqh2hLhCpl7aG0e7fcVL/P0boXHNw0mr6uwdtAFrV+Z4wNuJWOw+86crVVIQi6UbLmzrb3L8BelzAlpBByfK/TvSV4ismt+oPoFP3c7iZflsi+VXRmlNd5aAZQxvGpm3Gl+JDxokMRD776BeeyvyvLTRSJqkzkPq8KZ3TEMnzQacLcfw9TBMluqt5hqU6/aLQeOux2qosSbw5fTJHDXnL6mt+H6mff2qEB9uRtfK5r9Afb9JyudMiFUu1O6JCGe5kTtX/MJJo6npmqFt7btlOUUKQLQSdzI89BJdMIll33SitqmXQJEIJwkdPPxj8h66wv96bwsje547mZANNV6fwxrrNcJrgBtuNA5gf+W31s3gMbr3nqeZuI+BBfnpQGl+Grm6Kv23NBRVCZKplrbm3gIMszpZzqILb1+jLElvyCcezN7KX5mvasYDUC6NEWlIxMFmuJV/U2+zEV0qMspWBranqA70FbFyTJyYfBRd6P4xPWPtJvZMHeRcQHwYpfQO8nsdaYuATrQHu0Anw1uZ3343FeupYaH6xWQ3cak+NFpCNcXNF/8JfuFVadPonxTkk7OWqayro3PO8P2X7HCKX ZsCiWSe8XOqQaWcGm0wPQV X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0c2ce171-dc68-4c34-5aa3-08d4c1cc0a8c X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254075)(300000503095)(300135400095)(2017052603031)(201703131423075)(201703031133081)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:DBXPR06MB462; X-Microsoft-Exchange-Diagnostics: 1; DBXPR06MB462; 3:dY7tYv3cy9hZ0QA86cFJUtENqNvHjXahRR2ZZ4b4a2BKaYBocp60L76HNW/qvUNHLDJusbV843vGV6vqpkOJg+A5bj3U05AfxBQGa8lkf4JyGusl8GhPkLR7exkVsEykTAUqbeCTO0JSQ89EXx5bUswCjl8wUte31KraPmsH5MqzAwj9sb+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k0o4tvED3CWexwn3LIKx3BdYNMtKXBSnATbaYsraPvk5L/ZiO7Xmx6bpcZvbHfuvnZUFfk3dEkPcgjUjllXFIAaetUYbqaSuMy4CwqNaCcSXg/CnTxLEhsd9jGtggtJViRKhtRiFbDk6tvgj79zCoB4AbhMHR/nzHtEJrjXlmMC1I7vU0GPrI8OUc4UaB91SCvUmtC/RqmLHeik8q+E1ghl5Sm7TszmGQPO0xKI+Dy4GReHiqCQag6CpqZ1TnSoe5P5HN7qFY69syCoIiLnT1l5Zci7NFRQgygBw8o+ZZSSPqtbtYvQZE/2E1+ljF/0i8KvEM8w4FN26Kyg6MGsyDlLJaqi83zYHUt9jw== X-Microsoft-Exchange-Diagnostics: 1; DBXPR06MB462; 20:LsXoCaqUXhaftJYHn+jvcNTbhVl2b2eZqtmZ3i6mBE36FwdHC88UTC+cqvEVIA/wdl5CVV1uaJynOMt1q74tnQFhr4tnGMihQQgubO1ISxaeLmTEUy2YNk7pAwHY+Ttk5TKAI+Vd7hlGgZYXGUknpymdRST5KC8WZWEoicM32OOD9PdiOPSg150qsC4qylYzFgTRDjz8uYjZgRIPMODpDmF5IInE4Nka4LYXpZf/RhRfBi3kuYUujIAClQvHTx/NI3K3iBtGxNQtzZmK60GE4ZQQIL8u0w1Pm7Qv7BtItRNIkt9St3oZRz7AfvdXYdwdxTc2IGGbVA9vNRvc71ipdxUnRAZZI0iKfE6oPpIqRdfGR9TagpY1Ku8YtW2aKTg0X5cjMDv1KW6S21+kMk5SWc5/vy7fnZrOF0u9wz5+Y4ENeHVb7r9WlCt6h/1qO5Jkutc9Qe2t+caDEvTmPj+A7GPN01cU8R7Y17NncxGf9LIyWbiwXLTtXy3EHm5ZHls5 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(236129657087228); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(13018025)(8121501046)(5005006)(13016025)(100000703101)(100105400095)(93006095)(93003095)(10201501046)(3002001)(6041248)(20161123564025)(20161123558100)(20161123560025)(20161123562025)(20161123555025)(201703131423075)(201702281528075)(201702281529075)(201703011903075)(201703061421075)(6072148)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:DBXPR06MB462; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:DBXPR06MB462; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtEQlhQUjA2TUI0NjI7NDordzZvSDhvN1RQK0NtTWJ2SVBYL3JhSXF1MDE1?= =?utf-8?B?Tnl1aytIOWNlK1FGSUw0UlB3dHNpaWJsN2lNTTlEUUJHTUw5UTE4bHB2RWhY?= =?utf-8?B?ckhZK0VwbVcvZm1MSGNPYkNUT1I0UzNLSFlza1RPaG96ZFQwZXE1YnhmUi9W?= =?utf-8?B?VmlSdnRjUWhNWC80UGlLVVlLQ3hkWTFyWmhZYlB0NVNyWXlNUmRBQldvR1A4?= =?utf-8?B?Umx0aFdncDlSUjlvN1hzM3pnK1JMcnJrQ2pyK20wYVpDSW10dEtRZXlVRHJx?= =?utf-8?B?eHhEZzdtTVlud0ZkcmMxZjBISS9mQi8zejRtcTNMOHh0ckNvM0ppM29Bd24x?= =?utf-8?B?UUtmdVNhMEJiVi9NSDJHN1lIcTF0RzJzMVJ3Y1gzdE5sS3R3QTBtTWxTRlE0?= =?utf-8?B?WEJTUS9wRUZYZnI0QmQ4ZUFJZEFrSFppbm9LeTV2ZlYxaEFPK09EeGZzbDVJ?= =?utf-8?B?cjlRS1RFNkthTkFsM09oLzUrV2dXNkQ1bldMTFhya3NUWmdLMWFFMXhnczdO?= =?utf-8?B?YTdXM2swOXN1dCtRN3dXdUtqdTRBVDFhdDVpNjBSYU5vMkIyUENZbXR1cy9p?= =?utf-8?B?ZTlTQlZNa3BnWFY3MEUyTHlsUjN5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ny8xJOqGqU+CGi6+uuh6qzUFhg9W2bA4R1IBze/9J+w= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DBXPR06MB462; 7:DHTT1zYA58SU9vB+Z/Hp0iaiqcDiyesHSzFYK1KvMU22HSUUd8iX9b+EwHQ08K7Q8JZz19BvV3Q00mNC2kMB2tR0qZUDd9k2SXgArDbOZ9GJvXB6NpFhHkgIoVtLBkYZSIVgyXRmWQMG2P/RE9KBUeoPAQdYaroKvYZjx4+Jo7MbITpVTeKtbYiVvvrh3VAtJ+M38PIGGDcA+6rSshEYLNvJJ07e8Vq0DvjkvDV5tjlfEm3PeZbJzaz8rInbY2iUt4NhUtSDqzVWAm8ISrpmUF3nGAZaUbczvZe9iOuIN4kfrt8+vel1Axd4/LPYXeOfPrSp6OqbSLjCv/ReypunBQ1b/S4b70bD1wkT+PkyhcIszqg90BzYaq3cBmXB7Dm2xjPaEJSRAKAJD3hbVpv+m1nW92QbI+K/34yJIHV1t34/7/swROxVz1BrbRFWEnH9pUNPbNPtuMEsSNP9E64CX4TRNDZXIINpeAPFbGoTg7y1HaDjuefaTwJP/h1ytD8Pq98toIPKrf7wEWX8M/3C/qgewKsZRrT+uNcvVqSCqkYjtg4YG4bVhPiAL0saKRvfgpcgGY2vkEN25UJ6QWjKT/T3GyHC4y30/OYguRDDUaDJ++gT3mr+6/K1ZRWKPs91RwEiTvZTDiVmOkGd5AikWZw05c5hKf2lTvdtDNFYacMJlBf/PmZ1Ku2ctjLSVZJPogwvaLxZceJIhNZt0nBUq7hKBpqU6CG/EaV33StlrU/mmNyJaxF6k77JcD+vo9Ky7ERLawUNIaGDN36SjBypnzNxIZSbgC5M89OChDPr8fA= X-OriginatorOrg: cern.ch X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jul 2017 04:29:03.1605 (UTC) X-MS-Exchange-CrossTenant-Id: c80d3499-4a40-4a8c-986e-abce017d6b19 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=c80d3499-4a40-4a8c-986e-abce017d6b19; Ip=[188.184.36.17]; Helo=[cernmx.cern.ch] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBXPR06MB462 Sender: linux-hwmon-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Conversion from raw values to signed integers has been refactored using bitops.h. This also fixes a bug where negative temperatures were converted incorrectly. Signed-off-by: Tom Levens --- drivers/hwmon/ltc2990.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/drivers/hwmon/ltc2990.c b/drivers/hwmon/ltc2990.c index 8f8fe05..e320d21 100644 --- a/drivers/hwmon/ltc2990.c +++ b/drivers/hwmon/ltc2990.c @@ -11,6 +11,7 @@ * the chip's internal temperature and Vcc power supply voltage. */ +#include #include #include #include @@ -34,15 +35,6 @@ #define LTC2990_CONTROL_MODE_CURRENT 0x06 #define LTC2990_CONTROL_MODE_VOLTAGE 0x07 -/* convert raw register value to sign-extended integer in 16-bit range */ -static int ltc2990_voltage_to_int(int raw) -{ - if (raw & BIT(14)) - return -(0x4000 - (raw & 0x3FFF)) << 2; - else - return (raw & 0x3FFF) << 2; -} - /* Return the converted value from the given register in uV or mC */ static int ltc2990_get_value(struct i2c_client *i2c, u8 reg, int *result) { @@ -55,18 +47,16 @@ static int ltc2990_get_value(struct i2c_client *i2c, u8 reg, int *result) switch (reg) { case LTC2990_TINT_MSB: /* internal temp, 0.0625 degrees/LSB, 13-bit */ - val = (val & 0x1FFF) << 3; - *result = (val * 1000) >> 7; + *result = sign_extend32(val, 12) * 1000 / 16; break; case LTC2990_V1_MSB: case LTC2990_V3_MSB: /* Vx-Vy, 19.42uV/LSB. Depends on mode. */ - *result = ltc2990_voltage_to_int(val) * 1942 / (4 * 100); + *result = sign_extend32(val, 14) * 1942 / 100; break; case LTC2990_VCC_MSB: /* Vcc, 305.18μV/LSB, 2.5V offset */ - *result = (ltc2990_voltage_to_int(val) * 30518 / - (4 * 100 * 1000)) + 2500; + *result = sign_extend32(val, 14) * 30518 / (100 * 1000) + 2500; break; default: return -EINVAL; /* won't happen, keep compiler happy */