Skip to contentSkip to conversation

net: dsa: Fix build warning for !PM_SLEEP

PATCH Applied Thierry Reding 4 participants 6 messages Oct 1, 2014 – Oct 2, 2014

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

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
index 6905f2d84c44..22f34cf4cb27 100644
@@ -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
#1 lore raw
Quoted 24 lines · Thierry Reding

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 +1 -0
index 6905f2d84c44..22f34cf4cb27 100644
@@ -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.

#2 lore raw
Quoted 26 lines · Fabio Estevam
Quoted 25 lines · Thierry Reding

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 +1 -0
index 6905f2d84c44..22f34cf4cb27 100644
@@ -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 -0
        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

Acked-by on v1 1/1
#3 lore raw
In reply to Thierry Reding
Quoted 7 lines · Thierry Reding

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.

Thanks Thierry!

Quoted 25 lines
---
 net/dsa/dsa.c | 2 ++
 1 file changed, 2 insertions(+)
net/dsa/dsa.c +2 -0
index 6905f2d84c44..22f34cf4cb27 100644
@@ -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 *************************************************************/
maintainer Applied
#4 lore raw
In reply to Thierry Reding

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() 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.

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.

#5 lore raw
Quoted 9 lines · David Miller

From: Thierry Reding <[email protected]>
Date: Wed, 1 Oct 2014 13:59:00 +0200

Quoted 6 lines

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.

Quoted 7 lines
Quoted 1 line

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