Skip to content

Commit 1f7a4f9

Browse files
arndbAnna Schumaker
authored andcommitted
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 <jlayton@kernel.org> Acked-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Anna Schumaker <anna.schumaker@oracle.com>
1 parent 7a2f6f7 commit 1f7a4f9

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
@@ -1674,12 +1674,14 @@ static void remove_cache_proc_entries(struct cache_detail *cd)
16741674
}
16751675
}
16761676

1677-
#ifdef CONFIG_PROC_FS
16781677
static int create_cache_proc_entries(struct cache_detail *cd, struct net *net)
16791678
{
16801679
struct proc_dir_entry *p;
16811680
struct sunrpc_net *sn;
16821681

1682+
if (!IS_ENABLED(CONFIG_PROC_FS))
1683+
return 0;
1684+
16831685
sn = net_generic(net, sunrpc_net_id);
16841686
cd->procfs = proc_mkdir(cd->name, sn->proc_net_rpc);
16851687
if (cd->procfs == NULL)
@@ -1707,12 +1709,6 @@ static int create_cache_proc_entries(struct cache_detail *cd, struct net *net)
17071709
remove_cache_proc_entries(cd);
17081710
return -ENOMEM;
17091711
}
1710-
#else /* CONFIG_PROC_FS */
1711-
static int create_cache_proc_entries(struct cache_detail *cd, struct net *net)
1712-
{
1713-
return 0;
1714-
}
1715-
#endif
17161712

17171713
void __init cache_initialize(void)
17181714
{

0 commit comments

Comments
 (0)