lkml.org 
[lkml]   [2017]   [Jan]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 4.9 106/206] hwmon: (amc6821) sign extension temperature
    Date
    4.9-stable review patch.  If anyone has any objections, please let me know.

    ------------------

    From: Jared Bents <jared.bents@rockwellcollins.com>

    commit 4538bfbf2d9f1fc48c07ac0cc0ee58716fe7fe96 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: 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>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

    ---
    drivers/hwmon/amc6821.c | 4 ++--
    1 file changed, 2 insertions(+), 2 deletions(-)

    --- a/drivers/hwmon/amc6821.c
    +++ b/drivers/hwmon/amc6821.c
    @@ -188,8 +188,8 @@ static struct amc6821_data *amc6821_upda
    !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);

    \
     
     \ /
      Last update: 2017-01-10 15:38    [W:4.408 / U:0.012 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site