Whamcloud - gitweb
LU-6142 lnet: use list_first_entry() where appropriate.
[fs/lustre-release.git] / lnet / selftest / console.c
index ac26ad2..583536a 100644 (file)
@@ -324,8 +324,8 @@ lstcon_group_move(struct lstcon_group *old, struct lstcon_group *new)
        struct lstcon_ndlink *ndl;
 
        while (!list_empty(&old->grp_ndl_list)) {
-               ndl = list_entry(old->grp_ndl_list.next,
-                                struct lstcon_ndlink, ndl_link);
+               ndl = list_first_entry(&old->grp_ndl_list,
+                                      struct lstcon_ndlink, ndl_link);
                lstcon_group_ndlink_move(old, new, ndl);
        }
 }
@@ -1069,8 +1069,8 @@ lstcon_batch_destroy(struct lstcon_batch *bat)
        list_del(&bat->bat_link);
 
        while (!list_empty(&bat->bat_test_list)) {
-               test = list_entry(bat->bat_test_list.next,
-                                 struct lstcon_test, tes_link);
+               test = list_first_entry(&bat->bat_test_list,
+                                       struct lstcon_test, tes_link);
                LASSERT(list_empty(&test->tes_trans_list));
 
                list_del(&test->tes_link);
@@ -1085,16 +1085,16 @@ lstcon_batch_destroy(struct lstcon_batch *bat)
        LASSERT(list_empty(&bat->bat_trans_list));
 
        while (!list_empty(&bat->bat_cli_list)) {
-               ndl = list_entry(bat->bat_cli_list.next,
-                                struct lstcon_ndlink, ndl_link);
+               ndl = list_first_entry(&bat->bat_cli_list,
+                                      struct lstcon_ndlink, ndl_link);
                list_del_init(&ndl->ndl_link);
 
                lstcon_ndlink_release(ndl);
        }
 
        while (!list_empty(&bat->bat_srv_list)) {
-               ndl = list_entry(bat->bat_srv_list.next,
-                                struct lstcon_ndlink, ndl_link);
+               ndl = list_first_entry(&bat->bat_srv_list,
+                                      struct lstcon_ndlink, ndl_link);
                list_del_init(&ndl->ndl_link);
 
                lstcon_ndlink_release(ndl);
@@ -1787,16 +1787,16 @@ int lstcon_session_end(void)
 
        /* destroy all batches */
        while (!list_empty(&console_session.ses_bat_list)) {
-               bat = list_entry(console_session.ses_bat_list.next,
-                                struct lstcon_batch, bat_link);
+               bat = list_first_entry(&console_session.ses_bat_list,
+                                      struct lstcon_batch, bat_link);
 
                lstcon_batch_destroy(bat);
        }
 
        /* destroy all groups */
        while (!list_empty(&console_session.ses_grp_list)) {
-               grp = list_entry(console_session.ses_grp_list.next,
-                                struct lstcon_group, grp_link);
+               grp = list_first_entry(&console_session.ses_grp_list,
+                                      struct lstcon_group, grp_link);
                LASSERT(grp->grp_ref == 1);
 
                lstcon_group_decref(grp);