Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1558569

Re: [PATCH 3/3] rtc: stm32: use 32-bit cast for BIT() macro

From Arnd Bergmann <arnd@arndb.de>
Newsgroups linux.kernel
Subject Re: [PATCH 3/3] rtc: stm32: use 32-bit cast for BIT() macro
Date 2017-01-13 17:50 +0100
Message-ID <sZdd7-3bn-1@gated-at.bofh.it> (permalink)
References <sZc7t-2zn-39@gated-at.bofh.it> <sZc7t-2zn-37@gated-at.bofh.it> <sZcqL-2FK-37@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri, Jan 13, 2017 at 4:56 PM, Amelie DELAUNAY <amelie.delaunay@st.com> wrote:
> 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...

Good idea, much nicer than mine! Can you send that patch?

    Arnd

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH 3/3] rtc: stm32: use 32-bit cast for BIT() macro Arnd Bergmann <arnd@arndb.de> - 2017-01-13 16:40 +0100
  Re: [PATCH 3/3] rtc: stm32: use 32-bit cast for BIT() macro Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2017-01-13 17:00 +0100
  Re: [PATCH 3/3] rtc: stm32: use 32-bit cast for BIT() macro Russell King - ARM Linux <linux@armlinux.org.uk> - 2017-01-13 17:00 +0100
  Re: [PATCH 3/3] rtc: stm32: use 32-bit cast for BIT() macro Amelie DELAUNAY <amelie.delaunay@st.com> - 2017-01-13 17:00 +0100
    Re: [PATCH 3/3] rtc: stm32: use 32-bit cast for BIT() macro Arnd Bergmann <arnd@arndb.de> - 2017-01-13 17:50 +0100

csiph-web