Linux RTC
 help / color / mirror / Atom feed
From: Amelie DELAUNAY <amelie.delaunay@st.com>
To: Arnd Bergmann <arnd@arndb.de>,
	Alexandre Belloni <alexandre.belloni@free-electrons.com>
Cc: Mark Brown <broonie@kernel.org>,
	Alessandro Zummo <a.zummo@towertech.it>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	Alexandre TORGUE <alexandre.torgue@st.com>,
	Mathieu Poirier <mathieu.poirier@linaro.org>,
	"rtc-linux@googlegroups.com" <rtc-linux@googlegroups.com>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: [rtc-linux] Re: [PATCH 3/3] rtc: stm32: use 32-bit cast for BIT() macro
Date: Fri, 13 Jan 2017 16:56:54 +0100	[thread overview]
Message-ID: <26624cbe-7e71-35a4-b8df-f5ac5d15b1ec@st.com> (raw)
In-Reply-To: <20170113153311.2611510-3-arnd@arndb.de>

Hi Arnd,

On 01/13/2017 04:32 PM, Arnd Bergmann wrote:
> Using the ~ operator on a BIT() constant results in a large 'unsigned long'
> constant that won't fit into an 'unsigned int' function argument on 64-bit
> architectures, resulting in a harmless build warning in x86 allmodconfig:
>
> drivers/rtc/rtc-stm32.c: In function 'stm32_rtc_probe':
> drivers/rtc/rtc-stm32.c:651:51: error: large integer implicitly truncated to unsigned type [-Werror=overflow]
>   regmap_update_bits(rtc->dbp, PWR_CR, PWR_CR_DBP, ~PWR_CR_DBP);
I thought I would fix this warning by replacing all ~PWR_CR_DBP by 0, 
because the mask PWR_CR_DBP prevents other bits to be cleared.
In this way, I avoid the ugly cast...
>
> This works around the warning by adding an explict cast to 'u32', but
> that is unfortunately a bit ugly and I feel there should be a better
> way to do this, possibly with some changes to either the bitops.h
> header or the regmap API.
>
> Cc: Mark Brown <broonie@kernel.org>
> Fixes: 4e64350f42e2 ("rtc: add STM32 RTC driver")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  drivers/rtc/rtc-stm32.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/rtc/rtc-stm32.c b/drivers/rtc/rtc-stm32.c
> index 8c599f52124c..05d3dc89e55f 100644
> --- a/drivers/rtc/rtc-stm32.c
> +++ b/drivers/rtc/rtc-stm32.c
> @@ -92,7 +92,7 @@
>  /* STM32_PWR_CR */
>  #define PWR_CR				0x00
>  /* STM32_PWR_CR bit field */
> -#define PWR_CR_DBP			BIT(8)
> +#define PWR_CR_DBP			(u32)BIT(8)
>
>  struct stm32_rtc {
>  	struct rtc_device *rtc_dev;
>

Regards,
Amelie

-- 
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.

  parent reply	other threads:[~2017-01-13 15:57 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-13 15:32 [rtc-linux] [PATCH 1/3] rtc: stm32: remove __exit annotation on remove callback Arnd Bergmann
2017-01-13 15:32 ` [rtc-linux] [PATCH 2/3] rtc: stm32: fix building without CONFIG_OF Arnd Bergmann
2017-01-13 16:55   ` [rtc-linux] " Alexandre Belloni
2017-01-13 15:32 ` [rtc-linux] [PATCH 3/3] rtc: stm32: use 32-bit cast for BIT() macro Arnd Bergmann
2017-01-13 15:52   ` [rtc-linux] " Russell King - ARM Linux
2017-01-13 15:55     ` Alexandre Belloni
2017-01-13 15:56   ` Amelie DELAUNAY [this message]
2017-01-13 16:48     ` Arnd Bergmann
2017-01-13 17:40       ` adelaunay.stm32
2017-01-13 16:54 ` [rtc-linux] Re: [PATCH 1/3] rtc: stm32: remove __exit annotation on remove callback 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=26624cbe-7e71-35a4-b8df-f5ac5d15b1ec@st.com \
    --to=amelie.delaunay@st.com \
    --cc=a.zummo@towertech.it \
    --cc=alexandre.belloni@free-electrons.com \
    --cc=alexandre.torgue@st.com \
    --cc=arnd@arndb.de \
    --cc=broonie@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.poirier@linaro.org \
    --cc=mcoquelin.stm32@gmail.com \
    --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