aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/bearer.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/tipc/bearer.c')
-rw-r--r--net/tipc/bearer.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c
index 9927d1d56c4f..837b7a467885 100644
--- a/net/tipc/bearer.c
+++ b/net/tipc/bearer.c
@@ -36,17 +36,13 @@
36 36
37#include "core.h" 37#include "core.h"
38#include "config.h" 38#include "config.h"
39#include "dbg.h"
40#include "bearer.h" 39#include "bearer.h"
41#include "link.h"
42#include "port.h"
43#include "discover.h" 40#include "discover.h"
44#include "bcast.h"
45 41
46#define MAX_ADDR_STR 32 42#define MAX_ADDR_STR 32
47 43
48static struct media media_list[MAX_MEDIA]; 44static struct media media_list[MAX_MEDIA];
49static u32 media_count = 0; 45static u32 media_count;
50 46
51struct bearer tipc_bearers[MAX_BEARERS]; 47struct bearer tipc_bearers[MAX_BEARERS];
52 48
@@ -167,7 +163,6 @@ int tipc_register_media(u32 media_type,
167 m_ptr->priority = bearer_priority; 163 m_ptr->priority = bearer_priority;
168 m_ptr->tolerance = link_tolerance; 164 m_ptr->tolerance = link_tolerance;
169 m_ptr->window = send_window_limit; 165 m_ptr->window = send_window_limit;
170 dbg("Media <%s> registered\n", name);
171 res = 0; 166 res = 0;
172exit: 167exit:
173 write_unlock_bh(&tipc_net_lock); 168 write_unlock_bh(&tipc_net_lock);
@@ -199,9 +194,8 @@ void tipc_media_addr_printf(struct print_buf *pb, struct tipc_media_addr *a)
199 unchar *addr = (unchar *)&a->dev_addr; 194 unchar *addr = (unchar *)&a->dev_addr;
200 195
201 tipc_printf(pb, "UNKNOWN(%u)", media_type); 196 tipc_printf(pb, "UNKNOWN(%u)", media_type);
202 for (i = 0; i < (sizeof(*a) - sizeof(a->type)); i++) { 197 for (i = 0; i < (sizeof(*a) - sizeof(a->type)); i++)
203 tipc_printf(pb, "-%02x", addr[i]); 198 tipc_printf(pb, "-%02x", addr[i]);
204 }
205 } 199 }
206} 200}
207 201
@@ -256,7 +250,8 @@ static int bearer_name_validate(const char *name,
256 /* ensure all component parts of bearer name are present */ 250 /* ensure all component parts of bearer name are present */
257 251
258 media_name = name_copy; 252 media_name = name_copy;
259 if ((if_name = strchr(media_name, ':')) == NULL) 253 if_name = strchr(media_name, ':');
254 if (if_name == NULL)
260 return 0; 255 return 0;
261 *(if_name++) = 0; 256 *(if_name++) = 0;
262 media_len = if_name - media_name; 257 media_len = if_name - media_name;
@@ -625,7 +620,7 @@ int tipc_block_bearer(const char *name)
625 * Note: This routine assumes caller holds tipc_net_lock. 620 * Note: This routine assumes caller holds tipc_net_lock.
626 */ 621 */
627 622
628static int bearer_disable(struct bearer *b_ptr) 623static void bearer_disable(struct bearer *b_ptr)
629{ 624{
630 struct link *l_ptr; 625 struct link *l_ptr;
631 struct link *temp_l_ptr; 626 struct link *temp_l_ptr;
@@ -641,7 +636,6 @@ static int bearer_disable(struct bearer *b_ptr)
641 } 636 }
642 spin_unlock_bh(&b_ptr->publ.lock); 637 spin_unlock_bh(&b_ptr->publ.lock);
643 memset(b_ptr, 0, sizeof(struct bearer)); 638 memset(b_ptr, 0, sizeof(struct bearer));
644 return 0;
645} 639}
646 640
647int tipc_disable_bearer(const char *name) 641int tipc_disable_bearer(const char *name)
@@ -654,8 +648,10 @@ int tipc_disable_bearer(const char *name)
654 if (b_ptr == NULL) { 648 if (b_ptr == NULL) {
655 warn("Attempt to disable unknown bearer <%s>\n", name); 649 warn("Attempt to disable unknown bearer <%s>\n", name);
656 res = -EINVAL; 650 res = -EINVAL;
657 } else 651 } else {
658 res = bearer_disable(b_ptr); 652 bearer_disable(b_ptr);
653 res = 0;
654 }
659 write_unlock_bh(&tipc_net_lock); 655 write_unlock_bh(&tipc_net_lock);
660 return res; 656 return res;
661} 657}