Skip to content

Commit 8d8439b

Browse files
ying-xuedavem330
authored andcommitted
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>
1 parent e0ca2c3 commit 8d8439b

3 files changed

Lines changed: 11 additions & 5 deletions

File tree

‎net/tipc/bearer.c‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -366,16 +366,12 @@ static int tipc_reset_bearer(struct tipc_bearer *b_ptr)
366366
*/
367367
static void bearer_disable(struct tipc_bearer *b_ptr)
368368
{
369-
struct tipc_link *l_ptr;
370-
struct tipc_link *temp_l_ptr;
371369
struct tipc_link_req *temp_req;
372370

373371
pr_info("Disabling bearer <%s>\n", b_ptr->name);
374372
spin_lock_bh(&b_ptr->lock);
375373
b_ptr->media->disable_media(b_ptr);
376-
list_for_each_entry_safe(l_ptr, temp_l_ptr, &b_ptr->links, link_list) {
377-
tipc_link_delete(l_ptr);
378-
}
374+
tipc_link_delete_list(b_ptr);
379375
temp_req = b_ptr->link_req;
380376
b_ptr->link_req = NULL;
381377
spin_unlock_bh(&b_ptr->lock);

‎net/tipc/link.c‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,15 @@ void tipc_link_delete(struct tipc_link *l_ptr)
313313
kfree(l_ptr);
314314
}
315315

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+
}
316325

317326
/**
318327
* link_schedule_port - schedule port for deferred sending

‎net/tipc/link.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ void tipc_link_delete(struct tipc_link *l_ptr);
219219
void tipc_link_failover_send_queue(struct tipc_link *l_ptr);
220220
void tipc_link_dup_send_queue(struct tipc_link *l_ptr,
221221
struct tipc_link *dest);
222+
void tipc_link_delete_list(struct tipc_bearer *b_ptr);
222223
void tipc_link_reset_fragments(struct tipc_link *l_ptr);
223224
int tipc_link_is_up(struct tipc_link *l_ptr);
224225
int tipc_link_is_active(struct tipc_link *l_ptr);

0 commit comments

Comments
 (0)