Commit fbab1832 authored by Jared Bents's avatar Jared Bents Committed by Greg Kroah-Hartman

hwmon: (amc6821) sign extension temperature

commit 4538bfbf upstream.

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: 28e6274d ("hwmon: (amc6821) Avoid forward declaration")
Signed-off-by: default avatarJared Bents <jared.bents@rockwellcollins.com>
Signed-off-by: default avatarMatt Weber <matthew.weber@rockwellcollins.com>
[groeck: Dropped unnecessary continuation line]
Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 07c05622
...@@ -188,8 +188,8 @@ static struct amc6821_data *amc6821_update_device(struct device *dev) ...@@ -188,8 +188,8 @@ static struct amc6821_data *amc6821_update_device(struct device *dev)
!data->valid) { !data->valid) {
for (i = 0; i < TEMP_IDX_LEN; i++) 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(
temp_reg[i]); client, temp_reg[i]);
data->stat1 = i2c_smbus_read_byte_data(client, data->stat1 = i2c_smbus_read_byte_data(client,
AMC6821_REG_STAT1); AMC6821_REG_STAT1);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment