summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorJared Bents <jared.bents@rockwellcollins.com>2016-11-18 22:20:38 -0600
committerGuenter Roeck <linux@roeck-us.net>2016-12-02 13:28:04 -0800
commit4538bfbf2d9f1fc48c07ac0cc0ee58716fe7fe96 (patch)
tree56dc2bf52fe69a3e7df4fbcbea13855ed73d67e1 /drivers
parent13edb767aa609b6efb7c0c2b57fbd72a6ded0eed (diff)
hwmon: (amc6821) sign extension temperature
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. Fixes: 28e6274d8fa67 ("hwmon: (amc6821) Avoid forward declaration") Signed-off-by: Jared Bents <jared.bents@rockwellcollins.com> Signed-off-by: Matt Weber <matthew.weber@rockwellcollins.com> [groeck: Dropped unnecessary continuation line] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/hwmon/amc6821.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/hwmon/amc6821.c b/drivers/hwmon/amc6821.c
index 12e851a5af48..46b4e35fd555 100644
--- a/drivers/hwmon/amc6821.c
+++ b/drivers/hwmon/amc6821.c
@@ -188,8 +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,
- temp_reg[i]);
+ data->temp[i] = (int8_t)i2c_smbus_read_byte_data(
+ client, temp_reg[i]);
data->stat1 = i2c_smbus_read_byte_data(client,
AMC6821_REG_STAT1);