Re: [RFC] hwmon: jc42: use bitops' sign_extend16

2015-01-12 Thread Guenter Roeck
On Mon, Jan 12, 2015 at 06:28:20PM +0100, Martin Kepplinger wrote:
> Example change, using new sign_extend functions.

No need to drop the Signed-off: line; it only means that I can not take
the patch even if I want to. Also, if the patch itself is final, no need
to state that it is an example in the description. Instead, use an
introductory mail (RFC PATCH 0/x] to explain the background.

Otherwise looks good; feel free to add

Reviewed-by: Guenter Roeck 

to the next version.

Thanks,
Guenter
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[RFC] hwmon: jc42: use bitops' sign_extend16

2015-01-12 Thread Martin Kepplinger
Example change, using new sign_extend functions.
---
 drivers/hwmon/jc42.c | 7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/hwmon/jc42.c b/drivers/hwmon/jc42.c
index 388f8bc..d0582a3 100644
--- a/drivers/hwmon/jc42.c
+++ b/drivers/hwmon/jc42.c
@@ -31,6 +31,7 @@
 #include 
 #include 
 #include 
+#include 
 
 /* Addresses to scan */
 static const unsigned short normal_i2c[] = {
@@ -213,11 +214,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_extend16(reg, 12);
 
/* convert from 0.0625 to 0.001 resolution */
return reg * 125 / 2;
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/