]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commit
staging: lustre: lnet: replace list_for_each with list_for_each_entry
authorHaneen Mohammed <hamohammed.sa@gmail.com>
Sat, 23 Sep 2017 02:22:39 +0000 (20:22 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 29 Sep 2017 13:22:51 +0000 (15:22 +0200)
commit8e55b6fd06605823564dee522b32a356b861fd9e
tree43982c38b9f13547684c6693d12711fe9038344a
parent7c35d3809b134200bc603f8e17c319560e18c00d
staging: lustre: lnet: replace list_for_each with list_for_each_entry

Replace use of the combination of list_for_each() and list_entry() with
list_for_each_entry() to simplify the code and remove variables that are
used only in list_for_each().
Issue found and corrected using Coccinelle script:

@r@
expression head, member, e;
type T1, T2, T3;
iterator name list_for_each, list_for_each_entry;
identifier pos, var;
@@

-T1 *pos;
...when!=pos

-list_for_each(pos, head)
+list_for_each_entry(var, head, member)
{
...when!=pos
   when!=T3 *var;
-var = list_entry(pos, T2, member);
...when!=pos
}
...when!=pos

Signed-off-by: Haneen Mohammed <hamohammed.sa@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c