diff options
author | Ying Xue <ying.xue@windriver.com> | 2014-02-13 17:29:07 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-02-13 17:57:05 -0500 |
commit | 8d8439b686f15c23faef4d7d67c4a9f30ce0f2b5 (patch) | |
tree | 4b6232ad9258c86bfcb4da63bd715e92980c2ca0 /net/tipc | |
parent | e0ca2c30b1e9c1ed8b58bccb95c33d25763a4311 (diff) |
tipc: move code for deleting links from bearer.c to link.c
We break out the code for deleting attached links in the
function bearer_disable(), and define a new function named
tipc_link_delete_list() to do this job.
This commit incurs no functional changes, but makes the code of
function bearer_disable() cleaner. It is also a preparation
for a more important change to the bearer code, in a subsequent
commit in this series.
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')
-rw-r--r-- | net/tipc/bearer.c | 6 | ||||
-rw-r--r-- | net/tipc/link.c | 9 | ||||
-rw-r--r-- | net/tipc/link.h | 1 |
3 files changed, 11 insertions, 5 deletions
diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c index a3bdf5c7f085..a5be053cac57 100644 --- a/net/tipc/bearer.c +++ b/net/tipc/bearer.c | |||
@@ -366,16 +366,12 @@ static int tipc_reset_bearer(struct tipc_bearer *b_ptr) | |||
366 | */ | 366 | */ |
367 | static void bearer_disable(struct tipc_bearer *b_ptr) | 367 | static void bearer_disable(struct tipc_bearer *b_ptr) |
368 | { | 368 | { |
369 | struct tipc_link *l_ptr; | ||
370 | struct tipc_link *temp_l_ptr; | ||
371 | struct tipc_link_req *temp_req; | 369 | struct tipc_link_req *temp_req; |
372 | 370 | ||
373 | pr_info("Disabling bearer <%s>\n", b_ptr->name); | 371 | pr_info("Disabling bearer <%s>\n", b_ptr->name); |
374 | spin_lock_bh(&b_ptr->lock); | 372 | spin_lock_bh(&b_ptr->lock); |
375 | b_ptr->media->disable_media(b_ptr); | 373 | b_ptr->media->disable_media(b_ptr); |
376 | list_for_each_entry_safe(l_ptr, temp_l_ptr, &b_ptr->links, link_list) { | 374 | tipc_link_delete_list(b_ptr); |
377 | tipc_link_delete(l_ptr); | ||
378 | } | ||
379 | temp_req = b_ptr->link_req; | 375 | temp_req = b_ptr->link_req; |
380 | b_ptr->link_req = NULL; | 376 | b_ptr->link_req = NULL; |
381 | spin_unlock_bh(&b_ptr->lock); | 377 | spin_unlock_bh(&b_ptr->lock); |
diff --git a/net/tipc/link.c b/net/tipc/link.c index 3ff34e8a37d7..424e9f3acd81 100644 --- a/net/tipc/link.c +++ b/net/tipc/link.c | |||
@@ -313,6 +313,15 @@ void tipc_link_delete(struct tipc_link *l_ptr) | |||
313 | kfree(l_ptr); | 313 | kfree(l_ptr); |
314 | } | 314 | } |
315 | 315 | ||
316 | void tipc_link_delete_list(struct tipc_bearer *b_ptr) | ||
317 | { | ||
318 | struct tipc_link *l_ptr; | ||
319 | struct tipc_link *temp_l_ptr; | ||
320 | |||
321 | list_for_each_entry_safe(l_ptr, temp_l_ptr, &b_ptr->links, link_list) { | ||
322 | tipc_link_delete(l_ptr); | ||
323 | } | ||
324 | } | ||
316 | 325 | ||
317 | /** | 326 | /** |
318 | * link_schedule_port - schedule port for deferred sending | 327 | * link_schedule_port - schedule port for deferred sending |
diff --git a/net/tipc/link.h b/net/tipc/link.h index 73beecb369e2..994ebd16ddc3 100644 --- a/net/tipc/link.h +++ b/net/tipc/link.h | |||
@@ -219,6 +219,7 @@ void tipc_link_delete(struct tipc_link *l_ptr); | |||
219 | void tipc_link_failover_send_queue(struct tipc_link *l_ptr); | 219 | void tipc_link_failover_send_queue(struct tipc_link *l_ptr); |
220 | void tipc_link_dup_send_queue(struct tipc_link *l_ptr, | 220 | void tipc_link_dup_send_queue(struct tipc_link *l_ptr, |
221 | struct tipc_link *dest); | 221 | struct tipc_link *dest); |
222 | void tipc_link_delete_list(struct tipc_bearer *b_ptr); | ||
222 | void tipc_link_reset_fragments(struct tipc_link *l_ptr); | 223 | void tipc_link_reset_fragments(struct tipc_link *l_ptr); |
223 | int tipc_link_is_up(struct tipc_link *l_ptr); | 224 | int tipc_link_is_up(struct tipc_link *l_ptr); |
224 | int tipc_link_is_active(struct tipc_link *l_ptr); | 225 | int tipc_link_is_active(struct tipc_link *l_ptr); |