Skip to contentSkip to conversation

ARM: OMAP2+: Timer build warnings and error fixes

PATCH Superseded Jon Hunter 4 participants 17 messages Nov 28, 2012

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Jon Hunter

author
#0 lore raw

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

Fixes for build warnings and errors seen with various kernel configuration combinations.

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

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

PATCH 1/3 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.

The option CONFIG_SOC_HAS_REALTIME_COUNTER and stub function are not really needed because ...

1. For non-OMAP5 devices, there is no realtime counter and so realtime_counter_init() function is not used.
2. For OMAP5 devices, CONFIG_SOC_HAS_REALTIME_COUNTER is always selected and cannot be disabled, so the stub function for realtime_counter_init() is never used.

Fix this warning by removing the kernel configuration option CONFIG_SOC_HAS_REALTIME_COUNTER and stub function, and only include the function realtime_counter_init() if CONFIG_SOC_OMAP5 is selected.

Cc Santosh Shilimkar <[email protected]>
---
 arch/arm/mach-omap2/Kconfig |    4 ----
 arch/arm/mach-omap2/timer.c |    7 ++-----
 2 files changed, 2 insertions(+), 9 deletions(-)
arch/arm/mach-omap2/Kconfig +0 -4
index 813c267..ea88b7d 100644
@@ -24,9 +24,6 @@ config ARCH_OMAP2PLUS_TYPICAL
 config SOC_HAS_OMAP2_SDRC
 	bool "OMAP2 SDRAM Controller support"
 
-config SOC_HAS_REALTIME_COUNTER
-	bool "Real time free running counter"
-
 config ARCH_OMAP2
 	bool "TI OMAP2"
 	depends on ARCH_OMAP2PLUS
@@ -79,7 +76,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"
arch/arm/mach-omap2/timer.c +2 -5
index b9cff72..a9f99e3 100644
@@ -476,7 +476,7 @@ static void __init omap2_gptimer_clocksource_init(int gptimer_id,
 			gptimer_id, clksrc.rate);
 }
 
-#ifdef CONFIG_SOC_HAS_REALTIME_COUNTER
+#ifdef CONFIG_SOC_OMAP5
 /*
  * The realtime counter also called master counter, is a free-running
  * counter, which is related to real time. It produces the count used
@@ -549,10 +549,7 @@ static void __init realtime_counter_init(void)
 
 	iounmap(base);
 }
-#else
-static inline void __init realtime_counter_init(void)
-{}
-#endif
+#endif /* CONFIG_SOC_OMAP5 */
 
 #define OMAP_SYS_GP_TIMER_INIT(name, clkev_nr, clkev_src, clkev_prop,	\
 			       clksrc_nr, clksrc_src)			\
Signature · 1 line
1.7.10.4
#2 lore raw

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

Quoted 26 lines · Jon Hunter

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.

The option CONFIG_SOC_HAS_REALTIME_COUNTER and stub function are not really needed because ...

1. For non-OMAP5 devices, there is no realtime counter and so realtime_counter_init() function is not used.
2. For OMAP5 devices, CONFIG_SOC_HAS_REALTIME_COUNTER is always selected and cannot be disabled, so the stub function for realtime_counter_init() is never used.

Fix this warning by removing the kernel configuration option CONFIG_SOC_HAS_REALTIME_COUNTER and stub function, and only include the function realtime_counter_init() if CONFIG_SOC_OMAP5 is selected.

Quoted 5 lines
Cc Santosh Shilimkar <[email protected]>

---

The #ifdef was avoided because the real-time counter can be used on other future SOCs. And the those SOCs just select SOC_HAS_REALTIME_COUNTER. And that stub was added because OMAP5 can
work without real-time counter configuration enabled using 32K counter.
But since we are any way have that SOC_HAS_REALTIME_COUNTER always
set for SOC which wants to use it, we can actually remove the stub
and hence avoid the warning. Let me know if below patch is ok
with you ? attached the same for mailer issues

From e000aa13e47e29fbe3473bfd0277cb057c3160cc Mon Sep 17 00:00:00 2001
From: Santosh Shilimkar <[email protected]>
Date: Wed, 28 Nov 2012 11:28:57 +0530
Subject: [PATCH] ARM: OMAP2+: Fix realtime_counter_init warning in timer.c
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

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]

It is because of the stub init function which was added for the cases where realtime_counter_init() is called with !CONFIG_SOC_HAS_REALTIME_COUNTER. This is actually not necessary since the SOC which need this feature will explicitly select the configuration.

So just drop the unused stub to avoid the build warning.

Patch is made after seeing Jon's patch which was wrapping the real-time counter code under needed SOC #ifdef

Cc Jon Hunter <[email protected]>
---
 arch/arm/mach-omap2/timer.c |    3 ---
 1 file changed, 3 deletions(-)
arch/arm/mach-omap2/timer.c +0 -3
index 69e4663..79d8e6b 100644
@@ -428,9 +428,6 @@ static void __init realtime_counter_init(void)
 
 	iounmap(base);
 }
-#else
-static inline void __init realtime_counter_init(void)
-{}
 #endif
 
 #define OMAP_SYS_TIMER_INIT(name, clkev_nr, clkev_src,			\
Signature · 1 line
1.7.9.5
Quoted 1 line

From e000aa13e47e29fbe3473bfd0277cb057c3160cc Mon Sep 17 00:00:00 2001

From: Santosh Shilimkar <[email protected]>
Date: Wed, 28 Nov 2012 11:28:57 +0530
Subject: [PATCH] ARM: OMAP2+: Fix realtime_counter_init warning in timer.c
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

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]

It is because of the stub init function which was added for the cases where realtime_counter_init() is called with !CONFIG_SOC_HAS_REALTIME_COUNTER. This is actually not necessary since the SOC which need this feature will explicitly select the configuration.

So just drop the unused stub to avoid the build warning.

Patch is made after seeing Jon's patch which was wrapping the real-time counter code under needed SOC #ifdef

Cc Jon Hunter <[email protected]>
---
 arch/arm/mach-omap2/timer.c |    3 ---
 1 file changed, 3 deletions(-)
arch/arm/mach-omap2/timer.c +0 -3
index 69e4663..79d8e6b 100644
@@ -428,9 +428,6 @@ static void __init realtime_counter_init(void)
 
 	iounmap(base);
 }
-#else
-static inline void __init realtime_counter_init(void)
-{}
 #endif
 
 #define OMAP_SYS_TIMER_INIT(name, clkev_nr, clkev_src,			\
Signature · 1 line
1.7.9.5
author
#3 lore raw

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

Quoted 83 lines · Santosh Shilimkar
Quoted 27 lines · Jon Hunter

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.

The option CONFIG_SOC_HAS_REALTIME_COUNTER and stub function are not really needed because ...

1. For non-OMAP5 devices, there is no realtime counter and so realtime_counter_init() function is not used.
2. For OMAP5 devices, CONFIG_SOC_HAS_REALTIME_COUNTER is always selected and cannot be disabled, so the stub function for
realtime_counter_init()
is never used.

Fix this warning by removing the kernel configuration option CONFIG_SOC_HAS_REALTIME_COUNTER and stub function, and only include the function realtime_counter_init() if CONFIG_SOC_OMAP5 is selected.

Quoted 5 lines
Cc Santosh Shilimkar <[email protected]>

---

The #ifdef was avoided because the real-time counter can be used on other future SOCs. And the those SOCs just select SOC_HAS_REALTIME_COUNTER. And that stub was added because OMAP5 can work without real-time counter configuration enabled using 32K counter. But since we are any way have that SOC_HAS_REALTIME_COUNTER always set for SOC which wants to use it, we can actually remove the stub and hence avoid the warning. Let me know if below patch is ok with you ? attached the same for mailer issues

From e000aa13e47e29fbe3473bfd0277cb057c3160cc Mon Sep 17 00:00:00 2001
From: Santosh Shilimkar <[email protected]>
Date: Wed, 28 Nov 2012 11:28:57 +0530
Subject: [PATCH] ARM: OMAP2+: Fix realtime_counter_init warning in timer.c
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

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]

It is because of the stub init function which was added for the cases where realtime_counter_init() is called with !CONFIG_SOC_HAS_REALTIME_COUNTER.
This is actually not necessary since the SOC which need this feature will explicitly select the configuration.

So just drop the unused stub to avoid the build warning.

Patch is made after seeing Jon's patch which was wrapping the real-time counter code under needed SOC #ifdef

Cc Jon Hunter <[email protected]>
---
 arch/arm/mach-omap2/timer.c |    3 ---
 1 file changed, 3 deletions(-)
arch/arm/mach-omap2/timer.c +0 -0
index 69e4663..79d8e6b 100644

arch/arm/mach-omap2/timer.c static void __init realtime_counter_init(void) · line 433

Quoted 9 lines
arch/arm/mach-omap2/timer.c +0 -3
@@ -428,9 +428,6 @@ static void __init realtime_counter_init(void)
 
     iounmap(base);
 }
-#else
-static inline void __init realtime_counter_init(void)
-{}
 #endif
 
 #define OMAP_SYS_TIMER_INIT(name, clkev_nr, clkev_src,            \

Hi Santosh,

Thanks for the feedback. Unfortunately, the above is not enough. If I disable SOC_OMAP5 and leave SOC_HAS_REALTIME_COUNTER enabled, then I still see the warning message. So I could see that people could still hit this with randconfig.

Understand the desire to make this a selectable configuration, but given to date only OMAP5 uses it, it was simpler and cleaner just to remove the option. However, we could keep the option and just do something like ...

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
 

I have tested this and this resolves the warning.

Cheers
Jon

#4 lore raw

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

Quoted 93 lines · Jon Hunter
Quoted 91 lines · Santosh Shilimkar
Quoted 27 lines · Jon Hunter

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.

The option CONFIG_SOC_HAS_REALTIME_COUNTER and stub function are not really needed because ...

1. For non-OMAP5 devices, there is no realtime counter and so realtime_counter_init() function is not used.
2. For OMAP5 devices, CONFIG_SOC_HAS_REALTIME_COUNTER is always selected and cannot be disabled, so the stub function for
realtime_counter_init()
is never used.

Fix this warning by removing the kernel configuration option CONFIG_SOC_HAS_REALTIME_COUNTER and stub function, and only include the function realtime_counter_init() if CONFIG_SOC_OMAP5 is selected.

Quoted 5 lines
Cc Santosh Shilimkar <[email protected]>

---

The #ifdef was avoided because the real-time counter can be used on other future SOCs. And the those SOCs just select SOC_HAS_REALTIME_COUNTER. And that stub was added because OMAP5 can work without real-time counter configuration enabled using 32K counter. But since we are any way have that SOC_HAS_REALTIME_COUNTER always set for SOC which wants to use it, we can actually remove the stub and hence avoid the warning. Let me know if below patch is ok with you ? attached the same for mailer issues

From e000aa13e47e29fbe3473bfd0277cb057c3160cc Mon Sep 17 00:00:00 2001
From: Santosh Shilimkar <[email protected]>
Date: Wed, 28 Nov 2012 11:28:57 +0530
Subject: [PATCH] ARM: OMAP2+: Fix realtime_counter_init warning in timer.c
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

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]

It is because of the stub init function which was added for the cases where realtime_counter_init() is called with !CONFIG_SOC_HAS_REALTIME_COUNTER.
This is actually not necessary since the SOC which need this feature will explicitly select the configuration.

So just drop the unused stub to avoid the build warning.

Patch is made after seeing Jon's patch which was wrapping the real-time counter code under needed SOC #ifdef

Cc Jon Hunter <[email protected]>
---
  arch/arm/mach-omap2/timer.c |    3 ---
  1 file changed, 3 deletions(-)
arch/arm/mach-omap2/timer.c +0 -3
index 69e4663..79d8e6b 100644
@@ -428,9 +428,6 @@ static void __init realtime_counter_init(void)
 
      iounmap(base);
  }
-#else
-static inline void __init realtime_counter_init(void)
-{}
  #endif
 
Quoted 9 lines

arch/arm/mach-omap2/timer.c static void __init realtime_counter_init(void) · line 433

Quoted 1 line
arch/arm/mach-omap2/timer.c +0 -0
  #define OMAP_SYS_TIMER_INIT(name, clkev_nr, clkev_src,            \

Hi Santosh,

Thanks for the feedback. Unfortunately, the above is not enough. If I disable SOC_OMAP5 and leave SOC_HAS_REALTIME_COUNTER enabled, then I still see the warning message. So I could see that people could still hit this with randconfig.

I did mention that but since OMAP5 selects the feature, I was thinking it is fine.

Quoted 24 lines

Understand the desire to make this a selectable configuration, but given to date only OMAP5 uses it, it was simpler and cleaner just to remove the option. However, we could keep the option and just do something like ...

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
 
Quoted 2 lines

I have tested this and this resolves the warning.

Go ahead and fold above change on top of my patch which drops the stub.

Regards
Santosh

--
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

author
#5 lore raw

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

Quoted 136 lines · Santosh Shilimkar
Quoted 98 lines · Jon Hunter
Quoted 96 lines · Santosh Shilimkar
Quoted 30 lines · Jon Hunter

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.

The option CONFIG_SOC_HAS_REALTIME_COUNTER and stub function are not really needed because ...

1. For non-OMAP5 devices, there is no realtime counter and so realtime_counter_init() function is not used.
2. For OMAP5 devices, CONFIG_SOC_HAS_REALTIME_COUNTER is always selected
and cannot be disabled, so the stub function for
realtime_counter_init()
is never used.

Fix this warning by removing the kernel configuration option CONFIG_SOC_HAS_REALTIME_COUNTER and stub function, and only include the function realtime_counter_init() if CONFIG_SOC_OMAP5 is selected.

Quoted 5 lines
Cc Santosh Shilimkar <[email protected]>

---

The #ifdef was avoided because the real-time counter can be used on other future SOCs. And the those SOCs just select SOC_HAS_REALTIME_COUNTER. And that stub was added because OMAP5 can work without real-time counter configuration enabled using 32K counter. But since we are any way have that SOC_HAS_REALTIME_COUNTER always set for SOC which wants to use it, we can actually remove the stub and hence avoid the warning. Let me know if below patch is ok with you ? attached the same for mailer issues

From e000aa13e47e29fbe3473bfd0277cb057c3160cc Mon Sep 17 00:00:00 2001
From: Santosh Shilimkar <[email protected]>
Date: Wed, 28 Nov 2012 11:28:57 +0530
Subject: [PATCH] ARM: OMAP2+: Fix realtime_counter_init warning in timer.c
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

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]

It is because of the stub init function which was added for the cases where realtime_counter_init() is called with !CONFIG_SOC_HAS_REALTIME_COUNTER.
This is actually not necessary since the SOC which need this feature will explicitly select the configuration.

So just drop the unused stub to avoid the build warning.

Patch is made after seeing Jon's patch which was wrapping the real-time counter code under needed SOC #ifdef

Cc Jon Hunter <[email protected]>
---
  arch/arm/mach-omap2/timer.c |    3 ---
  1 file changed, 3 deletions(-)
arch/arm/mach-omap2/timer.c +0 -3
index 69e4663..79d8e6b 100644
@@ -428,9 +428,6 @@ static void __init realtime_counter_init(void)
 
      iounmap(base);
  }
-#else
-static inline void __init realtime_counter_init(void)
-{}
  #endif
 
Quoted 9 lines

arch/arm/mach-omap2/timer.c static void __init realtime_counter_init(void) · line 433

Quoted 1 line
arch/arm/mach-omap2/timer.c +0 -0
  #define OMAP_SYS_TIMER_INIT(name, clkev_nr, clkev_src,            \

Hi Santosh,

Thanks for the feedback. Unfortunately, the above is not enough. If I disable SOC_OMAP5 and leave SOC_HAS_REALTIME_COUNTER enabled, then I still see the warning message. So I could see that people could still hit this with randconfig.

I did mention that but since OMAP5 selects the feature, I was thinking it is fine.

Quoted 25 lines

Understand the desire to make this a selectable configuration, but given to date only OMAP5 uses it, it was simpler and cleaner just to remove the option. However, we could keep the option and just do something like ...

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
 
Quoted 4 lines
Quoted 2 lines

I have tested this and this resolves the warning.

Go ahead and fold above change on top of my patch which drops the stub.

Well if we drop the stub then we cannot make it selectable for OMAP5. So in other words folding the above change on top of your patch will still not work ;-)

The above patch will only allow you to use the REALTIME COUNTER on OMAP5, but it makes it selectable and so the stub is needed now. If future devices wish to use the REALTIME COUNTER then they can be added to the "depends on" statement.

The above patch should be all we need.

Cheers
Jon

#6 lore raw

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

Quoted 138 lines · Jon Hunter
Quoted 136 lines · Santosh Shilimkar
Quoted 98 lines · Jon Hunter
Quoted 96 lines · Santosh Shilimkar
Quoted 30 lines · Jon Hunter

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.

The option CONFIG_SOC_HAS_REALTIME_COUNTER and stub function are not really needed because ...

1. For non-OMAP5 devices, there is no realtime counter and so realtime_counter_init() function is not used.
2. For OMAP5 devices, CONFIG_SOC_HAS_REALTIME_COUNTER is always selected
and cannot be disabled, so the stub function for
realtime_counter_init()
is never used.

Fix this warning by removing the kernel configuration option CONFIG_SOC_HAS_REALTIME_COUNTER and stub function, and only include the function realtime_counter_init() if CONFIG_SOC_OMAP5 is selected.

Quoted 5 lines
Cc Santosh Shilimkar <[email protected]>

---

The #ifdef was avoided because the real-time counter can be used on other future SOCs. And the those SOCs just select SOC_HAS_REALTIME_COUNTER. And that stub was added because OMAP5 can work without real-time counter configuration enabled using 32K counter. But since we are any way have that SOC_HAS_REALTIME_COUNTER always set for SOC which wants to use it, we can actually remove the stub and hence avoid the warning. Let me know if below patch is ok with you ? attached the same for mailer issues

From e000aa13e47e29fbe3473bfd0277cb057c3160cc Mon Sep 17 00:00:00 2001
From: Santosh Shilimkar <[email protected]>
Date: Wed, 28 Nov 2012 11:28:57 +0530
Subject: [PATCH] ARM: OMAP2+: Fix realtime_counter_init warning in timer.c
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

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]

It is because of the stub init function which was added for the cases where realtime_counter_init() is called with !CONFIG_SOC_HAS_REALTIME_COUNTER.
This is actually not necessary since the SOC which need this feature will explicitly select the configuration.

So just drop the unused stub to avoid the build warning.

Patch is made after seeing Jon's patch which was wrapping the real-time counter code under needed SOC #ifdef

Cc Jon Hunter <[email protected]>
---
   arch/arm/mach-omap2/timer.c |    3 ---
   1 file changed, 3 deletions(-)
arch/arm/mach-omap2/timer.c +0 -3
index 69e4663..79d8e6b 100644
@@ -428,9 +428,6 @@ static void __init realtime_counter_init(void)
 
       iounmap(base);
   }
-#else
-static inline void __init realtime_counter_init(void)
-{}
   #endif
 
Quoted 9 lines

arch/arm/mach-omap2/timer.c static void __init realtime_counter_init(void) · line 433

Quoted 1 line
arch/arm/mach-omap2/timer.c +0 -0
   #define OMAP_SYS_TIMER_INIT(name, clkev_nr, clkev_src,            \

Hi Santosh,

Thanks for the feedback. Unfortunately, the above is not enough. If I disable SOC_OMAP5 and leave SOC_HAS_REALTIME_COUNTER enabled, then I still see the warning message. So I could see that people could still hit this with randconfig.

I did mention that but since OMAP5 selects the feature, I was thinking it is fine.

Quoted 25 lines

Understand the desire to make this a selectable configuration, but given to date only OMAP5 uses it, it was simpler and cleaner just to remove the option. However, we could keep the option and just do something like ...

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
 
Quoted 9 lines
Quoted 4 lines
Quoted 2 lines

I have tested this and this resolves the warning.

Go ahead and fold above change on top of my patch which drops the stub.

Well if we drop the stub then we cannot make it selectable for OMAP5. So in other words folding the above change on top of your patch will still not work ;-)

Oh yes.. Just ignore another follow up email which i sent thinking I lost the connection in between.

Quoted 7 lines

The above patch will only allow you to use the REALTIME COUNTER on OMAP5, but it makes it selectable and so the stub is needed now. If future devices wish to use the REALTIME COUNTER then they can be added to the "depends on" statement.

The above patch should be all we need.

I agree. Feel free to add my ack when you cook up the patch

--
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

#7 lore raw

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

In reply to Jon Hunter
Quoted 93 lines · Jon Hunter
Quoted 91 lines · Santosh Shilimkar
Quoted 27 lines · Jon Hunter

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.

The option CONFIG_SOC_HAS_REALTIME_COUNTER and stub function are not really needed because ...

1. For non-OMAP5 devices, there is no realtime counter and so realtime_counter_init() function is not used.
2. For OMAP5 devices, CONFIG_SOC_HAS_REALTIME_COUNTER is always selected and cannot be disabled, so the stub function for
realtime_counter_init()
is never used.

Fix this warning by removing the kernel configuration option CONFIG_SOC_HAS_REALTIME_COUNTER and stub function, and only include the function realtime_counter_init() if CONFIG_SOC_OMAP5 is selected.

Quoted 5 lines
Cc Santosh Shilimkar <[email protected]>

---

The #ifdef was avoided because the real-time counter can be used on other future SOCs. And the those SOCs just select SOC_HAS_REALTIME_COUNTER. And that stub was added because OMAP5 can work without real-time counter configuration enabled using 32K counter. But since we are any way have that SOC_HAS_REALTIME_COUNTER always set for SOC which wants to use it, we can actually remove the stub and hence avoid the warning. Let me know if below patch is ok with you ? attached the same for mailer issues

From e000aa13e47e29fbe3473bfd0277cb057c3160cc Mon Sep 17 00:00:00 2001
From: Santosh Shilimkar <[email protected]>
Date: Wed, 28 Nov 2012 11:28:57 +0530
Subject: [PATCH] ARM: OMAP2+: Fix realtime_counter_init warning in timer.c
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

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]

It is because of the stub init function which was added for the cases where realtime_counter_init() is called with !CONFIG_SOC_HAS_REALTIME_COUNTER.
This is actually not necessary since the SOC which need this feature will explicitly select the configuration.

So just drop the unused stub to avoid the build warning.

Patch is made after seeing Jon's patch which was wrapping the real-time counter code under needed SOC #ifdef

Cc Jon Hunter <[email protected]>
---
  arch/arm/mach-omap2/timer.c |    3 ---
  1 file changed, 3 deletions(-)
arch/arm/mach-omap2/timer.c +0 -3
index 69e4663..79d8e6b 100644
@@ -428,9 +428,6 @@ static void __init realtime_counter_init(void)
 
      iounmap(base);
  }
-#else
-static inline void __init realtime_counter_init(void)
-{}
  #endif
 
Quoted 9 lines

arch/arm/mach-omap2/timer.c static void __init realtime_counter_init(void) · line 433

Quoted 1 line
arch/arm/mach-omap2/timer.c +0 -0
  #define OMAP_SYS_TIMER_INIT(name, clkev_nr, clkev_src,            \

Hi Santosh,

Thanks for the feedback. Unfortunately, the above is not enough. If I disable SOC_OMAP5 and leave SOC_HAS_REALTIME_COUNTER enabled, then I still see the warning message. So I could see that people could still hit this with randconfig.

Yes. For the same reason initially, the stub was added.

Quoted 24 lines

Understand the desire to make this a selectable configuration, but given to date only OMAP5 uses it, it was simpler and cleaner just to remove the option. However, we could keep the option and just do something like ...

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
 
Quoted 2 lines

I have tested this and this resolves the warning.

Good. Am ok with above additional update.
May be you can add this change on top of my patch
which drops the stub.

Regards
Santosh

--
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

author
#8 lore raw

PATCH 2/3 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 a9f99e3..eb96712 100644
@@ -627,7 +627,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
#9 lore raw

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

Quoted 20 lines · 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.

Quoted 5 lines
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

#10 lore raw

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

In reply to Jon Hunter
Quoted 15 lines · 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

Quoted 4 lines

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.

Yeah ;-( sorry for this...

Quoted 5 lines
Cc Igor Grinberg <[email protected]>
Quoted 17 lines
---
 arch/arm/mach-omap2/timer.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-omap2/timer.c +1 -1
index a9f99e3..eb96712 100644
@@ -627,7 +627,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 · 2 lines
Regards,
Igor.
author
#11 lore raw

PATCH 3/3 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 only including the omap2_sync32k_clocksource_init() function if either OMAP2, OMAP3, OMAP4 or OMAP5 devices are enabled.

Cc Igor Grinberg <[email protected]>
---
 arch/arm/mach-omap2/timer.c |    3 +++
 1 file changed, 3 insertions(+)
arch/arm/mach-omap2/timer.c +3 -0
index eb96712..085c7e7 100644
@@ -386,6 +386,8 @@ static u32 notrace dmtimer_read_sched_clock(void)
 	return 0;
 }
 
+#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) || \
+	defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5)
 static struct of_device_id omap_counter_match[] __initdata = {
 	{ .compatible = "ti,omap-counter32k", },
 	{ }
@@ -451,6 +453,7 @@ static int __init omap2_sync32k_clocksource_init(void)
 
 	return ret;
 }
+#endif
 
 static void __init omap2_gptimer_clocksource_init(int gptimer_id,
 						const char *fck_source)
Signature · 1 line
1.7.10.4
#12 lore raw

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

Quoted 34 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.

Fix this by only including the omap2_sync32k_clocksource_init() function if either OMAP2, OMAP3, OMAP4 or OMAP5 devices are enabled.

Cc Igor Grinberg <[email protected]>
---
  arch/arm/mach-omap2/timer.c |    3 +++
  1 file changed, 3 insertions(+)
arch/arm/mach-omap2/timer.c +0 -0
index eb96712..085c7e7 100644

arch/arm/mach-omap2/timer.c static u32 notrace dmtimer_read_sched_clock(void) · line 390

Quoted 5 lines
arch/arm/mach-omap2/timer.c +2 -0
@@ -386,6 +386,8 @@ static u32 notrace dmtimer_read_sched_clock(void)
  	return 0;
  }
 
+#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) || \
+	defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5)

#ifndef CONFIG_SOC_AM33XX ?

#ifdef things are really ugly and needs constant patching and hence something like CONFIG_HAS_32K kind of feature flags are better. But that will undo certain part of f80b3b (ARM: OMAP2+: timer: remove CONFIG_OMAP_32K_TIMER).

Regards
santosh

--
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

#13 lore raw

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

Quoted 38 lines · Santosh Shilimkar
Quoted 37 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.

Fix this by only including the omap2_sync32k_clocksource_init() function if either OMAP2, OMAP3, OMAP4 or OMAP5 devices are enabled.

Cc Igor Grinberg <[email protected]>
---
  arch/arm/mach-omap2/timer.c |    3 +++
  1 file changed, 3 insertions(+)
arch/arm/mach-omap2/timer.c +0 -0
index eb96712..085c7e7 100644
@@ -386,6 +386,8 @@ static u32 notrace dmtimer_read_sched_clock(void)
      return 0;
  }
 
Quoted 8 lines

arch/arm/mach-omap2/timer.c static u32 notrace dmtimer_read_sched_clock(void) · line 390

Quoted 2 lines
arch/arm/mach-omap2/timer.c +2 -0
+#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) || \
+    defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5)

#ifndef CONFIG_SOC_AM33XX ?

#ifdef things are really ugly and needs constant patching and hence something like CONFIG_HAS_32K kind of feature flags are better. But that will undo certain part of f80b3b (ARM: OMAP2+: timer: remove CONFIG_OMAP_32K_TIMER).

Agreed on ugliness of ifdefs.
What about adding __maybe_unused to the function signature? That will cover any future SoC also w/o the need to extend the ifdefs.

Signature · 2 lines
Regards,
Igor.
#14 lore raw

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

Quoted 43 lines · Igor Grinberg
Quoted 42 lines · Santosh Shilimkar
Quoted 34 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.

Fix this by only including the omap2_sync32k_clocksource_init() function if either OMAP2, OMAP3, OMAP4 or OMAP5 devices are enabled.

Cc Igor Grinberg <[email protected]>
---
   arch/arm/mach-omap2/timer.c |    3 +++
   1 file changed, 3 insertions(+)
arch/arm/mach-omap2/timer.c +0 -0
index eb96712..085c7e7 100644

arch/arm/mach-omap2/timer.c static u32 notrace dmtimer_read_sched_clock(void) · line 390

Quoted 5 lines
arch/arm/mach-omap2/timer.c +2 -0
@@ -386,6 +386,8 @@ static u32 notrace dmtimer_read_sched_clock(void)
       return 0;
   }
 
+#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) || \
+    defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5)

#ifndef CONFIG_SOC_AM33XX ?

Quoted 9 lines
Quoted 4 lines

#ifdef things are really ugly and needs constant patching and hence something like CONFIG_HAS_32K kind of feature flags are better. But that will undo certain part of f80b3b (ARM: OMAP2+: timer: remove CONFIG_OMAP_32K_TIMER).

Agreed on ugliness of ifdefs.
What about adding __maybe_unused to the function signature? That will cover any future SoC also w/o the need to extend the ifdefs.

Sounds good to me.

Regards
Santosh
--
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

author
#15 lore raw

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

Quoted 51 lines · Santosh Shilimkar
Quoted 50 lines · Igor Grinberg
Quoted 48 lines · Santosh Shilimkar
Quoted 36 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.

Fix this by only including the omap2_sync32k_clocksource_init() function
if either OMAP2, OMAP3, OMAP4 or OMAP5 devices are enabled.

Cc Igor Grinberg <[email protected]>
---
   arch/arm/mach-omap2/timer.c |    3 +++
   1 file changed, 3 insertions(+)
arch/arm/mach-omap2/timer.c +0 -0
index eb96712..085c7e7 100644

arch/arm/mach-omap2/timer.c static u32 notrace dmtimer_read_sched_clock(void) · line 390

Quoted 5 lines
arch/arm/mach-omap2/timer.c +2 -0
@@ -386,6 +386,8 @@ static u32 notrace dmtimer_read_sched_clock(void)
       return 0;
   }
 
+#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) || \
+    defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5)

#ifndef CONFIG_SOC_AM33XX ?

#ifdef things are really ugly and needs constant patching and hence something like CONFIG_HAS_32K kind of feature flags are better. But that will undo certain part of f80b3b (ARM: OMAP2+: timer: remove CONFIG_OMAP_32K_TIMER).

Quoted 5 lines
Quoted 4 lines

Agreed on ugliness of ifdefs.
What about adding __maybe_unused to the function signature? That will cover any future SoC also w/o the need to extend the ifdefs.

Sounds good to me.

Yes agree on the ugliness of this. However, my thought was these would only remain until we migrate over to device-tree and then the detection of the a 32k source can be determine via DT.

However, I can update to use __maybe_unused for now. We just need to remember to remove this in the future if it becomes unnecessary :-)

Cheers
Jon

#16 lore raw

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

In reply to Jon Hunter
Quoted 22 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.

Fix this by only including the omap2_sync32k_clocksource_init() function if either OMAP2, OMAP3, OMAP4 or OMAP5 devices are enabled.

Quoted 7 lines
Cc Igor Grinberg <[email protected]>
---
 arch/arm/mach-omap2/timer.c |    3 +++
 1 file changed, 3 insertions(+)

Jon,

I applied all these patches and it fixes build warning and also I have tested it on Bone platform without any issues.

I also ran parse on this and saw further warning,

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?

Below patch fixes that too, feel free to merge it into your's

arch/arm/mach-omap2/timer.c +0 -0
index 085c7e7..1d1cfec 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;

Thanks,
Vaibhav