From patchwork Wed Nov 16 22:23:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matt Weber X-Patchwork-Id: 9433015 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 A36A660471 for ; Wed, 16 Nov 2016 22:34:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9319529176 for ; Wed, 16 Nov 2016 22:34:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 84F3B29179; Wed, 16 Nov 2016 22:34:41 +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 EEDF229176 for ; Wed, 16 Nov 2016 22:34:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754231AbcKPWek (ORCPT ); Wed, 16 Nov 2016 17:34:40 -0500 Received: from ch3vs02.rockwellcollins.com ([205.175.226.29]:62824 "EHLO ch3vs02.rockwellcollins.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753617AbcKPWek (ORCPT ); Wed, 16 Nov 2016 17:34:40 -0500 X-Greylist: delayed 637 seconds by postgrey-1.27 at vger.kernel.org; Wed, 16 Nov 2016 17:34:39 EST Received: from ofwch3n02.rockwellcollins.com (HELO ciulimr01.rockwellcollins.com) ([205.175.226.14]) by ch3vs02.rockwellcollins.com with ESMTP; 16 Nov 2016 16:23:56 -0600 X-Received: from largo.rockwellcollins.com (unknown [192.168.140.76]) by ciulimr01.rockwellcollins.com (Postfix) with ESMTP id 51240600FF; Wed, 16 Nov 2016 16:23:56 -0600 (CST) From: Matt Weber To: linux-hwmon@vger.kernel.org Cc: Jared Bents , Matt Weber Subject: [PATCH] hwmon: (amc6821) sign extension temperature Date: Wed, 16 Nov 2016 16:23:53 -0600 Message-Id: <1479335033-44479-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 --- drivers/hwmon/amc6821.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hwmon/amc6821.c b/drivers/hwmon/amc6821.c index 12e851a..d7368f7 100644 --- a/drivers/hwmon/amc6821.c +++ b/drivers/hwmon/amc6821.c @@ -188,7 +188,7 @@ 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,