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

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>

authored by

Ying Xue and committed by
David S. Miller
1b764828 57f1d186

+17 -13
+17 -13
net/tipc/subscr.c
··· 154 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 173 static void tipc_subscrb_delete(struct tipc_subscriber *subscriber) 158 174 { 159 175 struct tipc_subscription *sub; ··· 317 301 /* Handle one request to establish a new subscriber */ 318 302 static void *tipc_subscrb_connect_cb(int conid) 319 303 { 320 - struct tipc_subscriber *subscriber; 321 - 322 - /* Create subscriber object */ 323 - subscriber = kzalloc(sizeof(struct tipc_subscriber), GFP_ATOMIC); 324 - if (subscriber == NULL) { 325 - pr_warn("Subscriber rejected, no memory\n"); 326 - return NULL; 327 - } 328 - INIT_LIST_HEAD(&subscriber->subscrp_list); 329 - subscriber->conid = conid; 330 - spin_lock_init(&subscriber->lock); 331 - 332 - return (void *)subscriber; 304 + return (void *)tipc_subscrb_create(conid); 333 305 } 334 306 335 307 int tipc_topsrv_start(struct net *net)