From patchwork Thu Nov 17 12:10:14 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tom Levens X-Patchwork-Id: 9435503 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 152F460471 for ; Thu, 17 Nov 2016 23:43:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 053222962E for ; Thu, 17 Nov 2016 23:43:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EBD5E296FD; Thu, 17 Nov 2016 23:43:58 +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 26B3B2962E for ; Thu, 17 Nov 2016 23:43:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751161AbcKQXn5 (ORCPT ); Thu, 17 Nov 2016 18:43:57 -0500 Received: from mail-db5eur01on0070.outbound.protection.outlook.com ([104.47.2.70]:13096 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750849AbcKQXnz (ORCPT ); Thu, 17 Nov 2016 18:43:55 -0500 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=i+QmYjaLDxl6KZSriBlD6ivs9awo2lwqlrklf8yZvog=; b=oMfi5DsPnEDkH5SMuYQEoi1gxnc5KWW7KFwVDq26X1Y8gp2j0Lzjmhv41kNdeDXTkbwgp4T4TTlLXXkPxmp16XAOYJgfX74iknTEDOZKIMaPDHk6EKKde2+n6FlVYdv+wGkqDNVZ+kttyxV5t+HW61Ycx7InOgL75I4AG8qyEpA= Received: from HE1PR0601CA0010.eurprd06.prod.outlook.com (2a01:111:e400:c513::20) by AM3PR06MB1155.eurprd06.prod.outlook.com (2a01:111:e400:5873::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.721.10; Thu, 17 Nov 2016 12:11:03 +0000 Received: from AM1FFO11FD004.protection.gbl (2a01:111:f400:7e00::193) by HE1PR0601CA0010.outlook.office365.com (2a01:111:e400:c513::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.734.8 via Frontend Transport; Thu, 17 Nov 2016 12:11:03 +0000 Authentication-Results: spf=none (sender IP is 188.184.36.16) 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 CERNMX14.cern.ch (188.184.36.16) by AM1FFO11FD004.mail.protection.outlook.com (10.174.64.86) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.721.5 via Frontend Transport; Thu, 17 Nov 2016 12:11:03 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:; UpperCasedChecksum:; SizeAsReceived:1061; Count:13 Received: from pcbe13573-vm.dyndns.cern.ch (128.141.154.157) by cernmxlb4.cern.ch (188.184.36.24) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 17 Nov 2016 13:10:41 +0100 Received: from pcbe13573-vm.dyndns.cern.ch (localhost [127.0.0.1]) by pcbe13573-vm.dyndns.cern.ch (8.14.4/8.14.4) with ESMTP id uAHCAffN012513; Thu, 17 Nov 2016 13:10:41 +0100 Received: (from tlevens@localhost) by pcbe13573-vm.dyndns.cern.ch (8.14.4/8.14.4/Submit) id uAHCAda8012512; Thu, 17 Nov 2016 13:10:39 +0100 From: Tom Levens To: CC: , , , , , , Tom Levens Subject: [PATCH v2 1/3] hwmon: ltc2990: refactor value conversion Date: Thu, 17 Nov 2016 13:10:14 +0100 Message-ID: <1479384616-12479-1-git-send-email-tom.levens@cern.ch> X-Mailer: git-send-email 1.7.1 MIME-Version: 1.0 X-IncomingHeaderCount: 13 X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:188.184.36.16; IPV:NLI; CTRY:CH; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(7916002)(2980300002)(428002)(249900001)(189002)(199003)(2906002)(626004)(7846002)(305945005)(7636002)(106466001)(5660300001)(48376002)(50466002)(36756003)(4326007)(74482002)(86362001)(87936001)(50226002)(47776003)(246002)(6916009)(110136003)(8676002)(8936002)(2351001)(42186005)(6666003)(107886002)(4001430100002)(189998001)(50986999)(33646002)(5003940100001)(92566002)(356003); DIR:OUT; SFP:1101; SCL:1; SRVR:AM3PR06MB1155; H:CERNMX14.cern.ch; FPR:; SPF:None; PTR:cernmx14.cern.ch; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; AM1FFO11FD004; 1:eciJpKeoEhYXINCLw1/K9ShFti4aybLqm5sHJgky30LL2J3hltb49c8pFpZMs6R/dTRFqcnKXkJjriWu9ZHaLgzNKCQmpDzk80FHbvrqlAcZ0ZzxTpUfvy2EMBATOccFbU/xv5U86BEt6MXmqiqAE0qIzv+2AUntt7gfYzy8yJGDCG55/QFnb0Q95l5xztnT9Bq3M4m2PjxE4V0gbBjKBk4ZiVEbIvI+weNQydxYxpD6QS8GzTxHFWOnKXCZFk4ORFagPCcXbzb+KMg9aymr/DF6CAVMIPym084IVjj3KfeZn6xOpadRpjGA3OkuOeJ6QKBBsC6toXSCC1psfwqclw++e7Kd2101jQFxFs/jqgiIBd0JpedwcEwa1G2epD7ztRnOmzAdwFY/G+EKbUFpjW4F8GgrD5gsW6tJoyT1yL+rZJd1lEgWzwTW/EeewX/thnB3dje72i/CLofRegDrkQw7dejTauhwI0mxCM4asmIhY6tUibw0IrTwzz9wm5AtZFr2icbsrbOmpCvZXWCcvkqKFXuc7udFoFwy4yr+rbAq8OZqtT53lIkxnZ/3Ub0kuxhEpmIbP2/TIOFqKyoI9w== X-Microsoft-Exchange-Diagnostics: 1; AM3PR06MB1155; 2:Qao2t2k91S7pQfNdEqeflD6DWD3LcF/dgN66OFD3nidAeHZ4IZx6f7WxcqvFxDo4jAZpOYgrag6TOUKljv5G6hy9sLW+R8x1sOU4sgEdAltTooC/Mv/0oBu4hYSXkQ/JKkQtjyA0Q0e6TicamUXKzeNej0ciwkqn4JJDPbCPym8=; 3:q4OFfAstVJJobFfcDOCoTPB/4lvU7cpEioOVXb2cCSMdaA9B+5WIBK9G8MJCNHI14MunPIDP4dXELPwl8q9EAdqEhUmmb3xYO44VYllEcDj6dAXZhL/nZwdMMbZPgHbjx9NX8/S7FN/ikv1QgrnkD2w1EiQ+ALl09VEVV1jNEsNib4dHn1LU5Nquv1GE1LnxyiyaSo+r7FcyaJoJHGFoAdin4odBSnLpzASMuoKjBLVnwv+w+6mfBUblj72vMoEoi0GXdT2gM6fLrD1tMAtQXw== X-MS-Office365-Filtering-Correlation-Id: 2a6203d8-41ae-44ee-6b7a-08d40ee2cd63 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:AM3PR06MB1155; X-Microsoft-Exchange-Diagnostics: 1; AM3PR06MB1155; 25:NDztaFCMthtG+fIlphpGAFtDFLEuzxgYThXDX+HRQW+OKKAoohvwX3fQGKQp1lkezez41t8K/2FiPM7ULmdJzfpEWwICowWADh1mhNlssXXAX/W2qkwnU/OteXhw87pR/WNeW5Ng9xyegJV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ydFQYSSCNrZWrIASncQGVajbJZDtKBkVAGXTAJQnvkWhrcvu7xcSOWP8RsWml2+F0TWvt/wrdX5Z41rFUa1nZ9IyAiXerN/Eb+gWiThWwCKrbPaBAu8AqqvKDRgRyF1787yDvKCc3EsbaFopvfOAw3fG79t5260RC/DWLNLzt99bouLrtxOYyCNAAI21IZAUDm5HGDfdJATlirVoeHxtS06kUW0mtzJyiW/cZuqMuxUkjlFSSlvYLv/mjqi3Rd3gAh/LAtTtNyQL1VssWfTc5Utn5/RRkEdfDYmd24p+NKI2o1UhsoRlTzKNwQ5SrCHjeq5W4OTwJkXF4erO7/lPkx9dBnBBKsFpV1RiSaB+2Md/o7TaV73sQAta9ytDHcX9EchjDdQCMo95S1VnmmMWBV7fEVY4eMmzwp/jxiksFxP3EsVX0xK5ka41/D/PhD6dH+29y+3Cxf7LunonC+h1ejd X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(20558992708506); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6060326)(6040281)(601004)(2401047)(13023025)(13024025)(13016025)(5005006)(13018025)(8121501046)(3002001)(10201501046)(6061324)(6041223); SRVR:AM3PR06MB1155; BCL:0; PCL:0; RULEID:; SRVR:AM3PR06MB1155; X-Microsoft-Exchange-Diagnostics: 1; AM3PR06MB1155; 4:EGFm4KTJa/BuSn5zciQopVj+XjS2FbBzjUVxeD8XFL/t7GnLBVah8V2YGN1020YOxiPmpXXZa+w002fe83mV9DGM4+FdmFdhEr87tGtcM1SwborWW4eC9n7rILjBMHgT+w3XElSm85j/+0VHAotRYcxLW33ZXfCLRbQIBXTgpkTN8h8itPcoaQQdb+gcROuUN9mSIMs49GnZ9PfpkbsU9QXobI7nHtTlVQkhQ1GqKHXDV5GeXhw5mtVCOBQQHYUYzI9gYqMZ8RgmiUwmUaHHGl7nY614QlwT4rxnV9O2sS6aYEUJXODG62EV9AhSLNgNBFJxDbu+c9RyLrDvxSk28TcEN/XIFD9Loq00UKi93g/jvZ5lzqMHsdpJ6YoChauwmnrDZNc6NZLoxTK6/rejSb0qxhzGGZlvzgu1yYO/s7CC9+s6Psc6wYp0lhOpy0E3PmyARHxMmKkKt6Km3tmEwwkShfX+gHCeJ5p/7CnfLW9JxZcKWiD91dPGGAByYd9fgr5gd1kT61W5+4dDjIR4mOJYkt3wPZrB0Z/++KgVp8mqf8RZSoBBjQCwBFCp+2sGwmOdpoQ8/FlL4aB133rKRw== X-Forefront-PRVS: 01294F875B X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM3PR06MB1155; 23:gngvkKnU4FUhuB75xCRedb2mK5gxudbz9R+PB6D2n?= =?us-ascii?Q?4561Pqd8UQZy2PO2TcbSJpa0EFqfYx7GsvIThgMEVpaW49gEcGmYfDMb+TAF?= =?us-ascii?Q?z6ab86cu0mTH/nV3l8XcGr9Xzs9RTPDAsfynQ+ZfDDgl+H+NuOJ4jJ2CAJJ8?= =?us-ascii?Q?Z/VJ9b8wbhHZjEHVPkS6KwAodzPE0gYZbZMenmquAg06pyZNDzOhE61xqO21?= =?us-ascii?Q?hhJN9vjr2j0qnqolwl1PLIjjUk3wJkoMnS4iiK0gOa/jCw97FsAH08fxiR26?= =?us-ascii?Q?RyfMhALzI+Uajy7siKx+SYoyjMB0grrgkXpZda3MiMMAUp6TNvsvgF5mJVMY?= =?us-ascii?Q?EY2ZEdQ9Ss8zyi1nDEa24MbYGrmf7vnUOWy0tOQpK4wR3V2Xkl9KKkW50BCV?= =?us-ascii?Q?maReD5xAPYp3UHEKWEbT029syStnxy0KR9Zn53goRq5Tu/AzkyT3IEyqRpCy?= =?us-ascii?Q?HkFCE/Y96/WkjvAfMlkdag/We0mFny5yjGET+LcF26pl6YHqg8mq56sWOUfv?= =?us-ascii?Q?SODnB7YBSLsnzGKNg7CTQaWs+VOGEqSPucjVbpb+jx83F8i3aKb/2IzYjba9?= =?us-ascii?Q?wHUl9R3bBqh3invbfemCfDlcjWUC/EbcoGWUKPkQ3djb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NTGTxjXjt2Cc76XAEEs0z4VFVKcolHSS8K/JYBxPooB6ZGrSKbp6b/DrL/p4o0q6lWYeQxnzTqcDc9H7fwWqRHfQVYo= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; AM3PR06MB1155; 7:sfWvMHp1BUoS1WiXjAB3WePb63pFm0G+9Taap/xFLv+A5D3qLbpL1C9l9HgL6yBJQfFpa0D0wpOXXUzF+NrsIzay04uSzvl1ZOOVDbH564xKEC255vBsjXgGbOvw65bWQH7Kl4Tp6R4iVBTxorkG8NcpzmB6CdHI8Iwa1rxprbVbVZMIT9cQsvSB4gihQVB3fhAXY9uvKuIbdv6I/ioU8ylLG2OGj/OqdOEEUnZ5I0Pdj917zAmtw3WhDhcRzstDN7ScAqzLw5IAEXKL9If9Xsksc/mzL9Dyh84KY1VWQORnO9i8g5ITvEO0dcr7bnNe9n3YN4T1lE5gs/pgCpyNUTUfFv0XjE1gaHFFLHwKPec= X-OriginatorOrg: cern.ch X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Nov 2016 12:11:03.4517 (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.16]; Helo=[CERNMX14.cern.ch] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM3PR06MB1155 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 the macros in bitops.h. Signed-off-by: Tom Levens --- drivers/hwmon/ltc2990.c | 27 ++++++++++----------------- 1 files changed, 10 insertions(+), 17 deletions(-) diff --git a/drivers/hwmon/ltc2990.c b/drivers/hwmon/ltc2990.c index 8f8fe05..0ec4102 100644 --- a/drivers/hwmon/ltc2990.c +++ b/drivers/hwmon/ltc2990.c @@ -9,8 +9,12 @@ * This driver assumes the chip is wired as a dual current monitor, and * reports the voltage drop across two series resistors. It also reports * the chip's internal temperature and Vcc power supply voltage. + * + * Value conversion refactored + * by Tom Levens */ +#include #include #include #include @@ -34,19 +38,10 @@ #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) +static int ltc2990_get_value(struct i2c_client *i2c, u8 reg, s32 *result) { - int val; + s32 val; val = i2c_smbus_read_word_swapped(i2c, reg); if (unlikely(val < 0)) @@ -55,18 +50,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 */ @@ -79,7 +72,7 @@ static ssize_t ltc2990_show_value(struct device *dev, struct device_attribute *da, char *buf) { struct sensor_device_attribute *attr = to_sensor_dev_attr(da); - int value; + s32 value; int ret; ret = ltc2990_get_value(dev_get_drvdata(dev), attr->index, &value);