Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Allan Stephens and committed by
Paul Gortmaker
34e46258 672d99e1

+6 -23
+4 -21
net/tipc/net.c
··· 109 109 */ 110 110 111 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 113 static void net_route_named_msg(struct sk_buff *buf) 130 114 { ··· 198 214 tipc_named_reinit(); 199 215 tipc_port_reinit(); 200 216 201 - res = net_start(); 202 - if (res) 203 - return res; 204 217 res = tipc_bclink_init(); 205 218 if (res) 206 219 return res; ··· 213 232 214 233 void tipc_net_stop(void) 215 234 { 235 + struct tipc_node *node, *t_node; 236 + 216 237 if (tipc_mode != TIPC_NET_MODE) 217 238 return; 218 239 write_lock_bh(&tipc_net_lock); 219 240 tipc_bearer_stop(); 220 241 tipc_mode = TIPC_NODE_MODE; 221 242 tipc_bclink_stop(); 222 - net_stop(); 243 + list_for_each_entry_safe(node, t_node, &tipc_node_list, list); 244 + tipc_node_delete(node); 223 245 write_unlock_bh(&tipc_net_lock); 224 246 info("Left network mode\n"); 225 247 } 226 -
-2
net/tipc/net.h
··· 37 37 #ifndef _TIPC_NET_H 38 38 #define _TIPC_NET_H 39 39 40 - extern atomic_t tipc_num_links; 41 - 42 40 extern rwlock_t tipc_net_lock; 43 41 44 42 void tipc_net_route_msg(struct sk_buff *buf);
+2
net/tipc/node.c
··· 47 47 static struct hlist_head node_htable[NODE_HTABLE_SIZE]; 48 48 LIST_HEAD(tipc_node_list); 49 49 static u32 tipc_num_nodes; 50 + 51 + static atomic_t tipc_num_links = ATOMIC_INIT(0); 50 52 u32 tipc_own_tag; 51 53 52 54 /**