aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/user_reg.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/tipc/user_reg.c')
-rw-r--r--net/tipc/user_reg.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/net/tipc/user_reg.c b/net/tipc/user_reg.c
index 04d1b9be9c51..4146c40cd20b 100644
--- a/net/tipc/user_reg.c
+++ b/net/tipc/user_reg.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * net/tipc/user_reg.c: TIPC user registry code 2 * net/tipc/user_reg.c: TIPC user registry code
3 * 3 *
4 * Copyright (c) 2000-2006, Ericsson AB 4 * Copyright (c) 2000-2006, Ericsson AB
5 * Copyright (c) 2004-2005, Wind River Systems 5 * Copyright (c) 2004-2005, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
@@ -40,7 +40,7 @@
40/* 40/*
41 * TIPC user registry keeps track of users of the tipc_port interface. 41 * TIPC user registry keeps track of users of the tipc_port interface.
42 * 42 *
43 * The registry utilizes an array of "TIPC user" entries; 43 * The registry utilizes an array of "TIPC user" entries;
44 * a user's ID is the index of their associated array entry. 44 * a user's ID is the index of their associated array entry.
45 * Array entry 0 is not used, so userid 0 is not valid; 45 * Array entry 0 is not used, so userid 0 is not valid;
46 * TIPC sometimes uses this value to denote an anonymous user. 46 * TIPC sometimes uses this value to denote an anonymous user.
@@ -51,7 +51,7 @@
51 * struct tipc_user - registered TIPC user info 51 * struct tipc_user - registered TIPC user info
52 * @next: index of next free registry entry (or -1 for an allocated entry) 52 * @next: index of next free registry entry (or -1 for an allocated entry)
53 * @callback: ptr to routine to call when TIPC mode changes (NULL if none) 53 * @callback: ptr to routine to call when TIPC mode changes (NULL if none)
54 * @usr_handle: user-defined value passed to callback routine 54 * @usr_handle: user-defined value passed to callback routine
55 * @ports: list of user ports owned by the user 55 * @ports: list of user ports owned by the user
56 */ 56 */
57 57
@@ -71,7 +71,7 @@ static DEFINE_SPINLOCK(reg_lock);
71 71
72/** 72/**
73 * reg_init - create TIPC user registry (but don't activate it) 73 * reg_init - create TIPC user registry (but don't activate it)
74 * 74 *
75 * If registry has been pre-initialized it is left "as is". 75 * If registry has been pre-initialized it is left "as is".
76 * NOTE: This routine may be called when TIPC is inactive. 76 * NOTE: This routine may be called when TIPC is inactive.
77 */ 77 */
@@ -79,7 +79,7 @@ static DEFINE_SPINLOCK(reg_lock);
79static int reg_init(void) 79static int reg_init(void)
80{ 80{
81 u32 i; 81 u32 i;
82 82
83 spin_lock_bh(&reg_lock); 83 spin_lock_bh(&reg_lock);
84 if (!users) { 84 if (!users) {
85 users = kzalloc(USER_LIST_SIZE, GFP_ATOMIC); 85 users = kzalloc(USER_LIST_SIZE, GFP_ATOMIC);
@@ -137,7 +137,7 @@ int tipc_reg_start(void)
137 */ 137 */
138 138
139void tipc_reg_stop(void) 139void tipc_reg_stop(void)
140{ 140{
141 int id; 141 int id;
142 142
143 if (!users) 143 if (!users)
@@ -174,14 +174,14 @@ int tipc_attach(u32 *userid, tipc_mode_event cb, void *usr_handle)
174 user_ptr = &users[next_free_user]; 174 user_ptr = &users[next_free_user];
175 *userid = next_free_user; 175 *userid = next_free_user;
176 next_free_user = user_ptr->next; 176 next_free_user = user_ptr->next;
177 user_ptr->next = -1; 177 user_ptr->next = -1;
178 spin_unlock_bh(&reg_lock); 178 spin_unlock_bh(&reg_lock);
179 179
180 user_ptr->callback = cb; 180 user_ptr->callback = cb;
181 user_ptr->usr_handle = usr_handle; 181 user_ptr->usr_handle = usr_handle;
182 INIT_LIST_HEAD(&user_ptr->ports); 182 INIT_LIST_HEAD(&user_ptr->ports);
183 atomic_inc(&tipc_user_count); 183 atomic_inc(&tipc_user_count);
184 184
185 if (cb && (tipc_mode != TIPC_NOT_RUNNING)) 185 if (cb && (tipc_mode != TIPC_NOT_RUNNING))
186 tipc_k_signal((Handler)reg_callback, (unsigned long)user_ptr); 186 tipc_k_signal((Handler)reg_callback, (unsigned long)user_ptr);
187 return TIPC_OK; 187 return TIPC_OK;
@@ -207,16 +207,16 @@ void tipc_detach(u32 userid)
207 } 207 }
208 208
209 user_ptr = &users[userid]; 209 user_ptr = &users[userid];
210 user_ptr->callback = NULL; 210 user_ptr->callback = NULL;
211 INIT_LIST_HEAD(&ports_temp); 211 INIT_LIST_HEAD(&ports_temp);
212 list_splice(&user_ptr->ports, &ports_temp); 212 list_splice(&user_ptr->ports, &ports_temp);
213 user_ptr->next = next_free_user; 213 user_ptr->next = next_free_user;
214 next_free_user = userid; 214 next_free_user = userid;
215 spin_unlock_bh(&reg_lock); 215 spin_unlock_bh(&reg_lock);
216 216
217 atomic_dec(&tipc_user_count); 217 atomic_dec(&tipc_user_count);
218 218
219 list_for_each_entry_safe(up_ptr, temp_up_ptr, &ports_temp, uport_list) { 219 list_for_each_entry_safe(up_ptr, temp_up_ptr, &ports_temp, uport_list) {
220 tipc_deleteport(up_ptr->ref); 220 tipc_deleteport(up_ptr->ref);
221 } 221 }
222} 222}