diff mbox

net: dsa: Fix build warning for !PM_SLEEP

Message ID 1412164740-32452-1-git-send-email-thierry.reding@gmail.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Thierry Reding Oct. 1, 2014, 11:59 a.m. UTC
From: Thierry Reding <treding@nvidia.com>

The dsa_switch_suspend() and dsa_switch_resume() functions are only used
when PM_SLEEP is enabled, so they need #ifdef CONFIG_PM_SLEEP protection
to avoid a compiler warning.

Signed-off-by: Thierry Reding <treding@nvidia.com>
---
 net/dsa/dsa.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Fabio Estevam Oct. 1, 2014, 12:19 p.m. UTC | #1
On Wed, Oct 1, 2014 at 8:59 AM, Thierry Reding <thierry.reding@gmail.com> wrote:
> From: Thierry Reding <treding@nvidia.com>
>
> The dsa_switch_suspend() and dsa_switch_resume() functions are only used
> when PM_SLEEP is enabled, so they need #ifdef CONFIG_PM_SLEEP protection
> to avoid a compiler warning.
>
> Signed-off-by: Thierry Reding <treding@nvidia.com>
> ---
>  net/dsa/dsa.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
> index 6905f2d84c44..22f34cf4cb27 100644
> --- a/net/dsa/dsa.c
> +++ b/net/dsa/dsa.c
> @@ -238,6 +238,7 @@ static void dsa_switch_destroy(struct dsa_switch *ds)
>  {
>  }
>
> +#ifdef CONFIG_PM_SLEEP
>  static int dsa_switch_suspend(struct dsa_switch *ds)
>  {
>         int i, ret = 0;
> @@ -280,6 +281,7 @@ static int dsa_switch_resume(struct dsa_switch *ds)
>
>         return 0;
>  }
> +#endif

You could also mark them as __maybe_unused and avoid the ifdef.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Thierry Reding Oct. 1, 2014, 12:50 p.m. UTC | #2
On Wed, Oct 01, 2014 at 09:19:24AM -0300, Fabio Estevam wrote:
> On Wed, Oct 1, 2014 at 8:59 AM, Thierry Reding <thierry.reding@gmail.com> wrote:
> > From: Thierry Reding <treding@nvidia.com>
> >
> > The dsa_switch_suspend() and dsa_switch_resume() functions are only used
> > when PM_SLEEP is enabled, so they need #ifdef CONFIG_PM_SLEEP protection
> > to avoid a compiler warning.
> >
> > Signed-off-by: Thierry Reding <treding@nvidia.com>
> > ---
> >  net/dsa/dsa.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
> > index 6905f2d84c44..22f34cf4cb27 100644
> > --- a/net/dsa/dsa.c
> > +++ b/net/dsa/dsa.c
> > @@ -238,6 +238,7 @@ static void dsa_switch_destroy(struct dsa_switch *ds)
> >  {
> >  }
> >
> > +#ifdef CONFIG_PM_SLEEP
> >  static int dsa_switch_suspend(struct dsa_switch *ds)
> >  {
> >         int i, ret = 0;
> > @@ -280,6 +281,7 @@ static int dsa_switch_resume(struct dsa_switch *ds)
> >
> >         return 0;
> >  }
> > +#endif
> 
> You could also mark them as __maybe_unused and avoid the ifdef.

The users of these functions, dsa_suspend() and dsa_resume(), also use
the CONFIG_PM_SLEEP protection, so this way is more consistent.

Thierry
Florian Fainelli Oct. 1, 2014, 6:13 p.m. UTC | #3
On 10/01/2014 04:59 AM, Thierry Reding wrote:
> From: Thierry Reding <treding@nvidia.com>
> 
> The dsa_switch_suspend() and dsa_switch_resume() functions are only used
> when PM_SLEEP is enabled, so they need #ifdef CONFIG_PM_SLEEP protection
> to avoid a compiler warning.
> 
> Signed-off-by: Thierry Reding <treding@nvidia.com>

Acked-by: Florian Fainelli <f.fainelli@gmail.com>

Thanks Thierry!

> ---
>  net/dsa/dsa.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
> index 6905f2d84c44..22f34cf4cb27 100644
> --- a/net/dsa/dsa.c
> +++ b/net/dsa/dsa.c
> @@ -238,6 +238,7 @@ static void dsa_switch_destroy(struct dsa_switch *ds)
>  {
>  }
>  
> +#ifdef CONFIG_PM_SLEEP
>  static int dsa_switch_suspend(struct dsa_switch *ds)
>  {
>  	int i, ret = 0;
> @@ -280,6 +281,7 @@ static int dsa_switch_resume(struct dsa_switch *ds)
>  
>  	return 0;
>  }
> +#endif
>  
>  
>  /* link polling *************************************************************/
> 

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller Oct. 1, 2014, 7:24 p.m. UTC | #4
From: Thierry Reding <thierry.reding@gmail.com>
Date: Wed,  1 Oct 2014 13:59:00 +0200

> From: Thierry Reding <treding@nvidia.com>
> 
> The dsa_switch_suspend() and dsa_switch_resume() functions are only used
> when PM_SLEEP is enabled, so they need #ifdef CONFIG_PM_SLEEP protection
> to avoid a compiler warning.
> 
> Signed-off-by: Thierry Reding <treding@nvidia.com>

Applied.

Please, in the future, explicitly indicate what tree your changes
are against.  Through trial and error I figured out that this could
only apply to net-next, but that's not a good use of my time.

Thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Thierry Reding Oct. 2, 2014, 8:35 a.m. UTC | #5
On Wed, Oct 01, 2014 at 03:24:52PM -0400, David Miller wrote:
> From: Thierry Reding <thierry.reding@gmail.com>
> Date: Wed,  1 Oct 2014 13:59:00 +0200
> 
> > From: Thierry Reding <treding@nvidia.com>
> > 
> > The dsa_switch_suspend() and dsa_switch_resume() functions are only used
> > when PM_SLEEP is enabled, so they need #ifdef CONFIG_PM_SLEEP protection
> > to avoid a compiler warning.
> > 
> > Signed-off-by: Thierry Reding <treding@nvidia.com>
> 
> Applied.
> 
> Please, in the future, explicitly indicate what tree your changes
> are against.  Through trial and error I figured out that this could
> only apply to net-next, but that's not a good use of my time.

I had assumed that working on top of linux-next is what most people were
doing anyway therefore net-next would be the default to apply patches to
unless otherwise stated.

But if this inconveniences you I'll try to remember to explicitly state
which tree it's based on in the future.

Thierry
diff mbox

Patch

diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
index 6905f2d84c44..22f34cf4cb27 100644
--- a/net/dsa/dsa.c
+++ b/net/dsa/dsa.c
@@ -238,6 +238,7 @@  static void dsa_switch_destroy(struct dsa_switch *ds)
 {
 }
 
+#ifdef CONFIG_PM_SLEEP
 static int dsa_switch_suspend(struct dsa_switch *ds)
 {
 	int i, ret = 0;
@@ -280,6 +281,7 @@  static int dsa_switch_resume(struct dsa_switch *ds)
 
 	return 0;
 }
+#endif
 
 
 /* link polling *************************************************************/