tipc: move code for deleting links from bearer.c to link.c
authorYing Xue <ying.xue@windriver.com>
Thu, 13 Feb 2014 22:29:07 +0000 (17:29 -0500)
committerDavid S. Miller <davem@davemloft.net>
Thu, 13 Feb 2014 22:57:05 +0000 (17:57 -0500)
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>
net/tipc/bearer.c
net/tipc/link.c
net/tipc/link.h

index a3bdf5c7f085723b97cae9a6fe3b489ebf577d8b..a5be053cac5741cb68211c8e46323e5239c28738 100644 (file)
@@ -366,16 +366,12 @@ static int tipc_reset_bearer(struct tipc_bearer *b_ptr)
  */
 static void bearer_disable(struct tipc_bearer *b_ptr)
 {
-       struct tipc_link *l_ptr;
-       struct tipc_link *temp_l_ptr;
        struct tipc_link_req *temp_req;
 
        pr_info("Disabling bearer <%s>\n", b_ptr->name);
        spin_lock_bh(&b_ptr->lock);
        b_ptr->media->disable_media(b_ptr);
-       list_for_each_entry_safe(l_ptr, temp_l_ptr, &b_ptr->links, link_list) {
-               tipc_link_delete(l_ptr);
-       }
+       tipc_link_delete_list(b_ptr);
        temp_req = b_ptr->link_req;
        b_ptr->link_req = NULL;
        spin_unlock_bh(&b_ptr->lock);
index 3ff34e8a37d7f4e67abd854233360d84e3ab921e..424e9f3acd81d493d5aa4f29908f4a25d8b9ffa5 100644 (file)
@@ -313,6 +313,15 @@ void tipc_link_delete(struct tipc_link *l_ptr)
        kfree(l_ptr);
 }
 
+void tipc_link_delete_list(struct tipc_bearer *b_ptr)
+{
+       struct tipc_link *l_ptr;
+       struct tipc_link *temp_l_ptr;
+
+       list_for_each_entry_safe(l_ptr, temp_l_ptr, &b_ptr->links, link_list) {
+               tipc_link_delete(l_ptr);
+       }
+}
 
 /**
  * link_schedule_port - schedule port for deferred sending
index 73beecb369e246bbdd595fcb21c8ff63d7b81544..994ebd16ddc3633c6e10af40d7e8e7f393c87c51 100644 (file)
@@ -219,6 +219,7 @@ void tipc_link_delete(struct tipc_link *l_ptr);
 void tipc_link_failover_send_queue(struct tipc_link *l_ptr);
 void tipc_link_dup_send_queue(struct tipc_link *l_ptr,
                              struct tipc_link *dest);
+void tipc_link_delete_list(struct tipc_bearer *b_ptr);
 void tipc_link_reset_fragments(struct tipc_link *l_ptr);
 int tipc_link_is_up(struct tipc_link *l_ptr);
 int tipc_link_is_active(struct tipc_link *l_ptr);