summaryrefslogtreecommitdiff
path: root/net/tipc/bearer.c
diff options
context:
space:
mode:
authorYing Xue <ying.xue@windriver.com>2013-10-18 07:23:18 +0200
committerDavid S. Miller <davem@davemloft.net>2013-10-18 13:20:43 -0400
commitf2875c3cc4769d07bab3bc6e51c386840a7de280 (patch)
tree22ad4a05e77bad4316b5d95bfe397f83f4b3615f /net/tipc/bearer.c
parent4babbaa8a1ecf1cb76de5e1635417c7472190ef5 (diff)
tipc: avoid unnecessary lookup for tipc bearer instance
tipc_block_bearer() currently takes a bearer name (const char*) as argument. This requires the function to make a lookup to find the pointer to the corresponding bearer struct. In the current code base this is not necessary, since the only two callers (tipc_continue(),recv_notification()) already have validated copies of this pointer, and hence can pass it directly in the function call. We change tipc_block_bearer() to directly take struct tipc_bearer* as argument instead. Signed-off-by: Ying Xue <ying.xue@windriver.com> Reviewed-by: Paul Gortmaker <paul.gortmaker@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/bearer.c')
-rw-r--r--net/tipc/bearer.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c
index 09faa5520079..3f9707a16d06 100644
--- a/net/tipc/bearer.c
+++ b/net/tipc/bearer.c
@@ -420,23 +420,15 @@ exit:
}
/**
- * tipc_block_bearer - Block the bearer with the given name, and reset all its links
+ * tipc_block_bearer - Block the bearer, and reset all its links
*/
-int tipc_block_bearer(const char *name)
+int tipc_block_bearer(struct tipc_bearer *b_ptr)
{
- struct tipc_bearer *b_ptr = NULL;
struct tipc_link *l_ptr;
struct tipc_link *temp_l_ptr;
read_lock_bh(&tipc_net_lock);
- b_ptr = tipc_bearer_find(name);
- if (!b_ptr) {
- pr_warn("Attempt to block unknown bearer <%s>\n", name);
- read_unlock_bh(&tipc_net_lock);
- return -EINVAL;
- }
-
- pr_info("Blocking bearer <%s>\n", name);
+ pr_info("Blocking bearer <%s>\n", b_ptr->name);
spin_lock_bh(&b_ptr->lock);
b_ptr->blocked = 1;
list_for_each_entry_safe(l_ptr, temp_l_ptr, &b_ptr->links, link_list) {