rtc: stm32: remove __exit annotation on remove callback
Subsystems (2)
PATCH 1/3 rtc: stm32: remove __exit annotation on remove callback
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.
--- drivers/rtc/rtc-stm32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-stm32.c +1 -1
@@ -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;
Signature · 1 line
2.9.0
PATCH 2/3 rtc: stm32: fix building without CONFIG_OF
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.
--- drivers/rtc/rtc-stm32.c | 2 -- 1 file changed, 2 deletions(-)
drivers/rtc/rtc-stm32.c +0 -2
@@ -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)
Signature · 1 line
2.9.0
PATCH 3/3 rtc: stm32: use 32-bit cast for BIT() macro
In reply to Arnd BergmannUsing 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.
--- drivers/rtc/rtc-stm32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-stm32.c +1 -1
@@ -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;
Signature · 1 line
2.9.0
Re: [PATCH 3/3] rtc: stm32: use 32-bit cast for BIT() macro
drivers/rtc/rtc-stm32.c line 95
Quoted 2 lines · Arnd Bergmann
drivers/rtc/rtc-stm32.c +1
-1-#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.
Signature · 3 lines
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.
Re: [PATCH 3/3] rtc: stm32: use 32-bit cast for BIT() macro
Quoted 6 lines · Russell King - ARM Linux
drivers/rtc/rtc-stm32.c line 95
Quoted 2 lines · Arnd Bergmann
drivers/rtc/rtc-stm32.c +1
-1-#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.
Signature · 3 lines
Alexandre Belloni, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
Re: [PATCH 3/3] rtc: stm32: use 32-bit cast for BIT() macro
In reply to Arnd BergmannHi Arnd,
Quoted 7 lines · Arnd Bergmann
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...
Quoted 19 lines
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.hheader or the regmap API.Cc Mark Brown <[email protected]>Fixes 4e64350f42e2 ("rtc: add STM32 RTC driver")Signed-off-by Arnd Bergmann <[email protected]>--- drivers/rtc/rtc-stm32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/rtc/rtc-stm32.c +0
-0
drivers/rtc/rtc-stm32.c line 98
Quoted 8 lines
drivers/rtc/rtc-stm32.c +1
-1@@ -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
Re: [PATCH 3/3] rtc: stm32: use 32-bit cast for BIT() macro
Quoted 7 lines · Amelie DELAUNAY
Quoted 6 lines · Arnd Bergmann
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:
Quoted 8 lines
Quoted 4 lines
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_DBPprevents 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
Alexandre Belloni
AppliedQuoted 6 lines · Arnd Bergmann
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' ofdrivers/rtc/rtc-stm32.o: defined in discarded section `.exit.text' ofdrivers/rtc/rtc-stm32.o
Quoted 8 lines
This removes the extraneous annotation.
Fixes 4e64350f42e2 ("rtc: add STM32 RTC driver")Signed-off-by Arnd Bergmann <[email protected]>--- drivers/rtc/rtc-stm32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Applied, thanks.
Signature · 3 lines
Alexandre Belloni, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
Alexandre Belloni
AppliedRe: [PATCH 2/3] rtc: stm32: fix building without CONFIG_OF
In reply to Arnd BergmannQuoted 4 lines · Arnd Bergmann
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'?
Quoted 8 lines
As the #ifdef serves no purpose here, let's just remove it.
Fixes 4e64350f42e2 ("rtc: add STM32 RTC driver")Signed-off-by Arnd Bergmann <[email protected]>--- drivers/rtc/rtc-stm32.c | 2 -- 1 file changed, 2 deletions(-)
Applied, thanks.
Signature · 3 lines
Alexandre Belloni, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
[rtc-linux] Re: [PATCH 3/3] rtc: stm32: use 32-bit cast for BIT() macro
In reply to Arnd BergmannQuoted 18 lines · Arnd Bergmann
Quoted 5 lines · On Fri, Jan 13, 2017 at 4:56 PM, Amelie DELAUNAY <[email protected]…
Quoted 4 lines · Arnd Bergmann
Using the ~ operator on a
BIT()constant results in a large 'unsigned long'
constant that won't fit into an 'unsigned int' function argument on64-bit
Quoted 1 line
Quoted 1 line
architectures, resulting in a harmless build warning in x86
allmodconfig:
Quoted 3 lines
Quoted 3 lines
drivers/rtc/rtc-stm32.c: In function 'stm32_rtc_probe':drivers/rtc/rtc-stm32.c:651:51: error: large integer implicitlytruncated
Quoted 3 lines
Quoted 2 lines
to unsigned type [-Werror=overflow]
regmap_update_bits(rtc->dbp, PWR_CR, PWR_CR_DBP, ~PWR_CR_DBP);
Quoted 7 lines
Quoted 3 lines
I thought I would fix this warning by replacing all ~PWR_CR_DBP by 0, because the mask
PWR_CR_DBPprevents 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
If it can wait Monday, yes.
Amelie
Signature · 8 lines
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 [email protected]. For more options, visit https://groups.google.com/d/optout.