summaryrefslogtreecommitdiffstats
path: root/net/tipc/subscr.c
diff options
context:
space:
mode:
authorJon Maloy <jon.maloy@ericsson.com>2018-02-15 04:40:43 -0500
committerDavid S. Miller <davem@davemloft.net>2018-02-16 15:26:33 -0500
commitc901d26d4a8137f3ad0e5865d331f7c63c42d9f9 (patch)
tree89ff5b5f5fd1cb4f4c5c002cd2ada9353154d70d /net/tipc/subscr.c
parent27469b7352b5197cffa0e3dadb5f1127f055da27 (diff)
tipc: remove unnecessary function pointers
Interaction between the functionality in server.c and subscr.c is done via function pointers installed in struct server. This makes the code harder to follow, and doesn't serve any obvious purpose. Here, we replace the function pointers with direct function calls. Acked-by: Ying Xue <ying.xue@windriver.com> Signed-off-by: Jon Maloy <jon.maloy@ericsson.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc/subscr.c')
-rw-r--r--net/tipc/subscr.c27
1 files changed, 6 insertions, 21 deletions
diff --git a/net/tipc/subscr.c b/net/tipc/subscr.c
index eaef826fc06d..b86fbbf7a0b9 100644
--- a/net/tipc/subscr.c
+++ b/net/tipc/subscr.c
@@ -220,7 +220,7 @@ static void tipc_subscrb_subscrp_delete(struct tipc_subscriber *subscriber,
220 spin_unlock_bh(&subscriber->lock); 220 spin_unlock_bh(&subscriber->lock);
221} 221}
222 222
223static struct tipc_subscriber *tipc_subscrb_create(int conid) 223struct tipc_subscriber *tipc_subscrb_create(int conid)
224{ 224{
225 struct tipc_subscriber *subscriber; 225 struct tipc_subscriber *subscriber;
226 226
@@ -237,7 +237,7 @@ static struct tipc_subscriber *tipc_subscrb_create(int conid)
237 return subscriber; 237 return subscriber;
238} 238}
239 239
240static void tipc_subscrb_delete(struct tipc_subscriber *subscriber) 240void tipc_subscrb_delete(struct tipc_subscriber *subscriber)
241{ 241{
242 tipc_subscrb_subscrp_delete(subscriber, NULL); 242 tipc_subscrb_subscrp_delete(subscriber, NULL);
243 tipc_subscrb_put(subscriber); 243 tipc_subscrb_put(subscriber);
@@ -315,16 +315,10 @@ static int tipc_subscrp_subscribe(struct net *net, struct tipc_subscr *s,
315 return 0; 315 return 0;
316} 316}
317 317
318/* Handle one termination request for the subscriber */ 318/* Handle one request to create a new subscription for the subscriber
319static void tipc_subscrb_release_cb(int conid, void *usr_data) 319 */
320{ 320int tipc_subscrb_rcv(struct net *net, int conid, void *usr_data,
321 tipc_subscrb_delete((struct tipc_subscriber *)usr_data); 321 void *buf, size_t len)
322}
323
324/* Handle one request to create a new subscription for the subscriber */
325static int tipc_subscrb_rcv_cb(struct net *net, int conid,
326 struct sockaddr_tipc *addr, void *usr_data,
327 void *buf, size_t len)
328{ 322{
329 struct tipc_subscriber *subscriber = usr_data; 323 struct tipc_subscriber *subscriber = usr_data;
330 struct tipc_subscr *s = (struct tipc_subscr *)buf; 324 struct tipc_subscr *s = (struct tipc_subscr *)buf;
@@ -345,12 +339,6 @@ static int tipc_subscrb_rcv_cb(struct net *net, int conid,
345 return tipc_subscrp_subscribe(net, s, subscriber, swap, status); 339 return tipc_subscrp_subscribe(net, s, subscriber, swap, status);
346} 340}
347 341
348/* Handle one request to establish a new subscriber */
349static void *tipc_subscrb_connect_cb(int conid)
350{
351 return (void *)tipc_subscrb_create(conid);
352}
353
354int tipc_topsrv_start(struct net *net) 342int tipc_topsrv_start(struct net *net)
355{ 343{
356 struct tipc_net *tn = net_generic(net, tipc_net_id); 344 struct tipc_net *tn = net_generic(net, tipc_net_id);
@@ -376,9 +364,6 @@ int tipc_topsrv_start(struct net *net)
376 topsrv->net = net; 364 topsrv->net = net;
377 topsrv->saddr = saddr; 365 topsrv->saddr = saddr;
378 topsrv->max_rcvbuf_size = sizeof(struct tipc_subscr); 366 topsrv->max_rcvbuf_size = sizeof(struct tipc_subscr);
379 topsrv->tipc_conn_recvmsg = tipc_subscrb_rcv_cb;
380 topsrv->tipc_conn_new = tipc_subscrb_connect_cb;
381 topsrv->tipc_conn_release = tipc_subscrb_release_cb;
382 367
383 strncpy(topsrv->name, name, strlen(name) + 1); 368 strncpy(topsrv->name, name, strlen(name) + 1);
384 tn->topsrv = topsrv; 369 tn->topsrv = topsrv;