Skip to contentSkip to conversation

e1000e: Squash an unused function warning

PATCH In review Palmer Dabbelt 2 participants 2 messages Jun 10, 2020

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

PATCH 1/1 e1000e: Squash an unused function warning

From: Palmer Dabbelt <[email protected]>

e1000e_check_me is only used under CONFIG_PM_SLEEP but exists unconditionally, which triggers a warning.

---
 drivers/net/ethernet/intel/e1000e/netdev.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/ethernet/intel/e1000e/netdev.c +2 -0
index a279f4fa9962..f7148d1fcba2 100644
@@ -134,6 +134,7 @@ static const struct e1000e_me_supported me_supported[] = {
 	{0}
 };
 
+#ifdef CONFIG_PM_SLEEP
 static bool e1000e_check_me(u16 device_id)
 {
 	struct e1000e_me_supported *id;
@@ -145,6 +146,7 @@ static bool e1000e_check_me(u16 device_id)
 
 	return false;
 }
+#endif
 
 /**
  * __ew32_prepare - prepare to write to MAC CSR register on certain parts
Signature · 1 line
2.27.0.278.ge193c7cf3a9-goog
#1 lore raw
Quoted 15 lines · Palmer Dabbelt

From: Palmer Dabbelt <[email protected]>

e1000e_check_me is only used under CONFIG_PM_SLEEP but exists unconditionally, which triggers a warning.

---
  drivers/net/ethernet/intel/e1000e/netdev.c | 2 ++
  1 file changed, 2 insertions(+)
drivers/net/ethernet/intel/e1000e/netdev.c +0 -0
index a279f4fa9962..f7148d1fcba2 100644

drivers/net/ethernet/intel/e1000e/netdev.c static const struct e1000e_me_supported me_supported[] = { · line 137

Quoted 4 lines
drivers/net/ethernet/intel/e1000e/netdev.c +1 -0
@@ -134,6 +134,7 @@ static const struct e1000e_me_supported me_supported[] = {
  	{0}
  };
 
+#ifdef CONFIG_PM_SLEEP

Thanks Palmer for catching this warning,
can we use "__maybe_unused" declaration instead of wrapping? I think it is more convenient and consistent.

Quoted 12 lines
drivers/net/ethernet/intel/e1000e/netdev.c +1 -0
  static bool e1000e_check_me(u16 device_id)
  {
  	struct e1000e_me_supported *id;
@@ -145,6 +146,7 @@ static bool e1000e_check_me(u16 device_id)
 
  	return false;
  }
+#endif
 
  /**
   * __ew32_prepare - prepare to write to MAC CSR register on certain parts