Re: hwmon: ina209: Handled signed registers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Apr 18, 2017 at 07:15:50AM -0500, Joe Schaack wrote:
> The shunt voltage and current registers are signed 16-bit values so
> handle them as such.
> 
> Signed-off-by: Joe Schaack <jschaack@xxxxxxxxxxx>
> Reviewed-by: Aaron Sierra <asierra@xxxxxxxxxxx>

Applied.

Thanks,
Guenter

> ---
>  drivers/hwmon/ina209.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/hwmon/ina209.c b/drivers/hwmon/ina209.c
> index 5378fde..9fa975d 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 */
--
To unsubscribe from this list: send the line "unsubscribe linux-hwmon" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux