diff mbox series

[net-next,v2] net: tulip: avoid unused variable warning

Message ID 20250313-tulip-w1-v2-1-2ac0d3d909f9@kernel.org (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series [net-next,v2] net: tulip: avoid unused variable warning | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers warning 1 maintainers not CCed: viro@zeniv.linux.org.uk
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/verify_signedoff fail author Signed-off-by missing
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 26 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Simon Horman March 13, 2025, 10:47 a.m. UTC
There is an effort to achieve W=1 kernel builds without warnings.
As part of that effort Helge Deller highlighted the following warnings
in the tulip driver when compiling with W=1 and CONFIG_TULIP_MWI=n:

  .../tulip_core.c: In function ‘tulip_init_one’:
  .../tulip_core.c:1309:22: warning: variable ‘force_csr0’ set but not used

This patch addresses that problem using IS_ENABLED(). This approach has
the added benefit of reducing conditionally compiled code. And thus
increasing compile coverage. E.g. for allmodconfig builds which enable
CONFIG_TULIP_MWI.

Compile tested only.
No run-time effect intended.

--

Acked-by: Helge Deller <deller@gmx.de>
Signed-off-by: Simon Horman <horms@kernel.org>
v2: Use IS_ENABLED rather than __maybe_unused [Simon Horman]
v1: Initial patch [Helge Deller]
---
 drivers/net/ethernet/dec/tulip/tulip_core.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

Comments

Simon Horman March 13, 2025, 10:54 a.m. UTC | #1
On Thu, Mar 13, 2025 at 11:47:42AM +0100, Simon Horman wrote:
> There is an effort to achieve W=1 kernel builds without warnings.
> As part of that effort Helge Deller highlighted the following warnings
> in the tulip driver when compiling with W=1 and CONFIG_TULIP_MWI=n:
> 
>   .../tulip_core.c: In function ‘tulip_init_one’:
>   .../tulip_core.c:1309:22: warning: variable ‘force_csr0’ set but not used
> 
> This patch addresses that problem using IS_ENABLED(). This approach has
> the added benefit of reducing conditionally compiled code. And thus
> increasing compile coverage. E.g. for allmodconfig builds which enable
> CONFIG_TULIP_MWI.
> 
> Compile tested only.
> No run-time effect intended.
> 
> --
> 
> Acked-by: Helge Deller <deller@gmx.de>
> Signed-off-by: Simon Horman <horms@kernel.org>
> v2: Use IS_ENABLED rather than __maybe_unused [Simon Horman]
> v1: Initial patch [Helge Deller]

Sorry, the tail of the commit message got a bit mangled.
I'll post a v3 after waiting for other feedback.
diff mbox series

Patch

diff --git a/drivers/net/ethernet/dec/tulip/tulip_core.c b/drivers/net/ethernet/dec/tulip/tulip_core.c
index 27e01d780cd0..75eac18ff246 100644
--- a/drivers/net/ethernet/dec/tulip/tulip_core.c
+++ b/drivers/net/ethernet/dec/tulip/tulip_core.c
@@ -1177,7 +1177,6 @@  static void set_rx_mode(struct net_device *dev)
 	iowrite32(csr6, ioaddr + CSR6);
 }
 
-#ifdef CONFIG_TULIP_MWI
 static void tulip_mwi_config(struct pci_dev *pdev, struct net_device *dev)
 {
 	struct tulip_private *tp = netdev_priv(dev);
@@ -1251,7 +1250,6 @@  static void tulip_mwi_config(struct pci_dev *pdev, struct net_device *dev)
 		netdev_dbg(dev, "MWI config cacheline=%d, csr0=%08x\n",
 			   cache, csr0);
 }
-#endif
 
 /*
  *	Chips that have the MRM/reserved bit quirk and the burst quirk. That
@@ -1463,10 +1461,9 @@  static int tulip_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 
 	INIT_WORK(&tp->media_work, tulip_tbl[tp->chip_id].media_task);
 
-#ifdef CONFIG_TULIP_MWI
-	if (!force_csr0 && (tp->flags & HAS_PCI_MWI))
+	if (IS_ENABLED(CONFIG_TULIP_MWI) && !force_csr0 &&
+	    (tp->flags & HAS_PCI_MWI))
 		tulip_mwi_config (pdev, dev);
-#endif
 
 	/* Stop the chip's Tx and Rx processes. */
 	tulip_stop_rxtx(tp);