public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Alexandre Belloni <alexandre.belloni@free-electrons.com>
To: Martin Kepplinger <martink@posteo.de>
Cc: a.zummo@towertech.it, rtc-linux@googlegroups.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] rtc-pcf2123: use sign_extend32() for sign extension
Date: Wed, 20 Apr 2016 00:44:43 +0200	[thread overview]
Message-ID: <20160419224443.GI29844@piout.net> (raw)
In-Reply-To: <1460974664-7525-1-git-send-email-martink@posteo.de>

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

  reply	other threads:[~2016-04-19 22:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-18 10:17 [PATCH] rtc-pcf2123: use sign_extend32() for sign extension Martin Kepplinger
2016-04-19 22:44 ` Alexandre Belloni [this message]
2016-06-04 13:52 ` Alexandre Belloni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160419224443.GI29844@piout.net \
    --to=alexandre.belloni@free-electrons.com \
    --cc=a.zummo@towertech.it \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martink@posteo.de \
    --cc=rtc-linux@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox