Skip to contentSkip to conversation

ARM: OMAP2+: Timer build warnings and error fixes

PATCH New Jon Hunter 3 participants 8 messages Nov 28, 2012 – Nov 29, 2012

Subsystems (3)
lore
Share & tools
lore

Jon Hunter

author
#0 lore raw

v2 cover ARM: OMAP2+: Timer build warnings and error fixes

Fixes for build warnings and errors seen with various kernel configuration combinations. Based upon Tony Lindgren's OMAP master branch.

V2 changes:
- Update fix for realtime counter per feedback from Santosh
- Update fix when building for only AM335x with Igor's suggestion to use __maybe_unused (thanks Igor!)
- Add Vaibhav's fixes for sparse warnings

Jon Hunter (3):
ARM: OMAP2+: Fix realtime_counter_init warning in timer.c
ARM: OMAP4: Fix build error and warning in timer.c
ARM: AM335x: Fix warning in timer.c

Vaibhav Hiremath (1):
ARM: OMAP2+: Fix sparse warnings in timer.c

 arch/arm/mach-omap2/Kconfig |    3 ++-
 arch/arm/mach-omap2/timer.c |    8 ++++----
 2 files changed, 6 insertions(+), 5 deletions(-)
Signature · 1 line
1.7.10.4
author
#1 lore raw

PATCH v2 1/4 ARM: OMAP2+: Fix realtime_counter_init warning in timer.c

In commit fa6d79d (ARM: OMAP: Add initialisation for the real-time counter), the function realtime_counter_init() was added. However, if the kernel configuration option CONFIG_SOC_OMAP5 is not selected then the following compiler warning is observed.

CC arch/arm/mach-omap2/timer.o
arch/arm/mach-omap2/timer.c:489:20: warning: ?realtime_counter_init? defined but not used [-Wunused-function]

Commit fa6d79d also introduced the kernel configuration option CONFIG_SOC_HAS_REALTIME_COUNTER. If this option is not selected then the a stub function for realtime_counter_init() is defined.

For non-OMAP5 devices, there is no realtime counter and so realtime_counter_init() function and stub function are not used for these devices. Therefore, fix this warning by only allowing the kernel configuration option CONFIG_SOC_HAS_REALTIME_COUNTER to be enabled for OMAP5 devices.

Cc Santosh Shilimkar <[email protected]>

Acked-by Santosh Shilimkar <[email protected]>

---
 arch/arm/mach-omap2/Kconfig |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm/mach-omap2/Kconfig +2 -1
index 813c267..500f2f6 100644
@@ -26,6 +26,8 @@ config SOC_HAS_OMAP2_SDRC
 
 config SOC_HAS_REALTIME_COUNTER
 	bool "Real time free running counter"
+	depends on SOC_OMAP5
+	default y
 
 config ARCH_OMAP2
 	bool "TI OMAP2"
@@ -79,7 +81,6 @@ config SOC_OMAP5
 	select ARM_GIC
 	select CPU_V7
 	select HAVE_SMP
-	select SOC_HAS_REALTIME_COUNTER
 	select COMMON_CLK
 
 comment "OMAP Core Type"
Signature · 1 line
1.7.10.4
author
#2 lore raw

PATCH v2 2/4 ARM: OMAP4: Fix build error and warning in timer.c

In reply to Jon Hunter

When compiling the kernel with configuration option CONFIG_ARCH_OMAP4 enabled and CONFIG_LOCAL_TIMERS disabled, the following build error and warning is seen.

CC arch/arm/mach-omap2/timer.o
arch/arm/mach-omap2/timer.c: In function ?omap4_local_timer_init?:
arch/arm/mach-omap2/timer.c:630:2: error: implicit declaration of
function ?omap4_sync32_timer_init? [-Werror=implicit-function-declaration]
arch/arm/mach-omap2/timer.c: At top level:
arch/arm/mach-omap2/timer.c:607:1: warning: ?omap4_sync32k_timer_init?
defined but not used [-Wunused-function]
cc1: some warnings being treated as errors
make[1]: *** [arch/arm/mach-omap2/timer.o] Error 1

This issue was introduced by commit 6f80b3b (ARM: OMAP2+: timer: remove CONFIG_OMAP_32K_TIMER) where the "k" is missing from the "sync32k" in the function name "omap4_sync32_timer_init". Therefore, correct this typo to resolve the above error and warning.

Cc Igor Grinberg <[email protected]>
---
 arch/arm/mach-omap2/timer.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-omap2/timer.c +1 -1
index b9cff72..3bbb244 100644
@@ -630,7 +630,7 @@ static void __init omap4_local_timer_init(void)
 #else /* CONFIG_LOCAL_TIMERS */
 static inline void omap4_local_timer_init(void)
 {
-	omap4_sync32_timer_init();
+	omap4_sync32k_timer_init();
 }
 #endif /* CONFIG_LOCAL_TIMERS */
 OMAP_SYS_TIMER(4, local);
Signature · 1 line
1.7.10.4
author
#3 lore raw

PATCH v2 3/4 ARM: AM335x: Fix warning in timer.c

In reply to Jon Hunter

When compiling the kernel with configuration options ...

# CONFIG_ARCH_OMAP2 is not set
# CONFIG_ARCH_OMAP3 is not set
# CONFIG_ARCH_OMAP4 is not set
# CONFIG_SOC_OMAP5 is not set
CONFIG_SOC_AM33XX=y

... the following build warning is seen.

CC arch/arm/mach-omap2/timer.o
arch/arm/mach-omap2/timer.c:395:19: warning: ?omap2_sync32k_clocksource_init?
defined but not used [-Wunused-function]

This issue was introduced by commit 6f80b3b (ARM: OMAP2+: timer: remove CONFIG_OMAP_32K_TIMER) where the omap2_sync32k_clocksource_init() is no longer referenced by the timer initialisation function for the AM335x device as it has no 32k-sync timer.

Fix this by adding the "__maybe_unused" compiler directive to the omap2_sync32k_clocksource_init() function to indicate that this function may be used for certain configurations.

Cc Igor Grinberg <[email protected]>
---
 arch/arm/mach-omap2/timer.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-omap2/timer.c +1 -1
index 3bbb244..79df809 100644
@@ -392,7 +392,7 @@ static struct of_device_id omap_counter_match[] __initdata = {
 };
 
 /* Setup free-running counter for clocksource */
-static int __init omap2_sync32k_clocksource_init(void)
+static int __init __maybe_unused omap2_sync32k_clocksource_init(void)
 {
 	int ret;
 	struct device_node *np = NULL;
Signature · 1 line
1.7.10.4
#4 lore raw

PATCH v2 3/4 ARM: AM335x: Fix warning in timer.c

Quoted 19 lines · Jon Hunter

When compiling the kernel with configuration options ...

# CONFIG_ARCH_OMAP2 is not set
# CONFIG_ARCH_OMAP3 is not set
# CONFIG_ARCH_OMAP4 is not set
# CONFIG_SOC_OMAP5 is not set
CONFIG_SOC_AM33XX=y

... the following build warning is seen.

CC arch/arm/mach-omap2/timer.o
arch/arm/mach-omap2/timer.c:395:19: warning: ‘omap2_sync32k_clocksource_init’
defined but not used [-Wunused-function]

This issue was introduced by commit 6f80b3b (ARM: OMAP2+: timer: remove CONFIG_OMAP_32K_TIMER) where the omap2_sync32k_clocksource_init() is no longer referenced by the timer initialisation function for the AM335x device as it has no 32k-sync timer.

Quoted 8 lines

Fix this by adding the "__maybe_unused" compiler directive to the omap2_sync32k_clocksource_init() function to indicate that this function may be used for certain configurations.

Cc Igor Grinberg <[email protected]>

---

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#5 lore raw

PATCH v2 3/4 ARM: AM335x: Fix warning in timer.c

In reply to Jon Hunter
Quoted 19 lines · Jon Hunter

When compiling the kernel with configuration options ...

# CONFIG_ARCH_OMAP2 is not set
# CONFIG_ARCH_OMAP3 is not set
# CONFIG_ARCH_OMAP4 is not set
# CONFIG_SOC_OMAP5 is not set
CONFIG_SOC_AM33XX=y

... the following build warning is seen.

CC arch/arm/mach-omap2/timer.o
arch/arm/mach-omap2/timer.c:395:19: warning: ?omap2_sync32k_clocksource_init?
defined but not used [-Wunused-function]

This issue was introduced by commit 6f80b3b (ARM: OMAP2+: timer: remove CONFIG_OMAP_32K_TIMER) where the omap2_sync32k_clocksource_init() is no longer referenced by the timer initialisation function for the AM335x device as it has no 32k-sync timer.

Quoted 7 lines

Fix this by adding the "__maybe_unused" compiler directive to the omap2_sync32k_clocksource_init() function to indicate that this function may be used for certain configurations.

Cc Igor Grinberg <[email protected]>
Signature · 2 lines
Regards,
Igor.
author
#6 lore raw

PATCH v2 4/4 ARM: OMAP2+: Fix sparse warnings in timer.c

In reply to Jon Hunter

From: Vaibhav Hiremath <[email protected]>

Sparse generates the following warnings when compiling mach-omap2/timer.c.

CHECK arch/arm/mach-omap2/timer.c
arch/arm/mach-omap2/timer.c:193:13: warning: symbol 'omap_dmtimer_init' was not declared. Should it be static? arch/arm/mach-omap2/timer.c:213:12: warning: symbol 'omap_dm_timer_get_errata' was not declared. Should it be static?

Add static to function declaration to fix warnings.

---
 arch/arm/mach-omap2/timer.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-omap2/timer.c +2 -2
index 79df809..c6d173f 100644
@@ -190,7 +190,7 @@ static struct device_node * __init omap_get_timer_dt(struct of_device_id *match,
  * kernel registering these devices remove them dynamically from the device
  * tree on boot.
  */
-void __init omap_dmtimer_init(void)
+static void __init omap_dmtimer_init(void)
 {
 	struct device_node *np;
 
@@ -210,7 +210,7 @@ void __init omap_dmtimer_init(void)
  *
  * Get the timer errata flags that are specific to the OMAP device being used.
  */
-u32 __init omap_dm_timer_get_errata(void)
+static u32 __init omap_dm_timer_get_errata(void)
 {
 	if (cpu_is_omap24xx())
 		return 0;
Signature · 1 line
1.7.10.4
#7 lore raw

PATCH v2 4/4 ARM: OMAP2+: Fix sparse warnings in timer.c

Quoted 10 lines · Jon Hunter

From: Vaibhav Hiremath <[email protected]>

Sparse generates the following warnings when compiling mach-omap2/timer.c.

CHECK arch/arm/mach-omap2/timer.c
arch/arm/mach-omap2/timer.c:193:13: warning: symbol 'omap_dmtimer_init' was not declared. Should it be static? arch/arm/mach-omap2/timer.c:213:12: warning: symbol 'omap_dm_timer_get_errata' was not declared. Should it be static?

Quoted 5 lines

Add static to function declaration to fix warnings.

---