* [PATCH 1/3] rtc: stm32: remove __exit annotation on remove callback
@ 2017-01-13 15:32 Arnd Bergmann
2017-01-13 15:32 ` [PATCH 2/3] rtc: stm32: fix building without CONFIG_OF Arnd Bergmann
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Arnd Bergmann @ 2017-01-13 15:32 UTC (permalink / raw)
To: Alexandre Belloni
Cc: Arnd Bergmann, Alessandro Zummo, Maxime Coquelin,
Alexandre Torgue, Amelie Delaunay, Mathieu Poirier, rtc-linux,
linux-arm-kernel, linux-kernel
The remove function can be called at runtime for a manual 'unbind'
operation and must not be left out from a built-in driver, as kbuild
complains:
`stm32_rtc_remove' referenced in section `.data.stm32_rtc_driver' of drivers/rtc/rtc-stm32.o: defined in discarded section `.exit.text' of drivers/rtc/rtc-stm32.o
This removes the extraneous annotation.
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 c4789b5a5d81..3513e052722f 100644
--- a/drivers/rtc/rtc-stm32.c
+++ b/drivers/rtc/rtc-stm32.c
@@ -657,7 +657,7 @@ static int stm32_rtc_probe(struct platform_device *pdev)
return ret;
}
-static int __exit stm32_rtc_remove(struct platform_device *pdev)
+static int stm32_rtc_remove(struct platform_device *pdev)
{
struct stm32_rtc *rtc = platform_get_drvdata(pdev);
unsigned int cr;
--
2.9.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/3] rtc: stm32: fix building without CONFIG_OF
2017-01-13 15:32 [PATCH 1/3] rtc: stm32: remove __exit annotation on remove callback Arnd Bergmann
@ 2017-01-13 15:32 ` Arnd Bergmann
2017-01-13 16:55 ` Alexandre Belloni
2017-01-13 15:32 ` [PATCH 3/3] rtc: stm32: use 32-bit cast for BIT() macro Arnd Bergmann
2017-01-13 16:54 ` [PATCH 1/3] rtc: stm32: remove __exit annotation on remove callback Alexandre Belloni
2 siblings, 1 reply; 9+ messages in thread
From: Arnd Bergmann @ 2017-01-13 15:32 UTC (permalink / raw)
To: Alexandre Belloni
Cc: Arnd Bergmann, Alessandro Zummo, Maxime Coquelin,
Alexandre Torgue, Mathieu Poirier, Amelie Delaunay, rtc-linux,
linux-arm-kernel, linux-kernel
The new driver has a stray #ifdef in it that causes a build error:
drivers/rtc/rtc-stm32.c:718:21: error: 'stm32_rtc_of_match' undeclared here (not in a function); did you mean 'stm32_rtc_pm_ops'?
As the #ifdef serves no purpose here, let's just remove it.
Fixes: 4e64350f42e2 ("rtc: add STM32 RTC driver")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/rtc/rtc-stm32.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/rtc/rtc-stm32.c b/drivers/rtc/rtc-stm32.c
index 3513e052722f..8c599f52124c 100644
--- a/drivers/rtc/rtc-stm32.c
+++ b/drivers/rtc/rtc-stm32.c
@@ -490,13 +490,11 @@ static const struct rtc_class_ops stm32_rtc_ops = {
.alarm_irq_enable = stm32_rtc_alarm_irq_enable,
};
-#ifdef CONFIG_OF
static const struct of_device_id stm32_rtc_of_match[] = {
{ .compatible = "st,stm32-rtc" },
{}
};
MODULE_DEVICE_TABLE(of, stm32_rtc_of_match);
-#endif
static int stm32_rtc_init(struct platform_device *pdev,
struct stm32_rtc *rtc)
--
2.9.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 3/3] rtc: stm32: use 32-bit cast for BIT() macro
2017-01-13 15:32 [PATCH 1/3] rtc: stm32: remove __exit annotation on remove callback Arnd Bergmann
2017-01-13 15:32 ` [PATCH 2/3] rtc: stm32: fix building without CONFIG_OF Arnd Bergmann
@ 2017-01-13 15:32 ` Arnd Bergmann
2017-01-13 15:52 ` Russell King - ARM Linux
2017-01-13 15:56 ` Amelie DELAUNAY
2017-01-13 16:54 ` [PATCH 1/3] rtc: stm32: remove __exit annotation on remove callback Alexandre Belloni
2 siblings, 2 replies; 9+ messages in thread
From: Arnd Bergmann @ 2017-01-13 15:32 UTC (permalink / raw)
To: Alexandre Belloni
Cc: Arnd Bergmann, Mark Brown, Alessandro Zummo, Maxime Coquelin,
Alexandre Torgue, Amelie Delaunay, Mathieu Poirier, rtc-linux,
linux-arm-kernel, linux-kernel
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);
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;
--
2.9.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 3/3] rtc: stm32: use 32-bit cast for BIT() macro
2017-01-13 15:32 ` [PATCH 3/3] rtc: stm32: use 32-bit cast for BIT() macro Arnd Bergmann
@ 2017-01-13 15:52 ` Russell King - ARM Linux
2017-01-13 15:55 ` Alexandre Belloni
2017-01-13 15:56 ` Amelie DELAUNAY
1 sibling, 1 reply; 9+ messages in thread
From: Russell King - ARM Linux @ 2017-01-13 15:52 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Alexandre Belloni, Alessandro Zummo, Amelie Delaunay,
Alexandre Torgue, Mathieu Poirier, linux-kernel, Mark Brown,
Maxime Coquelin, rtc-linux, linux-arm-kernel
On Fri, Jan 13, 2017 at 04:32:53PM +0100, Arnd Bergmann wrote:
> -#define PWR_CR_DBP BIT(8)
> +#define PWR_CR_DBP (u32)BIT(8)
Shouldn't that have parens around it as it's no longer a simple expression.
--
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 3/3] rtc: stm32: use 32-bit cast for BIT() macro
2017-01-13 15:52 ` Russell King - ARM Linux
@ 2017-01-13 15:55 ` Alexandre Belloni
0 siblings, 0 replies; 9+ messages in thread
From: Alexandre Belloni @ 2017-01-13 15:55 UTC (permalink / raw)
To: Russell King - ARM Linux
Cc: Arnd Bergmann, Alessandro Zummo, Amelie Delaunay,
Alexandre Torgue, Mathieu Poirier, linux-kernel, Mark Brown,
Maxime Coquelin, rtc-linux, linux-arm-kernel
On 13/01/2017 at 15:52:29 +0000, Russell King - ARM Linux wrote :
> On Fri, Jan 13, 2017 at 04:32:53PM +0100, Arnd Bergmann wrote:
> > -#define PWR_CR_DBP BIT(8)
> > +#define PWR_CR_DBP (u32)BIT(8)
>
> Shouldn't that have parens around it as it's no longer a simple expression.
>
Yes, at least checkpatch complains about it.
--
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 3/3] rtc: stm32: use 32-bit cast for BIT() macro
2017-01-13 15:32 ` [PATCH 3/3] rtc: stm32: use 32-bit cast for BIT() macro Arnd Bergmann
2017-01-13 15:52 ` Russell King - ARM Linux
@ 2017-01-13 15:56 ` Amelie DELAUNAY
2017-01-13 16:48 ` Arnd Bergmann
1 sibling, 1 reply; 9+ messages in thread
From: Amelie DELAUNAY @ 2017-01-13 15:56 UTC (permalink / raw)
To: Arnd Bergmann, Alexandre Belloni
Cc: Mark Brown, Alessandro Zummo, Maxime Coquelin, Alexandre TORGUE,
Mathieu Poirier, rtc-linux, linux-arm-kernel, linux-kernel
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
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 3/3] rtc: stm32: use 32-bit cast for BIT() macro
2017-01-13 15:56 ` Amelie DELAUNAY
@ 2017-01-13 16:48 ` Arnd Bergmann
0 siblings, 0 replies; 9+ messages in thread
From: Arnd Bergmann @ 2017-01-13 16:48 UTC (permalink / raw)
To: Amelie DELAUNAY
Cc: Alexandre Belloni, Mark Brown, Alessandro Zummo, Maxime Coquelin,
Alexandre TORGUE, Mathieu Poirier, rtc-linux, linux-arm-kernel,
linux-kernel
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
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/3] rtc: stm32: remove __exit annotation on remove callback
2017-01-13 15:32 [PATCH 1/3] rtc: stm32: remove __exit annotation on remove callback Arnd Bergmann
2017-01-13 15:32 ` [PATCH 2/3] rtc: stm32: fix building without CONFIG_OF Arnd Bergmann
2017-01-13 15:32 ` [PATCH 3/3] rtc: stm32: use 32-bit cast for BIT() macro Arnd Bergmann
@ 2017-01-13 16:54 ` Alexandre Belloni
2 siblings, 0 replies; 9+ messages in thread
From: Alexandre Belloni @ 2017-01-13 16:54 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Alessandro Zummo, Maxime Coquelin, Alexandre Torgue,
Amelie Delaunay, Mathieu Poirier, rtc-linux, linux-arm-kernel,
linux-kernel
On 13/01/2017 at 16:32:51 +0100, Arnd Bergmann wrote :
> The remove function can be called at runtime for a manual 'unbind'
> operation and must not be left out from a built-in driver, as kbuild
> complains:
>
> `stm32_rtc_remove' referenced in section `.data.stm32_rtc_driver' of drivers/rtc/rtc-stm32.o: defined in discarded section `.exit.text' of drivers/rtc/rtc-stm32.o
>
> This removes the extraneous annotation.
>
> 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(-)
>
Applied, thanks.
--
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/3] rtc: stm32: fix building without CONFIG_OF
2017-01-13 15:32 ` [PATCH 2/3] rtc: stm32: fix building without CONFIG_OF Arnd Bergmann
@ 2017-01-13 16:55 ` Alexandre Belloni
0 siblings, 0 replies; 9+ messages in thread
From: Alexandre Belloni @ 2017-01-13 16:55 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Alessandro Zummo, Maxime Coquelin, Alexandre Torgue,
Mathieu Poirier, Amelie Delaunay, rtc-linux, linux-arm-kernel,
linux-kernel
On 13/01/2017 at 16:32:52 +0100, Arnd Bergmann wrote :
> The new driver has a stray #ifdef in it that causes a build error:
>
> drivers/rtc/rtc-stm32.c:718:21: error: 'stm32_rtc_of_match' undeclared here (not in a function); did you mean 'stm32_rtc_pm_ops'?
>
> As the #ifdef serves no purpose here, let's just remove it.
>
> Fixes: 4e64350f42e2 ("rtc: add STM32 RTC driver")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> drivers/rtc/rtc-stm32.c | 2 --
> 1 file changed, 2 deletions(-)
>
Applied, thanks.
--
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2017-01-13 16:55 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-13 15:32 [PATCH 1/3] rtc: stm32: remove __exit annotation on remove callback Arnd Bergmann
2017-01-13 15:32 ` [PATCH 2/3] rtc: stm32: fix building without CONFIG_OF Arnd Bergmann
2017-01-13 16:55 ` Alexandre Belloni
2017-01-13 15:32 ` [PATCH 3/3] rtc: stm32: use 32-bit cast for BIT() macro Arnd Bergmann
2017-01-13 15:52 ` Russell King - ARM Linux
2017-01-13 15:55 ` Alexandre Belloni
2017-01-13 15:56 ` Amelie DELAUNAY
2017-01-13 16:48 ` Arnd Bergmann
2017-01-13 16:54 ` [PATCH 1/3] rtc: stm32: remove __exit annotation on remove callback Alexandre Belloni
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).