diff options
author | Joe Schaack <jschaack@xes-inc.com> | 2017-04-18 07:15:50 -0500 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2017-04-21 12:30:09 -0700 |
commit | bdaf9c40b2d1d67617b259c59ce1858eda54b4ce (patch) | |
tree | 2126071904a9252f1d2bea87cfc61e3631786ff2 /drivers/hwmon/ina209.c | |
parent | a02c24a321583e7970393488834501e15a69b656 (diff) | |
download | op-kernel-dev-bdaf9c40b2d1d67617b259c59ce1858eda54b4ce.zip op-kernel-dev-bdaf9c40b2d1d67617b259c59ce1858eda54b4ce.tar.gz |
hwmon: (ina209) Handled signed registers
The shunt voltage and current registers are signed 16-bit values so
handle them as such.
Signed-off-by: Joe Schaack <jschaack@xes-inc.com>
Reviewed-by: Aaron Sierra <asierra@xes-inc.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon/ina209.c')
-rw-r--r-- | drivers/hwmon/ina209.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/hwmon/ina209.c b/drivers/hwmon/ina209.c index c5f20f0..aa0768c 100644 --- a/drivers/hwmon/ina209.c +++ b/drivers/hwmon/ina209.c @@ -117,7 +117,7 @@ static long ina209_from_reg(const u8 reg, const u16 val) case INA209_SHUNT_VOLTAGE_POS_WARN: case INA209_SHUNT_VOLTAGE_NEG_WARN: /* LSB=10 uV. Convert to mV. */ - return DIV_ROUND_CLOSEST(val, 100); + return DIV_ROUND_CLOSEST((s16)val, 100); case INA209_BUS_VOLTAGE: case INA209_BUS_VOLTAGE_MAX_PEAK: @@ -146,7 +146,7 @@ static long ina209_from_reg(const u8 reg, const u16 val) case INA209_CURRENT: /* LSB=1 mA (selected). Is in mA */ - return val; + return (s16)val; } /* programmer goofed */ |