Collect all code used only when CONFIG_SYSCTL=y into a single block and wrap it in #ifdef CONFIG_SYSCTL. rds_sysctl_init() no longer needs the IS_ENABLED() check. Add the corresponding init/exit stubs for the CONFIG_SYSCTL=n case. Signed-off-by: Oleg Nesterov --- net/rds/sysctl.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/net/rds/sysctl.c b/net/rds/sysctl.c index 968d6279bbd3..47e8782b1aa3 100644 --- a/net/rds/sysctl.c +++ b/net/rds/sysctl.c @@ -36,11 +36,6 @@ #include "rds.h" -static struct ctl_table_header *rds_sysctl_reg_table; - -static unsigned long rds_sysctl_reconnect_min = 1; -static unsigned long rds_sysctl_reconnect_max = ~0UL; - unsigned long rds_sysctl_reconnect_min_jiffies; unsigned long rds_sysctl_reconnect_max_jiffies = HZ; @@ -49,6 +44,10 @@ unsigned int rds_sysctl_max_unacked_bytes = (16 << 20); unsigned int rds_sysctl_ping_enable = 1; +#ifdef CONFIG_SYSCTL +static unsigned long rds_sysctl_reconnect_min = 1; +static unsigned long rds_sysctl_reconnect_max = ~0UL; + static struct ctl_table rds_sysctl_rds_table[] = { { .procname = "reconnect_min_delay_ms", @@ -91,6 +90,8 @@ static struct ctl_table rds_sysctl_rds_table[] = { }, }; +static struct ctl_table_header *rds_sysctl_reg_table; + void rds_sysctl_exit(void) { unregister_net_sysctl_table(rds_sysctl_reg_table); @@ -103,7 +104,20 @@ int rds_sysctl_init(void) rds_sysctl_reg_table = register_net_sysctl(&init_net, "net/rds", rds_sysctl_rds_table); - if (!rds_sysctl_reg_table && IS_ENABLED(CONFIG_SYSCTL)) + if (!rds_sysctl_reg_table) return -ENOMEM; return 0; } + +#else + +int rds_sysctl_init(void) +{ + rds_sysctl_reconnect_min_jiffies = msecs_to_jiffies(1); + return 0; +} + +void rds_sysctl_exit(void) +{ +} +#endif -- 2.55.0