Skip to content

Commit cc6e81b

Browse files
committed
sunrpc: suppress warnings for unused procfs functions
JIRA: https://issues.redhat.com/browse/RHEL-108616 commit 1f7a4f9 Author: Arnd Bergmann <[email protected]> Date: Tue Feb 25 15:52:21 2025 +0100 sunrpc: suppress warnings for unused procfs functions There is a warning about unused variables when building with W=1 and no procfs: net/sunrpc/cache.c:1660:30: error: 'cache_flush_proc_ops' defined but not used [-Werror=unused-const-variable=] 1660 | static const struct proc_ops cache_flush_proc_ops = { | ^~~~~~~~~~~~~~~~~~~~ net/sunrpc/cache.c:1622:30: error: 'content_proc_ops' defined but not used [-Werror=unused-const-variable=] 1622 | static const struct proc_ops content_proc_ops = { | ^~~~~~~~~~~~~~~~ net/sunrpc/cache.c:1598:30: error: 'cache_channel_proc_ops' defined but not used [-Werror=unused-const-variable=] 1598 | static const struct proc_ops cache_channel_proc_ops = { | ^~~~~~~~~~~~~~~~~~~~~~ These are used inside of an #ifdef, so replacing that with an IS_ENABLED() check lets the compiler see how they are used while still dropping them during dead code elimination. Fixes: dbf847e ("knfsd: allow cache_register to return error on failure") Reviewed-by: Jeff Layton <[email protected]> Acked-by: Chuck Lever <[email protected]> Signed-off-by: Arnd Bergmann <[email protected]> Signed-off-by: Anna Schumaker <[email protected]> Signed-off-by: Benjamin Coddington <[email protected]>
1 parent afb754b commit cc6e81b

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

net/sunrpc/cache.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1680,12 +1680,14 @@ static void remove_cache_proc_entries(struct cache_detail *cd)
16801680
}
16811681
}
16821682

1683-
#ifdef CONFIG_PROC_FS
16841683
static int create_cache_proc_entries(struct cache_detail *cd, struct net *net)
16851684
{
16861685
struct proc_dir_entry *p;
16871686
struct sunrpc_net *sn;
16881687

1688+
if (!IS_ENABLED(CONFIG_PROC_FS))
1689+
return 0;
1690+
16891691
sn = net_generic(net, sunrpc_net_id);
16901692
cd->procfs = proc_mkdir(cd->name, sn->proc_net_rpc);
16911693
if (cd->procfs == NULL)
@@ -1713,12 +1715,6 @@ static int create_cache_proc_entries(struct cache_detail *cd, struct net *net)
17131715
remove_cache_proc_entries(cd);
17141716
return -ENOMEM;
17151717
}
1716-
#else /* CONFIG_PROC_FS */
1717-
static int create_cache_proc_entries(struct cache_detail *cd, struct net *net)
1718-
{
1719-
return 0;
1720-
}
1721-
#endif
17221718

17231719
void __init cache_initialize(void)
17241720
{

0 commit comments

Comments
 (0)