diff options
author | Ying Xue <ying.xue@windriver.com> | 2015-05-03 22:36:45 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-05-04 15:04:01 -0400 |
commit | 1b764828add9feaa18a8f916a79b954ac8a20a73 (patch) | |
tree | f4f6277318d8b6218eb96f723cfc9b35fdb74792 /net/tipc | |
parent | 57f1d1868fb5d71a20bfb1bc807274471c2ff459 (diff) |
tipc: introduce tipc_subscrb_create routine
Introducing a new function makes the purpose of tipc_subscrb_connect_cb
callback routine more clear.
Signed-off-by: Ying Xue <ying.xue@windriver.com>
Reviewed-by: Jon Maloy <jon.maloy@ericson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc')
-rw-r--r-- | net/tipc/subscr.c | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/net/tipc/subscr.c b/net/tipc/subscr.c index caec0b2b0740..d0dbde420540 100644 --- a/net/tipc/subscr.c +++ b/net/tipc/subscr.c | |||
@@ -154,6 +154,22 @@ static void tipc_subscrp_delete(struct tipc_subscription *sub) | |||
154 | atomic_dec(&tn->subscription_count); | 154 | atomic_dec(&tn->subscription_count); |
155 | } | 155 | } |
156 | 156 | ||
157 | static struct tipc_subscriber *tipc_subscrb_create(int conid) | ||
158 | { | ||
159 | struct tipc_subscriber *subscriber; | ||
160 | |||
161 | subscriber = kzalloc(sizeof(*subscriber), GFP_ATOMIC); | ||
162 | if (!subscriber) { | ||
163 | pr_warn("Subscriber rejected, no memory\n"); | ||
164 | return NULL; | ||
165 | } | ||
166 | INIT_LIST_HEAD(&subscriber->subscrp_list); | ||
167 | subscriber->conid = conid; | ||
168 | spin_lock_init(&subscriber->lock); | ||
169 | |||
170 | return subscriber; | ||
171 | } | ||
172 | |||
157 | static void tipc_subscrb_delete(struct tipc_subscriber *subscriber) | 173 | static void tipc_subscrb_delete(struct tipc_subscriber *subscriber) |
158 | { | 174 | { |
159 | struct tipc_subscription *sub; | 175 | struct tipc_subscription *sub; |
@@ -301,19 +317,7 @@ static void tipc_subscrb_rcv_cb(struct net *net, int conid, | |||
301 | /* Handle one request to establish a new subscriber */ | 317 | /* Handle one request to establish a new subscriber */ |
302 | static void *tipc_subscrb_connect_cb(int conid) | 318 | static void *tipc_subscrb_connect_cb(int conid) |
303 | { | 319 | { |
304 | struct tipc_subscriber *subscriber; | 320 | return (void *)tipc_subscrb_create(conid); |
305 | |||
306 | /* Create subscriber object */ | ||
307 | subscriber = kzalloc(sizeof(struct tipc_subscriber), GFP_ATOMIC); | ||
308 | if (subscriber == NULL) { | ||
309 | pr_warn("Subscriber rejected, no memory\n"); | ||
310 | return NULL; | ||
311 | } | ||
312 | INIT_LIST_HEAD(&subscriber->subscrp_list); | ||
313 | subscriber->conid = conid; | ||
314 | spin_lock_init(&subscriber->lock); | ||
315 | |||
316 | return (void *)subscriber; | ||
317 | } | 321 | } |
318 | 322 | ||
319 | int tipc_topsrv_start(struct net *net) | 323 | int tipc_topsrv_start(struct net *net) |