All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ARM: shmobile: apmu: silence build warnings
@ 2015-07-10 20:48 Wolfram Sang
  2015-07-13  1:04 ` Simon Horman
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Wolfram Sang @ 2015-07-10 20:48 UTC (permalink / raw)
  To: linux-sh

From: Wolfram Sang <wsa+renesas@sang-engineering.com>

With shmobile_defconfig but SMP=n && SUSPEND=n, I get:

arch/arm/mach-shmobile/platsmp-apmu.c:49:12: warning: 'apmu_power_off' defined but not used [-Wunused-function]
arch/arm/mach-shmobile/platsmp-apmu.c:70:12: warning: 'apmu_wrap' defined but not used [-Wunused-function]

Annotate those functions like the functions around it.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 arch/arm/mach-shmobile/platsmp-apmu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-shmobile/platsmp-apmu.c b/arch/arm/mach-shmobile/platsmp-apmu.c
index b0790fc3228244..4e54512bee3083 100644
--- a/arch/arm/mach-shmobile/platsmp-apmu.c
+++ b/arch/arm/mach-shmobile/platsmp-apmu.c
@@ -46,7 +46,7 @@ static int __maybe_unused apmu_power_on(void __iomem *p, int bit)
 	return 0;
 }
 
-static int apmu_power_off(void __iomem *p, int bit)
+static int __maybe_unused apmu_power_off(void __iomem *p, int bit)
 {
 	/* request Core Standby for next WFI */
 	writel_relaxed(3, p + CPUNCR_OFFS(bit));
@@ -67,7 +67,7 @@ static int __maybe_unused apmu_power_off_poll(void __iomem *p, int bit)
 	return 0;
 }
 
-static int apmu_wrap(int cpu, int (*fn)(void __iomem *p, int cpu))
+static int __maybe_unused apmu_wrap(int cpu, int (*fn)(void __iomem *p, int cpu))
 {
 	void __iomem *p = apmu_cpus[cpu].iomem;
 
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] ARM: shmobile: apmu: silence build warnings
  2015-07-10 20:48 [PATCH] ARM: shmobile: apmu: silence build warnings Wolfram Sang
@ 2015-07-13  1:04 ` Simon Horman
  2015-07-13  8:58 ` Wolfram Sang
  2015-07-14  7:35 ` Simon Horman
  2 siblings, 0 replies; 6+ messages in thread
From: Simon Horman @ 2015-07-13  1:04 UTC (permalink / raw)
  To: linux-sh

Hi Wolfram,

On Fri, Jul 10, 2015 at 10:48:16PM +0200, Wolfram Sang wrote:
> From: Wolfram Sang <wsa+renesas@sang-engineering.com>
> 
> With shmobile_defconfig but SMP=n && SUSPEND=n, I get:
> 
> arch/arm/mach-shmobile/platsmp-apmu.c:49:12: warning: 'apmu_power_off' defined but not used [-Wunused-function]
> arch/arm/mach-shmobile/platsmp-apmu.c:70:12: warning: 'apmu_wrap' defined but not used [-Wunused-function]
> 
> Annotate those functions like the functions around it.

thanks for noticing this.

I'm not familiar with when it is appropriate to use __maybe_unused but does
anything speak against using #if as per the conditional compilation of the
callers in platsmp-apmu.c of the above functions?

diff --git a/arch/arm/mach-shmobile/platsmp-apmu.c b/arch/arm/mach-shmobile/platsmp-apmu.c
index b0790fc32282..54cf153b570f 100644
--- a/arch/arm/mach-shmobile/platsmp-apmu.c
+++ b/arch/arm/mach-shmobile/platsmp-apmu.c
@@ -46,12 +46,14 @@ static int __maybe_unused apmu_power_on(void __iomem *p, int bit)
 	return 0;
 }
 
+#if defined(CONFIG_HOTPLUG_CPU) || defined(CONFIG_SUSPEND)
 static int apmu_power_off(void __iomem *p, int bit)
 {
 	/* request Core Standby for next WFI */
 	writel_relaxed(3, p + CPUNCR_OFFS(bit));
 	return 0;
 }
+#endif
 
 static int __maybe_unused apmu_power_off_poll(void __iomem *p, int bit)
 {
@@ -67,12 +69,14 @@ static int __maybe_unused apmu_power_off_poll(void __iomem *p, int bit)
 	return 0;
 }
 
+#if defined(CONFIG_HOTPLUG_CPU) || defined(CONFIG_SUSPEND) || defined(CONFIG_SMP)
 static int apmu_wrap(int cpu, int (*fn)(void __iomem *p, int cpu))
 {
 	void __iomem *p = apmu_cpus[cpu].iomem;
 
 	return p ? fn(p, apmu_cpus[cpu].bit) : -EINVAL;
 }
+#endif
 
 static void apmu_init_cpu(struct resource *res, int cpu, int bit)
 {

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] ARM: shmobile: apmu: silence build warnings
  2015-07-10 20:48 [PATCH] ARM: shmobile: apmu: silence build warnings Wolfram Sang
  2015-07-13  1:04 ` Simon Horman
@ 2015-07-13  8:58 ` Wolfram Sang
  2015-07-14  7:35 ` Simon Horman
  2 siblings, 0 replies; 6+ messages in thread
From: Wolfram Sang @ 2015-07-13  8:58 UTC (permalink / raw)
  To: linux-sh

[-- Attachment #1: Type: text/plain, Size: 2488 bytes --]

On Mon, Jul 13, 2015 at 10:04:06AM +0900, Simon Horman wrote:
> Hi Wolfram,
> 
> On Fri, Jul 10, 2015 at 10:48:16PM +0200, Wolfram Sang wrote:
> > From: Wolfram Sang <wsa+renesas@sang-engineering.com>
> > 
> > With shmobile_defconfig but SMP=n && SUSPEND=n, I get:
> > 
> > arch/arm/mach-shmobile/platsmp-apmu.c:49:12: warning: 'apmu_power_off' defined but not used [-Wunused-function]
> > arch/arm/mach-shmobile/platsmp-apmu.c:70:12: warning: 'apmu_wrap' defined but not used [-Wunused-function]
> > 
> > Annotate those functions like the functions around it.
> 
> thanks for noticing this.
> 
> I'm not familiar with when it is appropriate to use __maybe_unused but does
> anything speak against using #if as per the conditional compilation of the
> callers in platsmp-apmu.c of the above functions?

I did my approach for consistency reasons. It looked to me that the
*_on/off functions wanted to be grouped at the beginning.

Your approach works but looks fragile to me as soon as the ifdeffery of
the callers change. So, we could move the code into the callers ifdef
block, but we should do this consistently, even for the functions
currently marked __maybe_unused. That would scatter them a little,
though. apmu_wrap needs its own ifdeffery in any case.

Do you have a preference?

> 
> diff --git a/arch/arm/mach-shmobile/platsmp-apmu.c b/arch/arm/mach-shmobile/platsmp-apmu.c
> index b0790fc32282..54cf153b570f 100644
> --- a/arch/arm/mach-shmobile/platsmp-apmu.c
> +++ b/arch/arm/mach-shmobile/platsmp-apmu.c
> @@ -46,12 +46,14 @@ static int __maybe_unused apmu_power_on(void __iomem *p, int bit)
>  	return 0;
>  }
>  
> +#if defined(CONFIG_HOTPLUG_CPU) || defined(CONFIG_SUSPEND)
>  static int apmu_power_off(void __iomem *p, int bit)
>  {
>  	/* request Core Standby for next WFI */
>  	writel_relaxed(3, p + CPUNCR_OFFS(bit));
>  	return 0;
>  }
> +#endif
>  
>  static int __maybe_unused apmu_power_off_poll(void __iomem *p, int bit)
>  {
> @@ -67,12 +69,14 @@ static int __maybe_unused apmu_power_off_poll(void __iomem *p, int bit)
>  	return 0;
>  }
>  
> +#if defined(CONFIG_HOTPLUG_CPU) || defined(CONFIG_SUSPEND) || defined(CONFIG_SMP)
>  static int apmu_wrap(int cpu, int (*fn)(void __iomem *p, int cpu))
>  {
>  	void __iomem *p = apmu_cpus[cpu].iomem;
>  
>  	return p ? fn(p, apmu_cpus[cpu].bit) : -EINVAL;
>  }
> +#endif
>  
>  static void apmu_init_cpu(struct resource *res, int cpu, int bit)
>  {

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] ARM: shmobile: apmu: silence build warnings
  2015-07-10 20:48 [PATCH] ARM: shmobile: apmu: silence build warnings Wolfram Sang
  2015-07-13  1:04 ` Simon Horman
  2015-07-13  8:58 ` Wolfram Sang
@ 2015-07-14  7:35 ` Simon Horman
  2 siblings, 0 replies; 6+ messages in thread
From: Simon Horman @ 2015-07-14  7:35 UTC (permalink / raw)
  To: linux-sh

On Mon, Jul 13, 2015 at 10:58:07AM +0200, Wolfram Sang wrote:
> On Mon, Jul 13, 2015 at 10:04:06AM +0900, Simon Horman wrote:
> > Hi Wolfram,
> > 
> > On Fri, Jul 10, 2015 at 10:48:16PM +0200, Wolfram Sang wrote:
> > > From: Wolfram Sang <wsa+renesas@sang-engineering.com>
> > > 
> > > With shmobile_defconfig but SMP=n && SUSPEND=n, I get:
> > > 
> > > arch/arm/mach-shmobile/platsmp-apmu.c:49:12: warning: 'apmu_power_off' defined but not used [-Wunused-function]
> > > arch/arm/mach-shmobile/platsmp-apmu.c:70:12: warning: 'apmu_wrap' defined but not used [-Wunused-function]
> > > 
> > > Annotate those functions like the functions around it.
> > 
> > thanks for noticing this.
> > 
> > I'm not familiar with when it is appropriate to use __maybe_unused but does
> > anything speak against using #if as per the conditional compilation of the
> > callers in platsmp-apmu.c of the above functions?
> 
> I did my approach for consistency reasons. It looked to me that the
> *_on/off functions wanted to be grouped at the beginning.
> 
> Your approach works but looks fragile to me as soon as the ifdeffery of
> the callers change. So, we could move the code into the callers ifdef
> block, but we should do this consistently, even for the functions
> currently marked __maybe_unused. That would scatter them a little,
> though. apmu_wrap needs its own ifdeffery in any case.
> 
> Do you have a preference?

Less fragile sounds good. I have queued up your patch.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] ARM: shmobile: apmu: silence build warnings
  2015-07-24  8:41 [GIT PULL] Second Round of Renesas ARM Based SoC Cleanup for v4.3 Simon Horman
@ 2015-07-24  8:41   ` Simon Horman
  0 siblings, 0 replies; 6+ messages in thread
From: Simon Horman @ 2015-07-24  8:41 UTC (permalink / raw)
  To: linux-arm-kernel

From: Wolfram Sang <wsa+renesas@sang-engineering.com>

With shmobile_defconfig but SMP=n && SUSPEND=n, I get:

arch/arm/mach-shmobile/platsmp-apmu.c:49:12: warning: 'apmu_power_off' defined but not used [-Wunused-function]
arch/arm/mach-shmobile/platsmp-apmu.c:70:12: warning: 'apmu_wrap' defined but not used [-Wunused-function]

Annotate those functions like the functions around it.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
 arch/arm/mach-shmobile/platsmp-apmu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-shmobile/platsmp-apmu.c b/arch/arm/mach-shmobile/platsmp-apmu.c
index b0790fc32282..4e54512bee30 100644
--- a/arch/arm/mach-shmobile/platsmp-apmu.c
+++ b/arch/arm/mach-shmobile/platsmp-apmu.c
@@ -46,7 +46,7 @@ static int __maybe_unused apmu_power_on(void __iomem *p, int bit)
 	return 0;
 }
 
-static int apmu_power_off(void __iomem *p, int bit)
+static int __maybe_unused apmu_power_off(void __iomem *p, int bit)
 {
 	/* request Core Standby for next WFI */
 	writel_relaxed(3, p + CPUNCR_OFFS(bit));
@@ -67,7 +67,7 @@ static int __maybe_unused apmu_power_off_poll(void __iomem *p, int bit)
 	return 0;
 }
 
-static int apmu_wrap(int cpu, int (*fn)(void __iomem *p, int cpu))
+static int __maybe_unused apmu_wrap(int cpu, int (*fn)(void __iomem *p, int cpu))
 {
 	void __iomem *p = apmu_cpus[cpu].iomem;
 
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH] ARM: shmobile: apmu: silence build warnings
@ 2015-07-24  8:41   ` Simon Horman
  0 siblings, 0 replies; 6+ messages in thread
From: Simon Horman @ 2015-07-24  8:41 UTC (permalink / raw)
  To: linux-arm-kernel

From: Wolfram Sang <wsa+renesas@sang-engineering.com>

With shmobile_defconfig but SMP=n && SUSPEND=n, I get:

arch/arm/mach-shmobile/platsmp-apmu.c:49:12: warning: 'apmu_power_off' defined but not used [-Wunused-function]
arch/arm/mach-shmobile/platsmp-apmu.c:70:12: warning: 'apmu_wrap' defined but not used [-Wunused-function]

Annotate those functions like the functions around it.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
 arch/arm/mach-shmobile/platsmp-apmu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-shmobile/platsmp-apmu.c b/arch/arm/mach-shmobile/platsmp-apmu.c
index b0790fc32282..4e54512bee30 100644
--- a/arch/arm/mach-shmobile/platsmp-apmu.c
+++ b/arch/arm/mach-shmobile/platsmp-apmu.c
@@ -46,7 +46,7 @@ static int __maybe_unused apmu_power_on(void __iomem *p, int bit)
 	return 0;
 }
 
-static int apmu_power_off(void __iomem *p, int bit)
+static int __maybe_unused apmu_power_off(void __iomem *p, int bit)
 {
 	/* request Core Standby for next WFI */
 	writel_relaxed(3, p + CPUNCR_OFFS(bit));
@@ -67,7 +67,7 @@ static int __maybe_unused apmu_power_off_poll(void __iomem *p, int bit)
 	return 0;
 }
 
-static int apmu_wrap(int cpu, int (*fn)(void __iomem *p, int cpu))
+static int __maybe_unused apmu_wrap(int cpu, int (*fn)(void __iomem *p, int cpu))
 {
 	void __iomem *p = apmu_cpus[cpu].iomem;
 
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-07-24  8:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-10 20:48 [PATCH] ARM: shmobile: apmu: silence build warnings Wolfram Sang
2015-07-13  1:04 ` Simon Horman
2015-07-13  8:58 ` Wolfram Sang
2015-07-14  7:35 ` Simon Horman
  -- strict thread matches above, loose matches on Subject: below --
2015-07-24  8:41 [GIT PULL] Second Round of Renesas ARM Based SoC Cleanup for v4.3 Simon Horman
2015-07-24  8:41 ` [PATCH] ARM: shmobile: apmu: silence build warnings Simon Horman
2015-07-24  8:41   ` Simon Horman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.