* [rtc-linux] [PATCH] rtc-pcf2123: use sign_extend32() for sign extension
@ 2016-04-18 10:17 ` Martin Kepplinger
0 siblings, 0 replies; 6+ messages in thread
From: Martin Kepplinger @ 2016-04-18 10:17 UTC (permalink / raw)
To: a.zummo, alexandre.belloni; +Cc: rtc-linux, linux-kernel, Martin Kepplinger
Signed-off-by: Martin Kepplinger <martink@posteo.de>
---
drivers/rtc/rtc-pcf2123.c | 4 ++--
1 file 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;
--
2.1.4
--
--
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
---
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH] rtc-pcf2123: use sign_extend32() for sign extension
@ 2016-04-18 10:17 ` Martin Kepplinger
0 siblings, 0 replies; 6+ messages in thread
From: Martin Kepplinger @ 2016-04-18 10:17 UTC (permalink / raw)
To: a.zummo, alexandre.belloni; +Cc: rtc-linux, linux-kernel, Martin Kepplinger
Signed-off-by: Martin Kepplinger <martink@posteo.de>
---
drivers/rtc/rtc-pcf2123.c | 4 ++--
1 file 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;
--
2.1.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [rtc-linux] Re: [PATCH] rtc-pcf2123: use sign_extend32() for sign extension
2016-04-18 10:17 ` Martin Kepplinger
@ 2016-04-19 22:44 ` Alexandre Belloni
-1 siblings, 0 replies; 6+ messages in thread
From: Alexandre Belloni @ 2016-04-19 22:44 UTC (permalink / raw)
To: Martin Kepplinger; +Cc: a.zummo, rtc-linux, linux-kernel
Please always include a commit message else, I'm fine with the patch.
On 18/04/2016 at 12:17:44 +0200, Martin Kepplinger wrote :
> Signed-off-by: Martin Kepplinger <martink@posteo.de>
> ---
> drivers/rtc/rtc-pcf2123.c | 4 ++--
> 1 file 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;
>
> --
> 2.1.4
>
--
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
--
--
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
---
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] rtc-pcf2123: use sign_extend32() for sign extension
@ 2016-04-19 22:44 ` Alexandre Belloni
0 siblings, 0 replies; 6+ messages in thread
From: Alexandre Belloni @ 2016-04-19 22:44 UTC (permalink / raw)
To: Martin Kepplinger; +Cc: a.zummo, rtc-linux, linux-kernel
Please always include a commit message else, I'm fine with the patch.
On 18/04/2016 at 12:17:44 +0200, Martin Kepplinger wrote :
> Signed-off-by: Martin Kepplinger <martink@posteo.de>
> ---
> drivers/rtc/rtc-pcf2123.c | 4 ++--
> 1 file 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;
>
> --
> 2.1.4
>
--
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 6+ messages in thread
* [rtc-linux] Re: [PATCH] rtc-pcf2123: use sign_extend32() for sign extension
2016-04-18 10:17 ` Martin Kepplinger
@ 2016-06-04 13:52 ` Alexandre Belloni
-1 siblings, 0 replies; 6+ messages in thread
From: Alexandre Belloni @ 2016-06-04 13:52 UTC (permalink / raw)
To: Martin Kepplinger; +Cc: a.zummo, rtc-linux, linux-kernel
On 18/04/2016 at 12:17:44 +0200, Martin Kepplinger wrote :
> Signed-off-by: Martin Kepplinger <martink@posteo.de>
> ---
> drivers/rtc/rtc-pcf2123.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
Applied, thanks.
--
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
--
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
---
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-06-04 13:52 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-18 10:17 [rtc-linux] [PATCH] rtc-pcf2123: use sign_extend32() for sign extension Martin Kepplinger
2016-04-18 10:17 ` Martin Kepplinger
2016-04-19 22:44 ` [rtc-linux] " Alexandre Belloni
2016-04-19 22:44 ` Alexandre Belloni
2016-06-04 13:52 ` [rtc-linux] " Alexandre Belloni
2016-06-04 13:52 ` Alexandre Belloni
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.