Skip to contentSkip to conversation

ARM: OMAP2+: Fix compiler warning for 32k timer

PATCH New Jon Hunter 2 participants 5 messages Nov 15, 2012 – Nov 16, 2012

Subsystems (3)
lore
Share & tools
lore

Jon Hunter

author
#0 lore raw

PATCH 1/1 ARM: OMAP2+: Fix compiler warning for 32k timer

Commit "ARM: OMAP2+: Add device-tree support for 32kHz counter" added structure omap_counter_match to the OMAP2 timer code. When CONFIG_OMAP_32K_TIMER is not defined this structure generates the following as it is not used.

CC arch/arm/mach-omap2/timer.o
arch/arm/mach-omap2/timer.c:163:28: warning: 'omap_counter_match' defined but not used [-Wunused-variable]

Move the definition of omap_counter_match to avoid this warning when CONFIG_OMAP_32K_TIMER is not set.

Thanks to Kevin Hilman for tracking down and reporting this problem.

---

This is based upon Tony Lindgren's OMAP master branch.

 arch/arm/mach-omap2/timer.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
arch/arm/mach-omap2/timer.c +5 -5
index 099e406..2b9d485 100644
@@ -160,11 +160,6 @@ static struct of_device_id omap_timer_match[] __initdata = {
 	{ }
 };
 
-static struct of_device_id omap_counter_match[] __initdata = {
-	{ .compatible = "ti,omap-counter32k", },
-	{ }
-};
-
 /**
  * omap_get_timer_dt - get a timer using device-tree
  * @match	- device-tree match structure for matching a device type
@@ -408,6 +403,11 @@ static u32 notrace dmtimer_read_sched_clock(void)
 }
 
 #ifdef CONFIG_OMAP_32K_TIMER
+static struct of_device_id omap_counter_match[] __initdata = {
+	{ .compatible = "ti,omap-counter32k", },
+	{ }
+};
+
 /* Setup free-running counter for clocksource */
 static int __init omap2_sync32k_clocksource_init(void)
 {
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/1 ARM: OMAP2+: Fix compiler warning for 32k timer

Hi,

Quoted 1 line · Jon Hunter

+static struct of_device_id omap_counter_match[] __initdata = {

not directly related to $SUBJECT, but shouldn't this be static const __initconst ?

Signature · 8 lines
balbi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20121115/ee3b61c2/attachment.sig>
author
#2 lore raw

PATCH 1/1 ARM: OMAP2+: Fix compiler warning for 32k timer

Quoted 7 lines · Felipe Balbi

Hi,

Quoted 1 line · Jon Hunter

+static struct of_device_id omap_counter_match[] __initdata = {

not directly related to $SUBJECT, but shouldn't this be static const __initconst ?

Yes you are right. Looks like there are several other of_device_id structs in arch/arm/mach-omap2 that could be updated to const too.

Cheers
Jon

#3 lore raw

PATCH 1/1 ARM: OMAP2+: Fix compiler warning for 32k timer

Hi,

Quoted 4 lines · Jon Hunter
Quoted 2 lines · Felipe Balbi

Hi,

Quoted 8 lines
Quoted 5 lines · Jon Hunter
Quoted 1 line

+static struct of_device_id omap_counter_match[] __initdata = {

not directly related to $SUBJECT, but shouldn't this be static const __initconst ?

Yes you are right. Looks like there are several other of_device_id structs in arch/arm/mach-omap2 that could be updated to const too.

here's a quick sed substitution for you:

$ sed -i 's/static \(struct of_device_id\)\s\(\w\+\[\]\)\s\(__initdata\|\)/static const \1 \2 __initconst/' arch/arm/*omap*/*.c

It worked fine here.

Signature · 8 lines
balbi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20121116/76d5735a/attachment.sig>
author
#4 lore raw

PATCH 1/1 ARM: OMAP2+: Fix compiler warning for 32k timer

Quoted 13 lines · Felipe Balbi

Hi,

Quoted 10 lines · Jon Hunter
Quoted 7 lines · Felipe Balbi

Hi,

Quoted 1 line · Jon Hunter

+static struct of_device_id omap_counter_match[] __initdata = {

not directly related to $SUBJECT, but shouldn't this be static const __initconst ?

Quoted 8 lines
Quoted 2 lines

Yes you are right. Looks like there are several other of_device_id structs in arch/arm/mach-omap2 that could be updated to const too.

here's a quick sed substitution for you:

$ sed -i 's/static \(struct of_device_id\)\s\(\w\+\[\]\)\s\(__initdata\|\)/static const \1 \2 __initconst/' arch/arm/*omap*/*.c

It worked fine here.

Thanks. Will fix this up in a subsequent patch.

Cheers
Jon