diff options
-rw-r--r-- | net/tipc/subscr.c | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/net/tipc/subscr.c b/net/tipc/subscr.c index 23f43d03980c..21abf1765b02 100644 --- a/net/tipc/subscr.c +++ b/net/tipc/subscr.c | |||
@@ -36,7 +36,7 @@ | |||
36 | 36 | ||
37 | #include "core.h" | 37 | #include "core.h" |
38 | #include "name_table.h" | 38 | #include "name_table.h" |
39 | #include "user_reg.h" | 39 | #include "port.h" |
40 | #include "subscr.h" | 40 | #include "subscr.h" |
41 | 41 | ||
42 | /** | 42 | /** |
@@ -64,7 +64,6 @@ struct subscriber { | |||
64 | */ | 64 | */ |
65 | 65 | ||
66 | struct top_srv { | 66 | struct top_srv { |
67 | u32 user_ref; | ||
68 | u32 setup_port; | 67 | u32 setup_port; |
69 | atomic_t subscription_count; | 68 | atomic_t subscription_count; |
70 | struct list_head subscriber_list; | 69 | struct list_head subscriber_list; |
@@ -494,7 +493,7 @@ static void subscr_named_msg_event(void *usr_handle, | |||
494 | 493 | ||
495 | /* Create server port & establish connection to subscriber */ | 494 | /* Create server port & establish connection to subscriber */ |
496 | 495 | ||
497 | tipc_createport(topsrv.user_ref, | 496 | tipc_createport(0, |
498 | subscriber, | 497 | subscriber, |
499 | importance, | 498 | importance, |
500 | NULL, | 499 | NULL, |
@@ -549,13 +548,7 @@ int tipc_subscr_start(void) | |||
549 | INIT_LIST_HEAD(&topsrv.subscriber_list); | 548 | INIT_LIST_HEAD(&topsrv.subscriber_list); |
550 | 549 | ||
551 | spin_lock_bh(&topsrv.lock); | 550 | spin_lock_bh(&topsrv.lock); |
552 | res = tipc_attach(&topsrv.user_ref); | 551 | res = tipc_createport(0, |
553 | if (res) { | ||
554 | spin_unlock_bh(&topsrv.lock); | ||
555 | return res; | ||
556 | } | ||
557 | |||
558 | res = tipc_createport(topsrv.user_ref, | ||
559 | NULL, | 552 | NULL, |
560 | TIPC_CRITICAL_IMPORTANCE, | 553 | TIPC_CRITICAL_IMPORTANCE, |
561 | NULL, | 554 | NULL, |
@@ -570,16 +563,17 @@ int tipc_subscr_start(void) | |||
570 | goto failed; | 563 | goto failed; |
571 | 564 | ||
572 | res = tipc_nametbl_publish_rsv(topsrv.setup_port, TIPC_NODE_SCOPE, &seq); | 565 | res = tipc_nametbl_publish_rsv(topsrv.setup_port, TIPC_NODE_SCOPE, &seq); |
573 | if (res) | 566 | if (res) { |
567 | tipc_deleteport(topsrv.setup_port); | ||
568 | topsrv.setup_port = 0; | ||
574 | goto failed; | 569 | goto failed; |
570 | } | ||
575 | 571 | ||
576 | spin_unlock_bh(&topsrv.lock); | 572 | spin_unlock_bh(&topsrv.lock); |
577 | return 0; | 573 | return 0; |
578 | 574 | ||
579 | failed: | 575 | failed: |
580 | err("Failed to create subscription service\n"); | 576 | err("Failed to create subscription service\n"); |
581 | tipc_detach(topsrv.user_ref); | ||
582 | topsrv.user_ref = 0; | ||
583 | spin_unlock_bh(&topsrv.lock); | 577 | spin_unlock_bh(&topsrv.lock); |
584 | return res; | 578 | return res; |
585 | } | 579 | } |
@@ -590,8 +584,10 @@ void tipc_subscr_stop(void) | |||
590 | struct subscriber *subscriber_temp; | 584 | struct subscriber *subscriber_temp; |
591 | spinlock_t *subscriber_lock; | 585 | spinlock_t *subscriber_lock; |
592 | 586 | ||
593 | if (topsrv.user_ref) { | 587 | if (topsrv.setup_port) { |
594 | tipc_deleteport(topsrv.setup_port); | 588 | tipc_deleteport(topsrv.setup_port); |
589 | topsrv.setup_port = 0; | ||
590 | |||
595 | list_for_each_entry_safe(subscriber, subscriber_temp, | 591 | list_for_each_entry_safe(subscriber, subscriber_temp, |
596 | &topsrv.subscriber_list, | 592 | &topsrv.subscriber_list, |
597 | subscriber_list) { | 593 | subscriber_list) { |
@@ -600,7 +596,5 @@ void tipc_subscr_stop(void) | |||
600 | subscr_terminate(subscriber); | 596 | subscr_terminate(subscriber); |
601 | spin_unlock_bh(subscriber_lock); | 597 | spin_unlock_bh(subscriber_lock); |
602 | } | 598 | } |
603 | tipc_detach(topsrv.user_ref); | ||
604 | topsrv.user_ref = 0; | ||
605 | } | 599 | } |
606 | } | 600 | } |