Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: x25: Use list_for_each_entry() to simplify code in x25_forward.c

Convert list_for_each() to list_for_each_entry() where
applicable. This simplifies the code.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wang Hai <wanghai38@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Wang Hai and committed by
David S. Miller
96bffe70 78595dfc

+2 -6
+2 -6
net/x25/x25_forward.c
··· 19 19 { 20 20 struct x25_route *rt; 21 21 struct x25_neigh *neigh_new = NULL; 22 - struct list_head *entry; 23 22 struct x25_forward *x25_frwd, *new_frwd; 24 23 struct sk_buff *skbn; 25 24 short same_lci = 0; ··· 45 46 * established LCI? It shouldn't happen, just in case.. 46 47 */ 47 48 read_lock_bh(&x25_forward_list_lock); 48 - list_for_each(entry, &x25_forward_list) { 49 - x25_frwd = list_entry(entry, struct x25_forward, node); 49 + list_for_each_entry(x25_frwd, &x25_forward_list, node) { 50 50 if (x25_frwd->lci == lci) { 51 51 pr_warn("call request for lci which is already registered!, transmitting but not registering new pair\n"); 52 52 same_lci = 1; ··· 90 92 int x25_forward_data(int lci, struct x25_neigh *from, struct sk_buff *skb) { 91 93 92 94 struct x25_forward *frwd; 93 - struct list_head *entry; 94 95 struct net_device *peer = NULL; 95 96 struct x25_neigh *nb; 96 97 struct sk_buff *skbn; 97 98 int rc = 0; 98 99 99 100 read_lock_bh(&x25_forward_list_lock); 100 - list_for_each(entry, &x25_forward_list) { 101 - frwd = list_entry(entry, struct x25_forward, node); 101 + list_for_each_entry(frwd, &x25_forward_list, node) { 102 102 if (frwd->lci == lci) { 103 103 /* The call is established, either side can send */ 104 104 if (from->dev == frwd->dev1) {