summaryrefslogtreecommitdiffstats
path: root/drivers/rtc
diff options
context:
space:
mode:
authorMartin Kepplinger <martink@posteo.de>2016-04-18 12:17:44 +0200
committerAlexandre Belloni <alexandre.belloni@free-electrons.com>2016-06-04 15:50:44 +0200
commit82df3e045d8cce5eaeb9bf1ed1d8d8841b04a41a (patch)
treee55773fe9fbcde4c4e5ed9f57df685d9133f1551 /drivers/rtc
parentc5776dec8f2a90a0aa9e197c2900f68fda8dd978 (diff)
downloadop-kernel-dev-82df3e045d8cce5eaeb9bf1ed1d8d8841b04a41a.zip
op-kernel-dev-82df3e045d8cce5eaeb9bf1ed1d8d8841b04a41a.tar.gz
rtc: pcf2123: use sign_extend32() for sign extension
Use sign_extend32() instead of open coding sign extension. Signed-off-by: Martin Kepplinger <martink@posteo.de> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Diffstat (limited to 'drivers/rtc')
-rw-r--r--drivers/rtc/rtc-pcf2123.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/rtc/rtc-pcf2123.c b/drivers/rtc/rtc-pcf2123.c
index f22e060..b4478cc 100644
--- a/drivers/rtc/rtc-pcf2123.c
+++ b/drivers/rtc/rtc-pcf2123.c
@@ -96,7 +96,7 @@
#define CD_TMR_TE BIT(3) /* Countdown timer enable */
/* PCF2123_REG_OFFSET BITS */
-#define OFFSET_SIGN_BIT BIT(6) /* 2's complement sign bit */
+#define OFFSET_SIGN_BIT 6 /* 2's complement sign bit */
#define OFFSET_COARSE BIT(7) /* Coarse mode offset */
#define OFFSET_STEP (2170) /* Offset step in parts per billion */
@@ -217,7 +217,7 @@ static int pcf2123_read_offset(struct device *dev, long *offset)
if (reg & OFFSET_COARSE)
reg <<= 1; /* multiply by 2 and sign extend */
else
- reg |= (reg & OFFSET_SIGN_BIT) << 1; /* sign extend only */
+ reg = sign_extend32(reg, OFFSET_SIGN_BIT);
*offset = ((long)reg) * OFFSET_STEP;
OpenPOWER on IntegriCloud