From: Dmitry Eremin Date: Thu, 5 May 2016 18:53:01 +0000 (-0400) Subject: staging: lustre: o2iblnd: Use list_for_each_entry_safe in kiblnd_destroy_fmr_pool_list X-Git-Tag: v4.7-rc1~90^2~33 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=0d33ec5f95fe068d7e96b6e7ed9216de93f6b5b0;p=karo-tx-linux.git staging: lustre: o2iblnd: Use list_for_each_entry_safe in kiblnd_destroy_fmr_pool_list Doubly linked lists which are iterated using list_empty and list_entry macros have been replaced with list_for_each_entry_safe macro. This makes the iteration simpler and more readable. This patch replaces the while loop containing list_empty and list_entry with list_for_each_entry_safe. Signed-off-by: Dmitry Eremin Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5783 Reviewed-on: http://review.whamcloud.com/17606 Reviewed-by: James Simmons Reviewed-by: Doug Oucharek Reviewed-by: Oleg Drokin Signed-off-by: James Simmons Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c index 60647bc1b37c..4a4b68c1bb02 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c @@ -1313,10 +1313,9 @@ static void kiblnd_destroy_fmr_pool(kib_fmr_pool_t *fpo) static void kiblnd_destroy_fmr_pool_list(struct list_head *head) { - kib_fmr_pool_t *fpo; + kib_fmr_pool_t *fpo, *tmp; - while (!list_empty(head)) { - fpo = list_entry(head->next, kib_fmr_pool_t, fpo_list); + list_for_each_entry_safe(fpo, tmp, head, fpo_list) { list_del(&fpo->fpo_list); kiblnd_destroy_fmr_pool(fpo); }