Skip to content

Commit 34e4625

Browse files
ajstephensPaul Gortmaker
authored andcommitted
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>
1 parent 672d99e commit 34e4625

3 files changed

Lines changed: 6 additions & 23 deletions

File tree

‎net/tipc/net.c‎

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -109,22 +109,6 @@
109109
*/
110110

111111
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-
}
128112

129113
static void net_route_named_msg(struct sk_buff *buf)
130114
{
@@ -214,9 +198,6 @@ int tipc_net_start(u32 addr)
214198
tipc_named_reinit();
215199
tipc_port_reinit();
216200

217-
res = net_start();
218-
if (res)
219-
return res;
220201
res = tipc_bclink_init();
221202
if (res)
222203
return res;
@@ -232,14 +213,16 @@ int tipc_net_start(u32 addr)
232213

233214
void tipc_net_stop(void)
234215
{
216+
struct tipc_node *node, *t_node;
217+
235218
if (tipc_mode != TIPC_NET_MODE)
236219
return;
237220
write_lock_bh(&tipc_net_lock);
238221
tipc_bearer_stop();
239222
tipc_mode = TIPC_NODE_MODE;
240223
tipc_bclink_stop();
241-
net_stop();
224+
list_for_each_entry_safe(node, t_node, &tipc_node_list, list);
225+
tipc_node_delete(node);
242226
write_unlock_bh(&tipc_net_lock);
243227
info("Left network mode\n");
244228
}
245-

‎net/tipc/net.h‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@
3737
#ifndef _TIPC_NET_H
3838
#define _TIPC_NET_H
3939

40-
extern atomic_t tipc_num_links;
41-
4240
extern rwlock_t tipc_net_lock;
4341

4442
void tipc_net_route_msg(struct sk_buff *buf);

‎net/tipc/node.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ static DEFINE_SPINLOCK(node_create_lock);
4747
static struct hlist_head node_htable[NODE_HTABLE_SIZE];
4848
LIST_HEAD(tipc_node_list);
4949
static u32 tipc_num_nodes;
50+
51+
static atomic_t tipc_num_links = ATOMIC_INIT(0);
5052
u32 tipc_own_tag;
5153

5254
/**

0 commit comments

Comments
 (0)