diff options
author | Guenter Roeck <linux@roeck-us.net> | 2015-01-18 17:27:55 -0800 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2015-01-25 21:23:59 -0800 |
commit | bca6a1ada0464b7179f34f9af62bcdfd60c223e7 (patch) | |
tree | f80e174290624521ea1e797e23429a27c343bf77 /drivers/hwmon | |
parent | add513be1c47b3b2765c3f618a69c9db26d8dc27 (diff) | |
download | op-kernel-dev-bca6a1ada0464b7179f34f9af62bcdfd60c223e7.zip op-kernel-dev-bca6a1ada0464b7179f34f9af62bcdfd60c223e7.tar.gz |
hwmon: (jc42) Use sign_extend32 for sign extension
Despite the name, sign_extend32 works just fine for 16 bit variables,
so it is safe to use.
Cc: Martin Kepplinger <martink@posteo.de>
Reviewed-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r-- | drivers/hwmon/jc42.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/drivers/hwmon/jc42.c b/drivers/hwmon/jc42.c index 388f8bc..262d808 100644 --- a/drivers/hwmon/jc42.c +++ b/drivers/hwmon/jc42.c @@ -213,11 +213,7 @@ static u16 jc42_temp_to_reg(int temp, bool extended) static int jc42_temp_from_reg(s16 reg) { - reg &= 0x1fff; - - /* sign extend register */ - if (reg & 0x1000) - reg |= 0xf000; + reg = sign_extend32(reg, 12); /* convert from 0.0625 to 0.001 resolution */ return reg * 125 / 2; |