Commit 1e5946f5 authored by chenqiwu's avatar chenqiwu Committed by David S. Miller

net: x25: convert to list_for_each_entry_safe()

Use list_for_each_entry_safe() instead of list_for_each_safe()
to simplify the code.
Signed-off-by: default avatarchenqiwu <chenqiwu@xiaomi.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 1f4c51de
...@@ -131,13 +131,11 @@ int x25_forward_data(int lci, struct x25_neigh *from, struct sk_buff *skb) { ...@@ -131,13 +131,11 @@ int x25_forward_data(int lci, struct x25_neigh *from, struct sk_buff *skb) {
void x25_clear_forward_by_lci(unsigned int lci) void x25_clear_forward_by_lci(unsigned int lci)
{ {
struct x25_forward *fwd; struct x25_forward *fwd, *tmp;
struct list_head *entry, *tmp;
write_lock_bh(&x25_forward_list_lock); write_lock_bh(&x25_forward_list_lock);
list_for_each_safe(entry, tmp, &x25_forward_list) { list_for_each_entry_safe(fwd, tmp, &x25_forward_list, node) {
fwd = list_entry(entry, struct x25_forward, node);
if (fwd->lci == lci) { if (fwd->lci == lci) {
list_del(&fwd->node); list_del(&fwd->node);
kfree(fwd); kfree(fwd);
...@@ -149,13 +147,11 @@ void x25_clear_forward_by_lci(unsigned int lci) ...@@ -149,13 +147,11 @@ void x25_clear_forward_by_lci(unsigned int lci)
void x25_clear_forward_by_dev(struct net_device *dev) void x25_clear_forward_by_dev(struct net_device *dev)
{ {
struct x25_forward *fwd; struct x25_forward *fwd, *tmp;
struct list_head *entry, *tmp;
write_lock_bh(&x25_forward_list_lock); write_lock_bh(&x25_forward_list_lock);
list_for_each_safe(entry, tmp, &x25_forward_list) { list_for_each_entry_safe(fwd, tmp, &x25_forward_list, node) {
fwd = list_entry(entry, struct x25_forward, node);
if ((fwd->dev1 == dev) || (fwd->dev2 == dev)){ if ((fwd->dev1 == dev) || (fwd->dev2 == dev)){
list_del(&fwd->node); list_del(&fwd->node);
kfree(fwd); kfree(fwd);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment