Commit 6b8326ed14683f641e1c4149197f23a48c7cee36
Committed by
David S. Miller
1 parent
703068eee6
tipc: remove tipc_core_start/stop routines
Remove redundant wrapper functions like tipc_core_start() and tipc_core_stop(), and directly move them to their callers, such as tipc_init() and tipc_exit(), having us clearly know what are really done in both initialization and deinitialzation functions. Signed-off-by: Ying Xue <ying.xue@windriver.com> Tested-by: Tero Aho <Tero.Aho@coriant.com> Reviewed-by: Jon Maloy <jon.maloy@ericsson.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Showing 1 changed file with 23 additions and 43 deletions Side-by-side Diff
net/tipc/core.c
... | ... | @@ -75,28 +75,21 @@ |
75 | 75 | return skb; |
76 | 76 | } |
77 | 77 | |
78 | -/** | |
79 | - * tipc_core_stop - switch TIPC from SINGLE NODE to NOT RUNNING mode | |
80 | - */ | |
81 | -static void tipc_core_stop(void) | |
78 | +static int __init tipc_init(void) | |
82 | 79 | { |
83 | - tipc_net_stop(); | |
84 | - tipc_bearer_cleanup(); | |
85 | - tipc_netlink_stop(); | |
86 | - tipc_subscr_stop(); | |
87 | - tipc_nametbl_stop(); | |
88 | - tipc_socket_stop(); | |
89 | - tipc_unregister_sysctl(); | |
90 | - tipc_sk_rht_destroy(); | |
91 | -} | |
92 | - | |
93 | -/** | |
94 | - * tipc_core_start - switch TIPC from NOT RUNNING to SINGLE NODE mode | |
95 | - */ | |
96 | -static int tipc_core_start(void) | |
97 | -{ | |
98 | 80 | int err; |
99 | 81 | |
82 | + pr_info("Activated (version " TIPC_MOD_VER ")\n"); | |
83 | + | |
84 | + tipc_own_addr = 0; | |
85 | + tipc_net_id = 4711; | |
86 | + | |
87 | + sysctl_tipc_rmem[0] = TIPC_CONN_OVERLOAD_LIMIT >> 4 << | |
88 | + TIPC_LOW_IMPORTANCE; | |
89 | + sysctl_tipc_rmem[1] = TIPC_CONN_OVERLOAD_LIMIT >> 4 << | |
90 | + TIPC_CRITICAL_IMPORTANCE; | |
91 | + sysctl_tipc_rmem[2] = TIPC_CONN_OVERLOAD_LIMIT; | |
92 | + | |
100 | 93 | get_random_bytes(&tipc_random, sizeof(tipc_random)); |
101 | 94 | |
102 | 95 | err = tipc_sk_rht_init(); |
... | ... | @@ -127,6 +120,7 @@ |
127 | 120 | if (err) |
128 | 121 | goto out_bearer; |
129 | 122 | |
123 | + pr_info("Started in single node mode\n"); | |
130 | 124 | return 0; |
131 | 125 | out_bearer: |
132 | 126 | tipc_subscr_stop(); |
133 | 127 | |
134 | 128 | |
... | ... | @@ -141,35 +135,21 @@ |
141 | 135 | out_nametbl: |
142 | 136 | tipc_sk_rht_destroy(); |
143 | 137 | out_reftbl: |
138 | + pr_err("Unable to start in single node mode\n"); | |
144 | 139 | return err; |
145 | 140 | } |
146 | 141 | |
147 | -static int __init tipc_init(void) | |
148 | -{ | |
149 | - int res; | |
150 | - | |
151 | - pr_info("Activated (version " TIPC_MOD_VER ")\n"); | |
152 | - | |
153 | - tipc_own_addr = 0; | |
154 | - tipc_net_id = 4711; | |
155 | - | |
156 | - sysctl_tipc_rmem[0] = TIPC_CONN_OVERLOAD_LIMIT >> 4 << | |
157 | - TIPC_LOW_IMPORTANCE; | |
158 | - sysctl_tipc_rmem[1] = TIPC_CONN_OVERLOAD_LIMIT >> 4 << | |
159 | - TIPC_CRITICAL_IMPORTANCE; | |
160 | - sysctl_tipc_rmem[2] = TIPC_CONN_OVERLOAD_LIMIT; | |
161 | - | |
162 | - res = tipc_core_start(); | |
163 | - if (res) | |
164 | - pr_err("Unable to start in single node mode\n"); | |
165 | - else | |
166 | - pr_info("Started in single node mode\n"); | |
167 | - return res; | |
168 | -} | |
169 | - | |
170 | 142 | static void __exit tipc_exit(void) |
171 | 143 | { |
172 | - tipc_core_stop(); | |
144 | + tipc_net_stop(); | |
145 | + tipc_bearer_cleanup(); | |
146 | + tipc_netlink_stop(); | |
147 | + tipc_subscr_stop(); | |
148 | + tipc_nametbl_stop(); | |
149 | + tipc_socket_stop(); | |
150 | + tipc_unregister_sysctl(); | |
151 | + tipc_sk_rht_destroy(); | |
152 | + | |
173 | 153 | pr_info("Deactivated\n"); |
174 | 154 | } |
175 | 155 |