diff options
author | Allan Stephens <allan.stephens@windriver.com> | 2011-02-25 19:11:25 -0500 |
---|---|---|
committer | Paul Gortmaker <paul.gortmaker@windriver.com> | 2011-03-13 16:35:17 -0400 |
commit | 34e46258cb9f53b41e8ffd2e9acd58e0cf64b158 (patch) | |
tree | 1cf7f8d94a825678769b186849a6f41fa6765cf9 | |
parent | 672d99e19a12b703c9e2d71ead8fb8b8a85a3886 (diff) |
tipc: manually inline net_start/stop, make assoc. vars static
Relocates network-related variables into the subsystem files where
they are now primarily used (following the recent rework of TIPC's
node table), and converts globals into locals where possible. Changes
the initialization of tipc_num_links from run-time to compile-time,
and eliminates the net_start routine that becomes empty as a result.
Also eliminates the corresponding net_stop routine by moving its
(trivial) content into the one location that called the routine.
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
-rw-r--r-- | net/tipc/net.c | 25 | ||||
-rw-r--r-- | net/tipc/net.h | 2 | ||||
-rw-r--r-- | net/tipc/node.c | 2 |
3 files changed, 6 insertions, 23 deletions
diff --git a/net/tipc/net.c b/net/tipc/net.c index cce8d086f173..8fbc7e6ae3df 100644 --- a/net/tipc/net.c +++ b/net/tipc/net.c | |||
@@ -109,22 +109,6 @@ | |||
109 | */ | 109 | */ |
110 | 110 | ||
111 | DEFINE_RWLOCK(tipc_net_lock); | 111 | DEFINE_RWLOCK(tipc_net_lock); |
112 | atomic_t tipc_num_links; | ||
113 | |||
114 | static int net_start(void) | ||
115 | { | ||
116 | atomic_set(&tipc_num_links, 0); | ||
117 | |||
118 | return 0; | ||
119 | } | ||
120 | |||
121 | static void net_stop(void) | ||
122 | { | ||
123 | struct tipc_node *node, *t_node; | ||
124 | |||
125 | list_for_each_entry_safe(node, t_node, &tipc_node_list, list) | ||
126 | tipc_node_delete(node); | ||
127 | } | ||
128 | 112 | ||
129 | static void net_route_named_msg(struct sk_buff *buf) | 113 | static void net_route_named_msg(struct sk_buff *buf) |
130 | { | 114 | { |
@@ -214,9 +198,6 @@ int tipc_net_start(u32 addr) | |||
214 | tipc_named_reinit(); | 198 | tipc_named_reinit(); |
215 | tipc_port_reinit(); | 199 | tipc_port_reinit(); |
216 | 200 | ||
217 | res = net_start(); | ||
218 | if (res) | ||
219 | return res; | ||
220 | res = tipc_bclink_init(); | 201 | res = tipc_bclink_init(); |
221 | if (res) | 202 | if (res) |
222 | return res; | 203 | return res; |
@@ -232,14 +213,16 @@ int tipc_net_start(u32 addr) | |||
232 | 213 | ||
233 | void tipc_net_stop(void) | 214 | void tipc_net_stop(void) |
234 | { | 215 | { |
216 | struct tipc_node *node, *t_node; | ||
217 | |||
235 | if (tipc_mode != TIPC_NET_MODE) | 218 | if (tipc_mode != TIPC_NET_MODE) |
236 | return; | 219 | return; |
237 | write_lock_bh(&tipc_net_lock); | 220 | write_lock_bh(&tipc_net_lock); |
238 | tipc_bearer_stop(); | 221 | tipc_bearer_stop(); |
239 | tipc_mode = TIPC_NODE_MODE; | 222 | tipc_mode = TIPC_NODE_MODE; |
240 | tipc_bclink_stop(); | 223 | tipc_bclink_stop(); |
241 | net_stop(); | 224 | list_for_each_entry_safe(node, t_node, &tipc_node_list, list); |
225 | tipc_node_delete(node); | ||
242 | write_unlock_bh(&tipc_net_lock); | 226 | write_unlock_bh(&tipc_net_lock); |
243 | info("Left network mode\n"); | 227 | info("Left network mode\n"); |
244 | } | 228 | } |
245 | |||
diff --git a/net/tipc/net.h b/net/tipc/net.h index 0ba6093fb6ce..9eb4b9e220eb 100644 --- a/net/tipc/net.h +++ b/net/tipc/net.h | |||
@@ -37,8 +37,6 @@ | |||
37 | #ifndef _TIPC_NET_H | 37 | #ifndef _TIPC_NET_H |
38 | #define _TIPC_NET_H | 38 | #define _TIPC_NET_H |
39 | 39 | ||
40 | extern atomic_t tipc_num_links; | ||
41 | |||
42 | extern rwlock_t tipc_net_lock; | 40 | extern rwlock_t tipc_net_lock; |
43 | 41 | ||
44 | void tipc_net_route_msg(struct sk_buff *buf); | 42 | void tipc_net_route_msg(struct sk_buff *buf); |
diff --git a/net/tipc/node.c b/net/tipc/node.c index 22aeb2b7ad00..66099cb1d6d6 100644 --- a/net/tipc/node.c +++ b/net/tipc/node.c | |||
@@ -47,6 +47,8 @@ static DEFINE_SPINLOCK(node_create_lock); | |||
47 | static struct hlist_head node_htable[NODE_HTABLE_SIZE]; | 47 | static struct hlist_head node_htable[NODE_HTABLE_SIZE]; |
48 | LIST_HEAD(tipc_node_list); | 48 | LIST_HEAD(tipc_node_list); |
49 | static u32 tipc_num_nodes; | 49 | static u32 tipc_num_nodes; |
50 | |||
51 | static atomic_t tipc_num_links = ATOMIC_INIT(0); | ||
50 | u32 tipc_own_tag; | 52 | u32 tipc_own_tag; |
51 | 53 | ||
52 | /** | 54 | /** |