From patchwork Sat Nov 19 04:20:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matt Weber X-Patchwork-Id: 9437899 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 BB4B86047D for ; Sat, 19 Nov 2016 04:21:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 940EA288D9 for ; Sat, 19 Nov 2016 04:21:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7500228FF8; Sat, 19 Nov 2016 04:21:16 +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.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 CFC2D288D9 for ; Sat, 19 Nov 2016 04:21:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752234AbcKSEVP (ORCPT ); Fri, 18 Nov 2016 23:21:15 -0500 Received: from secvs02.rockwellcollins.com ([205.175.225.241]:52317 "EHLO secvs02.rockwellcollins.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752174AbcKSEVP (ORCPT ); Fri, 18 Nov 2016 23:21:15 -0500 Received: from ptem.rockwellcollins.com (HELO crulimr02.rockwellcollins.com) ([131.198.26.125]) by secvs02.rockwellcollins.com with ESMTP; 18 Nov 2016 22:21:11 -0600 X-Received: from largo.rockwellcollins.com (unknown [192.168.140.76]) by crulimr02.rockwellcollins.com (Postfix) with ESMTP id 314BC6010F; Fri, 18 Nov 2016 22:21:11 -0600 (CST) From: Matt Weber To: linux-hwmon@vger.kernel.org Cc: Jared Bents , Matt Weber Subject: [PATCH v2] hwmon: (amc6821) sign extension temperature Date: Fri, 18 Nov 2016 22:20:38 -0600 Message-Id: <1479529238-9927-1-git-send-email-matthew.weber@rockwellcollins.com> X-Mailer: git-send-email 1.9.1 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 From: Jared Bents Converts the unsigned temperature values from the i2c read to be sign extended as defined in the datasheet so that negative temperatures are properly read. Signed-off-by: Jared Bents Signed-off-by: Matt Weber --- v1 -> v2 - checkpatch cleanup, removed space between cast and function call. truncated line over 80chars --- drivers/hwmon/amc6821.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/hwmon/amc6821.c b/drivers/hwmon/amc6821.c index 12e851a..eb53e0b 100644 --- a/drivers/hwmon/amc6821.c +++ b/drivers/hwmon/amc6821.c @@ -188,7 +188,8 @@ static struct amc6821_data *amc6821_update_device(struct device *dev) !data->valid) { for (i = 0; i < TEMP_IDX_LEN; i++) - data->temp[i] = i2c_smbus_read_byte_data(client, + data->temp[i] = (int8_t)i2c_smbus_read_byte_data( + client, temp_reg[i]); data->stat1 = i2c_smbus_read_byte_data(client,