diff options
author | Ying Xue <ying.xue@windriver.com> | 2015-01-09 02:26:59 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-01-12 16:24:31 -0500 |
commit | 6b8326ed14683f641e1c4149197f23a48c7cee36 (patch) | |
tree | 4f4726b8f205e70c99e17ed3225a823da8b0da8d /net/tipc | |
parent | 703068eee6dde2ab318048f976b6ebd7fd239a78 (diff) |
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>
Diffstat (limited to 'net/tipc')
-rw-r--r-- | net/tipc/core.c | 66 |
1 files changed, 23 insertions, 43 deletions
diff --git a/net/tipc/core.c b/net/tipc/core.c index 71b2ada0f5ab..10bc0bf909e4 100644 --- a/net/tipc/core.c +++ b/net/tipc/core.c | |||
@@ -75,28 +75,21 @@ struct sk_buff *tipc_buf_acquire(u32 size) | |||
75 | return skb; | 75 | return skb; |
76 | } | 76 | } |
77 | 77 | ||
78 | /** | 78 | static int __init tipc_init(void) |
79 | * tipc_core_stop - switch TIPC from SINGLE NODE to NOT RUNNING mode | ||
80 | */ | ||
81 | static void tipc_core_stop(void) | ||
82 | { | ||
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 | { | 79 | { |
98 | int err; | 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 | get_random_bytes(&tipc_random, sizeof(tipc_random)); | 93 | get_random_bytes(&tipc_random, sizeof(tipc_random)); |
101 | 94 | ||
102 | err = tipc_sk_rht_init(); | 95 | err = tipc_sk_rht_init(); |
@@ -127,6 +120,7 @@ static int tipc_core_start(void) | |||
127 | if (err) | 120 | if (err) |
128 | goto out_bearer; | 121 | goto out_bearer; |
129 | 122 | ||
123 | pr_info("Started in single node mode\n"); | ||
130 | return 0; | 124 | return 0; |
131 | out_bearer: | 125 | out_bearer: |
132 | tipc_subscr_stop(); | 126 | tipc_subscr_stop(); |
@@ -141,35 +135,21 @@ out_netlink: | |||
141 | out_nametbl: | 135 | out_nametbl: |
142 | tipc_sk_rht_destroy(); | 136 | tipc_sk_rht_destroy(); |
143 | out_reftbl: | 137 | out_reftbl: |
138 | pr_err("Unable to start in single node mode\n"); | ||
144 | return err; | 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 | static void __exit tipc_exit(void) | 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 | pr_info("Deactivated\n"); | 153 | pr_info("Deactivated\n"); |
174 | } | 154 | } |
175 | 155 | ||