Collect all code used only when CONFIG_SYSCTL=y into a single block and
wrap it in #ifdef CONFIG_SYSCTL. rds_ib_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 <oleg@redhat.com>
---
net/rds/ib_sysctl.c | 33 +++++++++++++++++++++++----------
1 file changed, 23 insertions(+), 10 deletions(-)
diff --git a/net/rds/ib_sysctl.c b/net/rds/ib_sysctl.c
index bc97a3eecad6..0b336ff03ae9 100644
--- a/net/rds/ib_sysctl.c
+++ b/net/rds/ib_sysctl.c
@@ -36,19 +36,10 @@
#include "ib.h"
-static struct ctl_table_header *rds_ib_sysctl_hdr;
-
unsigned long rds_ib_sysctl_max_send_wr = RDS_IB_DEFAULT_SEND_WR;
unsigned long rds_ib_sysctl_max_recv_wr = RDS_IB_DEFAULT_RECV_WR;
unsigned long rds_ib_sysctl_max_recv_allocation = (128 * 1024 * 1024) / RDS_FRAG_SIZE;
-static unsigned long rds_ib_sysctl_max_wr_min = 1;
-/* hardware will fail CQ creation long before this */
-static unsigned long rds_ib_sysctl_max_wr_max = (u32)~0;
-
unsigned long rds_ib_sysctl_max_unsig_wrs = 16;
-static unsigned long rds_ib_sysctl_max_unsig_wr_min = 1;
-static unsigned long rds_ib_sysctl_max_unsig_wr_max = 64;
-
/*
* This sysctl does nothing.
*
@@ -61,6 +52,14 @@ static unsigned long rds_ib_sysctl_max_unsig_wr_max = 64;
*/
unsigned int rds_ib_sysctl_flow_control = 0;
+#ifdef CONFIG_SYSCTL
+static unsigned long rds_ib_sysctl_max_wr_min = 1;
+/* hardware will fail CQ creation long before this */
+static unsigned long rds_ib_sysctl_max_wr_max = (u32)~0;
+
+static unsigned long rds_ib_sysctl_max_unsig_wr_min = 1;
+static unsigned long rds_ib_sysctl_max_unsig_wr_max = 64;
+
static struct ctl_table rds_ib_sysctl_table[] = {
{
.procname = "max_send_wr",@@ -105,6 +104,8 @@ static struct ctl_table rds_ib_sysctl_table[] = {
},
};
+static struct ctl_table_header *rds_ib_sysctl_hdr;
+
void rds_ib_sysctl_exit(void)
{
if (rds_ib_sysctl_hdr)@@ -114,7 +115,19 @@ void rds_ib_sysctl_exit(void)
int rds_ib_sysctl_init(void)
{
rds_ib_sysctl_hdr = register_net_sysctl(&init_net, "net/rds/ib", rds_ib_sysctl_table);
- if (!rds_ib_sysctl_hdr && IS_ENABLED(CONFIG_SYSCTL))
+ if (!rds_ib_sysctl_hdr)
return -ENOMEM;
return 0;
}
+
+#else
+
+int rds_ib_sysctl_init(void)
+{
+ return 0;
+}
+
+void rds_ib_sysctl_exit(void)
+{
+}
+#endif--
2.55.0