diff mbox

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

Message ID 1354068915-3378-2-git-send-email-jon-hunter@ti.com
State New
Headers show

Commit Message

Hunter, Jon Nov. 28, 2012, 2:15 a.m. UTC
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 <santosh.shilimkar@ti.com>

Reported-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Jon Hunter <jon-hunter@ti.com>
---
 arch/arm/mach-omap2/Kconfig |    4 ----
 arch/arm/mach-omap2/timer.c |    7 ++-----
 2 files changed, 2 insertions(+), 9 deletions(-)

Comments

Santosh Shilimkar Nov. 28, 2012, 3:55 p.m. UTC | #1
On Wednesday 28 November 2012 09:17 PM, Jon Hunter wrote:
>
> On 11/28/2012 12:09 AM, Santosh Shilimkar wrote:
>> On Wednesday 28 November 2012 07:45 AM, Jon Hunter wrote:
>>> 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 <santosh.shilimkar@ti.com>
>>>
>>> Reported-by: Tony Lindgren <tony@atomide.com>
>>> Signed-off-by: Jon Hunter <jon-hunter@ti.com>
>>> ---
>> 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 <santosh.shilimkar@ti.com>
>> 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 <jon-hunter@ti.com>
>>
>> Reported-by: Tony Lindgren <tony@atomide.com>
>> Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
>> ---
>>   arch/arm/mach-omap2/timer.c |    3 ---
>>   1 file changed, 3 deletions(-)
>>
>> diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c
>> index 69e4663..79d8e6b 100644
>> --- a/arch/arm/mach-omap2/timer.c
>> +++ b/arch/arm/mach-omap2/timer.c
>> @@ -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.
>
I did mention that but since OMAP5 selects the feature, I was thinking
it is fine.

> 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 ...
>
> diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
> index 813c267..500f2f6 100644
> --- a/arch/arm/mach-omap2/Kconfig
> +++ b/arch/arm/mach-omap2/Kconfig
> @@ -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.
>
Go ahead and fold above change on top of my patch which
drops the stub.

Regards
Santosh
Hunter, Jon Nov. 28, 2012, 4:01 p.m. UTC | #2
On 11/28/2012 09:55 AM, Santosh Shilimkar wrote:
> On Wednesday 28 November 2012 09:17 PM, Jon Hunter wrote:
>>
>> On 11/28/2012 12:09 AM, Santosh Shilimkar wrote:
>>> On Wednesday 28 November 2012 07:45 AM, Jon Hunter wrote:
>>>> 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 <santosh.shilimkar@ti.com>
>>>>
>>>> Reported-by: Tony Lindgren <tony@atomide.com>
>>>> Signed-off-by: Jon Hunter <jon-hunter@ti.com>
>>>> ---
>>> 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 <santosh.shilimkar@ti.com>
>>> 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 <jon-hunter@ti.com>
>>>
>>> Reported-by: Tony Lindgren <tony@atomide.com>
>>> Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
>>> ---
>>>   arch/arm/mach-omap2/timer.c |    3 ---
>>>   1 file changed, 3 deletions(-)
>>>
>>> diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c
>>> index 69e4663..79d8e6b 100644
>>> --- a/arch/arm/mach-omap2/timer.c
>>> +++ b/arch/arm/mach-omap2/timer.c
>>> @@ -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.
>>
> I did mention that but since OMAP5 selects the feature, I was thinking
> it is fine.
> 
>> 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 ...
>>
>> diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
>> index 813c267..500f2f6 100644
>> --- a/arch/arm/mach-omap2/Kconfig
>> +++ b/arch/arm/mach-omap2/Kconfig
>> @@ -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.
>>
> 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
Santosh Shilimkar Nov. 28, 2012, 4:04 p.m. UTC | #3
On Wednesday 28 November 2012 09:17 PM, Jon Hunter wrote:
>
> On 11/28/2012 12:09 AM, Santosh Shilimkar wrote:
>> On Wednesday 28 November 2012 07:45 AM, Jon Hunter wrote:
>>> 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 <santosh.shilimkar@ti.com>
>>>
>>> Reported-by: Tony Lindgren <tony@atomide.com>
>>> Signed-off-by: Jon Hunter <jon-hunter@ti.com>
>>> ---
>> 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 <santosh.shilimkar@ti.com>
>> 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 <jon-hunter@ti.com>
>>
>> Reported-by: Tony Lindgren <tony@atomide.com>
>> Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
>> ---
>>   arch/arm/mach-omap2/timer.c |    3 ---
>>   1 file changed, 3 deletions(-)
>>
>> diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c
>> index 69e4663..79d8e6b 100644
>> --- a/arch/arm/mach-omap2/timer.c
>> +++ b/arch/arm/mach-omap2/timer.c
>> @@ -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.
>
Yes. For the same reason initially, the stub was added.

> 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 ...
>
> diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
> index 813c267..500f2f6 100644
> --- a/arch/arm/mach-omap2/Kconfig
> +++ b/arch/arm/mach-omap2/Kconfig
> @@ -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.
>
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
Santosh Shilimkar Nov. 28, 2012, 4:06 p.m. UTC | #4
On Wednesday 28 November 2012 09:31 PM, Jon Hunter wrote:
>
> On 11/28/2012 09:55 AM, Santosh Shilimkar wrote:
>> On Wednesday 28 November 2012 09:17 PM, Jon Hunter wrote:
>>>
>>> On 11/28/2012 12:09 AM, Santosh Shilimkar wrote:
>>>> On Wednesday 28 November 2012 07:45 AM, Jon Hunter wrote:
>>>>> 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 <santosh.shilimkar@ti.com>
>>>>>
>>>>> Reported-by: Tony Lindgren <tony@atomide.com>
>>>>> Signed-off-by: Jon Hunter <jon-hunter@ti.com>
>>>>> ---
>>>> 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 <santosh.shilimkar@ti.com>
>>>> 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 <jon-hunter@ti.com>
>>>>
>>>> Reported-by: Tony Lindgren <tony@atomide.com>
>>>> Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
>>>> ---
>>>>    arch/arm/mach-omap2/timer.c |    3 ---
>>>>    1 file changed, 3 deletions(-)
>>>>
>>>> diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c
>>>> index 69e4663..79d8e6b 100644
>>>> --- a/arch/arm/mach-omap2/timer.c
>>>> +++ b/arch/arm/mach-omap2/timer.c
>>>> @@ -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.
>>>
>> I did mention that but since OMAP5 selects the feature, I was thinking
>> it is fine.
>>
>>> 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 ...
>>>
>>> diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
>>> index 813c267..500f2f6 100644
>>> --- a/arch/arm/mach-omap2/Kconfig
>>> +++ b/arch/arm/mach-omap2/Kconfig
>>> @@ -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.
>>>
>> 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.

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

Patch

diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
index 813c267..ea88b7d 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -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"
diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c
index b9cff72..a9f99e3 100644
--- a/arch/arm/mach-omap2/timer.c
+++ b/arch/arm/mach-omap2/timer.c
@@ -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)			\