net: dsa: Fix build warning for !PM_SLEEP
Subsystems (3)
PATCH 1/1 net: dsa: Fix build warning for !PM_SLEEP
From: Thierry Reding <[email protected]>
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.
--- net/dsa/dsa.c | 2 ++ 1 file changed, 2 insertions(+)
net/dsa/dsa.c +2 -0
@@ -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 *************************************************************/
Signature · 1 line
2.1.0
Quoted 24 lines · Thierry Reding
From: Thierry Reding <[email protected]>
The
dsa_switch_suspend()anddsa_switch_resume()functions are only used whenPM_SLEEPis enabled, so they need #ifdefCONFIG_PM_SLEEPprotection to avoid a compiler warning.Signed-off-by Thierry Reding <[email protected]>--- net/dsa/dsa.c | 2 ++ 1 file changed, 2 insertions(+)net/dsa/dsa.c +1
-0@@ -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 ;
net/dsa/dsa.c static int dsa_switch_resume(struct dsa_switch *ds) · line 284
Quoted 4 lines
net/dsa/dsa.c +1
-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.
Quoted 26 lines · Fabio Estevam
Quoted 25 lines · Thierry Reding
From: Thierry Reding <[email protected]>
The
dsa_switch_suspend()anddsa_switch_resume()functions are only used whenPM_SLEEPis enabled, so they need #ifdefCONFIG_PM_SLEEPprotection to avoid a compiler warning.Signed-off-by Thierry Reding <[email protected]>--- net/dsa/dsa.c | 2 ++ 1 file changed, 2 insertions(+)net/dsa/dsa.c +1
-0@@ -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)
Quoted 5 lines
net/dsa/dsa.c static int dsa_switch_resume(struct dsa_switch *ds) · line 284
Quoted 3 lines
net/dsa/dsa.c +1
-0return 0; } +#endif You could also mark them as
__maybe_unusedand 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
Quoted 7 lines · Thierry Reding
From: Thierry Reding <[email protected]>
The
dsa_switch_suspend()anddsa_switch_resume()functions are only used whenPM_SLEEPis enabled, so they need #ifdefCONFIG_PM_SLEEPprotection to avoid a compiler warning.Signed-off-by Thierry Reding <[email protected]>
Thanks Thierry!
Quoted 25 lines
--- net/dsa/dsa.c | 2 ++ 1 file changed, 2 insertions(+)net/dsa/dsa.c +2
-0@@ -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 *************************************************************/
From: Thierry Reding <[email protected]>
Date: Wed, 1 Oct 2014 13:59:00 +0200
Quoted 7 lines
From: Thierry Reding <[email protected]>
The
dsa_switch_suspend()anddsa_switch_resume()functions are only used whenPM_SLEEPis enabled, so they need #ifdefCONFIG_PM_SLEEPprotection to avoid a compiler warning.Signed-off-by Thierry Reding <[email protected]>
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.
Quoted 9 lines · David Miller
From: Thierry Reding <[email protected]>
Date: Wed, 1 Oct 2014 13:59:00 +0200Quoted 6 lines
From: Thierry Reding <[email protected]>
The
dsa_switch_suspend()anddsa_switch_resume()functions are only used whenPM_SLEEPis enabled, so they need #ifdefCONFIG_PM_SLEEPprotection to avoid a compiler warning.
Quoted 7 lines
Quoted 1 line
Signed-off-by Thierry Reding <[email protected]>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