diff options
author | Sasha Levin <sasha.levin@oracle.com> | 2013-02-27 20:06:00 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-02-27 22:10:24 -0500 |
commit | b67bfe0d42cac56c512dd5da4b1b347a23f4b70a (patch) | |
tree | 3d465aea12b97683f26ffa38eba8744469de9997 /net/atm | |
parent | 1e142b29e210b5dfb2deeb6ce2210b60af16d2a6 (diff) |
hlist: drop the node parameter from iterators
I'm not sure why, but the hlist for each entry iterators were conceived
list_for_each_entry(pos, head, member)
The hlist ones were greedy and wanted an extra parameter:
hlist_for_each_entry(tpos, pos, head, member)
Why did they need an extra pos parameter? I'm not quite sure. Not only
they don't really need it, it also prevents the iterator from looking
exactly like the list iterator, which is unfortunate.
Besides the semantic patch, there was some manual work required:
- Fix up the actual hlist iterators in linux/list.h
- Fix up the declaration of other iterators based on the hlist ones.
- A very small amount of places were using the 'node' parameter, this
was modified to use 'obj->member' instead.
- Coccinelle didn't handle the hlist_for_each_entry_safe iterator
properly, so those had to be fixed up manually.
The semantic patch which is mostly the work of Peter Senna Tschudin is here:
@@
iterator name hlist_for_each_entry, hlist_for_each_entry_continue, hlist_for_each_entry_from, hlist_for_each_entry_rcu, hlist_for_each_entry_rcu_bh, hlist_for_each_entry_continue_rcu_bh, for_each_busy_worker, ax25_uid_for_each, ax25_for_each, inet_bind_bucket_for_each, sctp_for_each_hentry, sk_for_each, sk_for_each_rcu, sk_for_each_from, sk_for_each_safe, sk_for_each_bound, hlist_for_each_entry_safe, hlist_for_each_entry_continue_rcu, nr_neigh_for_each, nr_neigh_for_each_safe, nr_node_for_each, nr_node_for_each_safe, for_each_gfn_indirect_valid_sp, for_each_gfn_sp, for_each_host;
type T;
expression a,c,d,e;
identifier b;
statement S;
@@
-T b;
<+... when != b
(
hlist_for_each_entry(a,
- b,
c, d) S
|
hlist_for_each_entry_continue(a,
- b,
c) S
|
hlist_for_each_entry_from(a,
- b,
c) S
|
hlist_for_each_entry_rcu(a,
- b,
c, d) S
|
hlist_for_each_entry_rcu_bh(a,
- b,
c, d) S
|
hlist_for_each_entry_continue_rcu_bh(a,
- b,
c) S
|
for_each_busy_worker(a, c,
- b,
d) S
|
ax25_uid_for_each(a,
- b,
c) S
|
ax25_for_each(a,
- b,
c) S
|
inet_bind_bucket_for_each(a,
- b,
c) S
|
sctp_for_each_hentry(a,
- b,
c) S
|
sk_for_each(a,
- b,
c) S
|
sk_for_each_rcu(a,
- b,
c) S
|
sk_for_each_from
-(a, b)
+(a)
S
+ sk_for_each_from(a) S
|
sk_for_each_safe(a,
- b,
c, d) S
|
sk_for_each_bound(a,
- b,
c) S
|
hlist_for_each_entry_safe(a,
- b,
c, d, e) S
|
hlist_for_each_entry_continue_rcu(a,
- b,
c) S
|
nr_neigh_for_each(a,
- b,
c) S
|
nr_neigh_for_each_safe(a,
- b,
c, d) S
|
nr_node_for_each(a,
- b,
c) S
|
nr_node_for_each_safe(a,
- b,
c, d) S
|
- for_each_gfn_sp(a, c, d, b) S
+ for_each_gfn_sp(a, c, d) S
|
- for_each_gfn_indirect_valid_sp(a, c, d, b) S
+ for_each_gfn_indirect_valid_sp(a, c, d) S
|
for_each_host(a,
- b,
c) S
|
for_each_host_safe(a,
- b,
c, d) S
|
for_each_mesh_entry(a,
- b,
c, d) S
)
...+>
[akpm@linux-foundation.org: drop bogus change from net/ipv4/raw.c]
[akpm@linux-foundation.org: drop bogus hunk from net/ipv6/raw.c]
[akpm@linux-foundation.org: checkpatch fixes]
[akpm@linux-foundation.org: fix warnings]
[akpm@linux-foudnation.org: redo intrusive kvm changes]
Tested-by: Peter Senna Tschudin <peter.senna@gmail.com>
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Cc: Wu Fengguang <fengguang.wu@intel.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'net/atm')
-rw-r--r-- | net/atm/common.c | 7 | ||||
-rw-r--r-- | net/atm/lec.c | 66 | ||||
-rw-r--r-- | net/atm/signaling.c | 3 |
3 files changed, 35 insertions, 41 deletions
diff --git a/net/atm/common.c b/net/atm/common.c index 806fc0a40051..7b491006eaf4 100644 --- a/net/atm/common.c +++ b/net/atm/common.c | |||
@@ -270,11 +270,11 @@ void atm_dev_release_vccs(struct atm_dev *dev) | |||
270 | write_lock_irq(&vcc_sklist_lock); | 270 | write_lock_irq(&vcc_sklist_lock); |
271 | for (i = 0; i < VCC_HTABLE_SIZE; i++) { | 271 | for (i = 0; i < VCC_HTABLE_SIZE; i++) { |
272 | struct hlist_head *head = &vcc_hash[i]; | 272 | struct hlist_head *head = &vcc_hash[i]; |
273 | struct hlist_node *node, *tmp; | 273 | struct hlist_node *tmp; |
274 | struct sock *s; | 274 | struct sock *s; |
275 | struct atm_vcc *vcc; | 275 | struct atm_vcc *vcc; |
276 | 276 | ||
277 | sk_for_each_safe(s, node, tmp, head) { | 277 | sk_for_each_safe(s, tmp, head) { |
278 | vcc = atm_sk(s); | 278 | vcc = atm_sk(s); |
279 | if (vcc->dev == dev) { | 279 | if (vcc->dev == dev) { |
280 | vcc_release_async(vcc, -EPIPE); | 280 | vcc_release_async(vcc, -EPIPE); |
@@ -317,11 +317,10 @@ static int adjust_tp(struct atm_trafprm *tp, unsigned char aal) | |||
317 | static int check_ci(const struct atm_vcc *vcc, short vpi, int vci) | 317 | static int check_ci(const struct atm_vcc *vcc, short vpi, int vci) |
318 | { | 318 | { |
319 | struct hlist_head *head = &vcc_hash[vci & (VCC_HTABLE_SIZE - 1)]; | 319 | struct hlist_head *head = &vcc_hash[vci & (VCC_HTABLE_SIZE - 1)]; |
320 | struct hlist_node *node; | ||
321 | struct sock *s; | 320 | struct sock *s; |
322 | struct atm_vcc *walk; | 321 | struct atm_vcc *walk; |
323 | 322 | ||
324 | sk_for_each(s, node, head) { | 323 | sk_for_each(s, head) { |
325 | walk = atm_sk(s); | 324 | walk = atm_sk(s); |
326 | if (walk->dev != vcc->dev) | 325 | if (walk->dev != vcc->dev) |
327 | continue; | 326 | continue; |
diff --git a/net/atm/lec.c b/net/atm/lec.c index 2e3d942e77f1..f23916be18fb 100644 --- a/net/atm/lec.c +++ b/net/atm/lec.c | |||
@@ -842,7 +842,9 @@ static void *lec_tbl_walk(struct lec_state *state, struct hlist_head *tbl, | |||
842 | --*l; | 842 | --*l; |
843 | } | 843 | } |
844 | 844 | ||
845 | hlist_for_each_entry_from(tmp, e, next) { | 845 | tmp = container_of(e, struct lec_arp_table, next); |
846 | |||
847 | hlist_for_each_entry_from(tmp, next) { | ||
846 | if (--*l < 0) | 848 | if (--*l < 0) |
847 | break; | 849 | break; |
848 | } | 850 | } |
@@ -1307,7 +1309,6 @@ lec_arp_add(struct lec_priv *priv, struct lec_arp_table *entry) | |||
1307 | static int | 1309 | static int |
1308 | lec_arp_remove(struct lec_priv *priv, struct lec_arp_table *to_remove) | 1310 | lec_arp_remove(struct lec_priv *priv, struct lec_arp_table *to_remove) |
1309 | { | 1311 | { |
1310 | struct hlist_node *node; | ||
1311 | struct lec_arp_table *entry; | 1312 | struct lec_arp_table *entry; |
1312 | int i, remove_vcc = 1; | 1313 | int i, remove_vcc = 1; |
1313 | 1314 | ||
@@ -1326,7 +1327,7 @@ lec_arp_remove(struct lec_priv *priv, struct lec_arp_table *to_remove) | |||
1326 | * ESI_FLUSH_PENDING, ESI_FORWARD_DIRECT | 1327 | * ESI_FLUSH_PENDING, ESI_FORWARD_DIRECT |
1327 | */ | 1328 | */ |
1328 | for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) { | 1329 | for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) { |
1329 | hlist_for_each_entry(entry, node, | 1330 | hlist_for_each_entry(entry, |
1330 | &priv->lec_arp_tables[i], next) { | 1331 | &priv->lec_arp_tables[i], next) { |
1331 | if (memcmp(to_remove->atm_addr, | 1332 | if (memcmp(to_remove->atm_addr, |
1332 | entry->atm_addr, ATM_ESA_LEN) == 0) { | 1333 | entry->atm_addr, ATM_ESA_LEN) == 0) { |
@@ -1364,14 +1365,13 @@ static const char *get_status_string(unsigned char st) | |||
1364 | 1365 | ||
1365 | static void dump_arp_table(struct lec_priv *priv) | 1366 | static void dump_arp_table(struct lec_priv *priv) |
1366 | { | 1367 | { |
1367 | struct hlist_node *node; | ||
1368 | struct lec_arp_table *rulla; | 1368 | struct lec_arp_table *rulla; |
1369 | char buf[256]; | 1369 | char buf[256]; |
1370 | int i, j, offset; | 1370 | int i, j, offset; |
1371 | 1371 | ||
1372 | pr_info("Dump %p:\n", priv); | 1372 | pr_info("Dump %p:\n", priv); |
1373 | for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) { | 1373 | for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) { |
1374 | hlist_for_each_entry(rulla, node, | 1374 | hlist_for_each_entry(rulla, |
1375 | &priv->lec_arp_tables[i], next) { | 1375 | &priv->lec_arp_tables[i], next) { |
1376 | offset = 0; | 1376 | offset = 0; |
1377 | offset += sprintf(buf, "%d: %p\n", i, rulla); | 1377 | offset += sprintf(buf, "%d: %p\n", i, rulla); |
@@ -1403,7 +1403,7 @@ static void dump_arp_table(struct lec_priv *priv) | |||
1403 | 1403 | ||
1404 | if (!hlist_empty(&priv->lec_no_forward)) | 1404 | if (!hlist_empty(&priv->lec_no_forward)) |
1405 | pr_info("No forward\n"); | 1405 | pr_info("No forward\n"); |
1406 | hlist_for_each_entry(rulla, node, &priv->lec_no_forward, next) { | 1406 | hlist_for_each_entry(rulla, &priv->lec_no_forward, next) { |
1407 | offset = 0; | 1407 | offset = 0; |
1408 | offset += sprintf(buf + offset, "Mac: %pM", rulla->mac_addr); | 1408 | offset += sprintf(buf + offset, "Mac: %pM", rulla->mac_addr); |
1409 | offset += sprintf(buf + offset, " Atm:"); | 1409 | offset += sprintf(buf + offset, " Atm:"); |
@@ -1428,7 +1428,7 @@ static void dump_arp_table(struct lec_priv *priv) | |||
1428 | 1428 | ||
1429 | if (!hlist_empty(&priv->lec_arp_empty_ones)) | 1429 | if (!hlist_empty(&priv->lec_arp_empty_ones)) |
1430 | pr_info("Empty ones\n"); | 1430 | pr_info("Empty ones\n"); |
1431 | hlist_for_each_entry(rulla, node, &priv->lec_arp_empty_ones, next) { | 1431 | hlist_for_each_entry(rulla, &priv->lec_arp_empty_ones, next) { |
1432 | offset = 0; | 1432 | offset = 0; |
1433 | offset += sprintf(buf + offset, "Mac: %pM", rulla->mac_addr); | 1433 | offset += sprintf(buf + offset, "Mac: %pM", rulla->mac_addr); |
1434 | offset += sprintf(buf + offset, " Atm:"); | 1434 | offset += sprintf(buf + offset, " Atm:"); |
@@ -1453,7 +1453,7 @@ static void dump_arp_table(struct lec_priv *priv) | |||
1453 | 1453 | ||
1454 | if (!hlist_empty(&priv->mcast_fwds)) | 1454 | if (!hlist_empty(&priv->mcast_fwds)) |
1455 | pr_info("Multicast Forward VCCs\n"); | 1455 | pr_info("Multicast Forward VCCs\n"); |
1456 | hlist_for_each_entry(rulla, node, &priv->mcast_fwds, next) { | 1456 | hlist_for_each_entry(rulla, &priv->mcast_fwds, next) { |
1457 | offset = 0; | 1457 | offset = 0; |
1458 | offset += sprintf(buf + offset, "Mac: %pM", rulla->mac_addr); | 1458 | offset += sprintf(buf + offset, "Mac: %pM", rulla->mac_addr); |
1459 | offset += sprintf(buf + offset, " Atm:"); | 1459 | offset += sprintf(buf + offset, " Atm:"); |
@@ -1487,7 +1487,7 @@ static void dump_arp_table(struct lec_priv *priv) | |||
1487 | static void lec_arp_destroy(struct lec_priv *priv) | 1487 | static void lec_arp_destroy(struct lec_priv *priv) |
1488 | { | 1488 | { |
1489 | unsigned long flags; | 1489 | unsigned long flags; |
1490 | struct hlist_node *node, *next; | 1490 | struct hlist_node *next; |
1491 | struct lec_arp_table *entry; | 1491 | struct lec_arp_table *entry; |
1492 | int i; | 1492 | int i; |
1493 | 1493 | ||
@@ -1499,7 +1499,7 @@ static void lec_arp_destroy(struct lec_priv *priv) | |||
1499 | 1499 | ||
1500 | spin_lock_irqsave(&priv->lec_arp_lock, flags); | 1500 | spin_lock_irqsave(&priv->lec_arp_lock, flags); |
1501 | for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) { | 1501 | for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) { |
1502 | hlist_for_each_entry_safe(entry, node, next, | 1502 | hlist_for_each_entry_safe(entry, next, |
1503 | &priv->lec_arp_tables[i], next) { | 1503 | &priv->lec_arp_tables[i], next) { |
1504 | lec_arp_remove(priv, entry); | 1504 | lec_arp_remove(priv, entry); |
1505 | lec_arp_put(entry); | 1505 | lec_arp_put(entry); |
@@ -1507,7 +1507,7 @@ static void lec_arp_destroy(struct lec_priv *priv) | |||
1507 | INIT_HLIST_HEAD(&priv->lec_arp_tables[i]); | 1507 | INIT_HLIST_HEAD(&priv->lec_arp_tables[i]); |
1508 | } | 1508 | } |
1509 | 1509 | ||
1510 | hlist_for_each_entry_safe(entry, node, next, | 1510 | hlist_for_each_entry_safe(entry, next, |
1511 | &priv->lec_arp_empty_ones, next) { | 1511 | &priv->lec_arp_empty_ones, next) { |
1512 | del_timer_sync(&entry->timer); | 1512 | del_timer_sync(&entry->timer); |
1513 | lec_arp_clear_vccs(entry); | 1513 | lec_arp_clear_vccs(entry); |
@@ -1516,7 +1516,7 @@ static void lec_arp_destroy(struct lec_priv *priv) | |||
1516 | } | 1516 | } |
1517 | INIT_HLIST_HEAD(&priv->lec_arp_empty_ones); | 1517 | INIT_HLIST_HEAD(&priv->lec_arp_empty_ones); |
1518 | 1518 | ||
1519 | hlist_for_each_entry_safe(entry, node, next, | 1519 | hlist_for_each_entry_safe(entry, next, |
1520 | &priv->lec_no_forward, next) { | 1520 | &priv->lec_no_forward, next) { |
1521 | del_timer_sync(&entry->timer); | 1521 | del_timer_sync(&entry->timer); |
1522 | lec_arp_clear_vccs(entry); | 1522 | lec_arp_clear_vccs(entry); |
@@ -1525,7 +1525,7 @@ static void lec_arp_destroy(struct lec_priv *priv) | |||
1525 | } | 1525 | } |
1526 | INIT_HLIST_HEAD(&priv->lec_no_forward); | 1526 | INIT_HLIST_HEAD(&priv->lec_no_forward); |
1527 | 1527 | ||
1528 | hlist_for_each_entry_safe(entry, node, next, &priv->mcast_fwds, next) { | 1528 | hlist_for_each_entry_safe(entry, next, &priv->mcast_fwds, next) { |
1529 | /* No timer, LANEv2 7.1.20 and 2.3.5.3 */ | 1529 | /* No timer, LANEv2 7.1.20 and 2.3.5.3 */ |
1530 | lec_arp_clear_vccs(entry); | 1530 | lec_arp_clear_vccs(entry); |
1531 | hlist_del(&entry->next); | 1531 | hlist_del(&entry->next); |
@@ -1542,14 +1542,13 @@ static void lec_arp_destroy(struct lec_priv *priv) | |||
1542 | static struct lec_arp_table *lec_arp_find(struct lec_priv *priv, | 1542 | static struct lec_arp_table *lec_arp_find(struct lec_priv *priv, |
1543 | const unsigned char *mac_addr) | 1543 | const unsigned char *mac_addr) |
1544 | { | 1544 | { |
1545 | struct hlist_node *node; | ||
1546 | struct hlist_head *head; | 1545 | struct hlist_head *head; |
1547 | struct lec_arp_table *entry; | 1546 | struct lec_arp_table *entry; |
1548 | 1547 | ||
1549 | pr_debug("%pM\n", mac_addr); | 1548 | pr_debug("%pM\n", mac_addr); |
1550 | 1549 | ||
1551 | head = &priv->lec_arp_tables[HASH(mac_addr[ETH_ALEN - 1])]; | 1550 | head = &priv->lec_arp_tables[HASH(mac_addr[ETH_ALEN - 1])]; |
1552 | hlist_for_each_entry(entry, node, head, next) { | 1551 | hlist_for_each_entry(entry, head, next) { |
1553 | if (ether_addr_equal(mac_addr, entry->mac_addr)) | 1552 | if (ether_addr_equal(mac_addr, entry->mac_addr)) |
1554 | return entry; | 1553 | return entry; |
1555 | } | 1554 | } |
@@ -1686,7 +1685,7 @@ static void lec_arp_check_expire(struct work_struct *work) | |||
1686 | unsigned long flags; | 1685 | unsigned long flags; |
1687 | struct lec_priv *priv = | 1686 | struct lec_priv *priv = |
1688 | container_of(work, struct lec_priv, lec_arp_work.work); | 1687 | container_of(work, struct lec_priv, lec_arp_work.work); |
1689 | struct hlist_node *node, *next; | 1688 | struct hlist_node *next; |
1690 | struct lec_arp_table *entry; | 1689 | struct lec_arp_table *entry; |
1691 | unsigned long now; | 1690 | unsigned long now; |
1692 | int i; | 1691 | int i; |
@@ -1696,7 +1695,7 @@ static void lec_arp_check_expire(struct work_struct *work) | |||
1696 | restart: | 1695 | restart: |
1697 | spin_lock_irqsave(&priv->lec_arp_lock, flags); | 1696 | spin_lock_irqsave(&priv->lec_arp_lock, flags); |
1698 | for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) { | 1697 | for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) { |
1699 | hlist_for_each_entry_safe(entry, node, next, | 1698 | hlist_for_each_entry_safe(entry, next, |
1700 | &priv->lec_arp_tables[i], next) { | 1699 | &priv->lec_arp_tables[i], next) { |
1701 | if (__lec_arp_check_expire(entry, now, priv)) { | 1700 | if (__lec_arp_check_expire(entry, now, priv)) { |
1702 | struct sk_buff *skb; | 1701 | struct sk_buff *skb; |
@@ -1823,14 +1822,14 @@ lec_addr_delete(struct lec_priv *priv, const unsigned char *atm_addr, | |||
1823 | unsigned long permanent) | 1822 | unsigned long permanent) |
1824 | { | 1823 | { |
1825 | unsigned long flags; | 1824 | unsigned long flags; |
1826 | struct hlist_node *node, *next; | 1825 | struct hlist_node *next; |
1827 | struct lec_arp_table *entry; | 1826 | struct lec_arp_table *entry; |
1828 | int i; | 1827 | int i; |
1829 | 1828 | ||
1830 | pr_debug("\n"); | 1829 | pr_debug("\n"); |
1831 | spin_lock_irqsave(&priv->lec_arp_lock, flags); | 1830 | spin_lock_irqsave(&priv->lec_arp_lock, flags); |
1832 | for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) { | 1831 | for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) { |
1833 | hlist_for_each_entry_safe(entry, node, next, | 1832 | hlist_for_each_entry_safe(entry, next, |
1834 | &priv->lec_arp_tables[i], next) { | 1833 | &priv->lec_arp_tables[i], next) { |
1835 | if (!memcmp(atm_addr, entry->atm_addr, ATM_ESA_LEN) && | 1834 | if (!memcmp(atm_addr, entry->atm_addr, ATM_ESA_LEN) && |
1836 | (permanent || | 1835 | (permanent || |
@@ -1855,7 +1854,7 @@ lec_arp_update(struct lec_priv *priv, const unsigned char *mac_addr, | |||
1855 | unsigned int targetless_le_arp) | 1854 | unsigned int targetless_le_arp) |
1856 | { | 1855 | { |
1857 | unsigned long flags; | 1856 | unsigned long flags; |
1858 | struct hlist_node *node, *next; | 1857 | struct hlist_node *next; |
1859 | struct lec_arp_table *entry, *tmp; | 1858 | struct lec_arp_table *entry, *tmp; |
1860 | int i; | 1859 | int i; |
1861 | 1860 | ||
@@ -1870,7 +1869,7 @@ lec_arp_update(struct lec_priv *priv, const unsigned char *mac_addr, | |||
1870 | * we have no entry in the cache. 7.1.30 | 1869 | * we have no entry in the cache. 7.1.30 |
1871 | */ | 1870 | */ |
1872 | if (!hlist_empty(&priv->lec_arp_empty_ones)) { | 1871 | if (!hlist_empty(&priv->lec_arp_empty_ones)) { |
1873 | hlist_for_each_entry_safe(entry, node, next, | 1872 | hlist_for_each_entry_safe(entry, next, |
1874 | &priv->lec_arp_empty_ones, next) { | 1873 | &priv->lec_arp_empty_ones, next) { |
1875 | if (memcmp(entry->atm_addr, atm_addr, ATM_ESA_LEN) == 0) { | 1874 | if (memcmp(entry->atm_addr, atm_addr, ATM_ESA_LEN) == 0) { |
1876 | hlist_del(&entry->next); | 1875 | hlist_del(&entry->next); |
@@ -1915,7 +1914,7 @@ lec_arp_update(struct lec_priv *priv, const unsigned char *mac_addr, | |||
1915 | memcpy(entry->atm_addr, atm_addr, ATM_ESA_LEN); | 1914 | memcpy(entry->atm_addr, atm_addr, ATM_ESA_LEN); |
1916 | del_timer(&entry->timer); | 1915 | del_timer(&entry->timer); |
1917 | for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) { | 1916 | for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) { |
1918 | hlist_for_each_entry(tmp, node, | 1917 | hlist_for_each_entry(tmp, |
1919 | &priv->lec_arp_tables[i], next) { | 1918 | &priv->lec_arp_tables[i], next) { |
1920 | if (entry != tmp && | 1919 | if (entry != tmp && |
1921 | !memcmp(tmp->atm_addr, atm_addr, ATM_ESA_LEN)) { | 1920 | !memcmp(tmp->atm_addr, atm_addr, ATM_ESA_LEN)) { |
@@ -1956,7 +1955,6 @@ lec_vcc_added(struct lec_priv *priv, const struct atmlec_ioc *ioc_data, | |||
1956 | void (*old_push) (struct atm_vcc *vcc, struct sk_buff *skb)) | 1955 | void (*old_push) (struct atm_vcc *vcc, struct sk_buff *skb)) |
1957 | { | 1956 | { |
1958 | unsigned long flags; | 1957 | unsigned long flags; |
1959 | struct hlist_node *node; | ||
1960 | struct lec_arp_table *entry; | 1958 | struct lec_arp_table *entry; |
1961 | int i, found_entry = 0; | 1959 | int i, found_entry = 0; |
1962 | 1960 | ||
@@ -2026,7 +2024,7 @@ lec_vcc_added(struct lec_priv *priv, const struct atmlec_ioc *ioc_data, | |||
2026 | ioc_data->atm_addr[16], ioc_data->atm_addr[17], | 2024 | ioc_data->atm_addr[16], ioc_data->atm_addr[17], |
2027 | ioc_data->atm_addr[18], ioc_data->atm_addr[19]); | 2025 | ioc_data->atm_addr[18], ioc_data->atm_addr[19]); |
2028 | for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) { | 2026 | for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) { |
2029 | hlist_for_each_entry(entry, node, | 2027 | hlist_for_each_entry(entry, |
2030 | &priv->lec_arp_tables[i], next) { | 2028 | &priv->lec_arp_tables[i], next) { |
2031 | if (memcmp | 2029 | if (memcmp |
2032 | (ioc_data->atm_addr, entry->atm_addr, | 2030 | (ioc_data->atm_addr, entry->atm_addr, |
@@ -2103,7 +2101,6 @@ out: | |||
2103 | static void lec_flush_complete(struct lec_priv *priv, unsigned long tran_id) | 2101 | static void lec_flush_complete(struct lec_priv *priv, unsigned long tran_id) |
2104 | { | 2102 | { |
2105 | unsigned long flags; | 2103 | unsigned long flags; |
2106 | struct hlist_node *node; | ||
2107 | struct lec_arp_table *entry; | 2104 | struct lec_arp_table *entry; |
2108 | int i; | 2105 | int i; |
2109 | 2106 | ||
@@ -2111,7 +2108,7 @@ static void lec_flush_complete(struct lec_priv *priv, unsigned long tran_id) | |||
2111 | restart: | 2108 | restart: |
2112 | spin_lock_irqsave(&priv->lec_arp_lock, flags); | 2109 | spin_lock_irqsave(&priv->lec_arp_lock, flags); |
2113 | for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) { | 2110 | for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) { |
2114 | hlist_for_each_entry(entry, node, | 2111 | hlist_for_each_entry(entry, |
2115 | &priv->lec_arp_tables[i], next) { | 2112 | &priv->lec_arp_tables[i], next) { |
2116 | if (entry->flush_tran_id == tran_id && | 2113 | if (entry->flush_tran_id == tran_id && |
2117 | entry->status == ESI_FLUSH_PENDING) { | 2114 | entry->status == ESI_FLUSH_PENDING) { |
@@ -2140,13 +2137,12 @@ lec_set_flush_tran_id(struct lec_priv *priv, | |||
2140 | const unsigned char *atm_addr, unsigned long tran_id) | 2137 | const unsigned char *atm_addr, unsigned long tran_id) |
2141 | { | 2138 | { |
2142 | unsigned long flags; | 2139 | unsigned long flags; |
2143 | struct hlist_node *node; | ||
2144 | struct lec_arp_table *entry; | 2140 | struct lec_arp_table *entry; |
2145 | int i; | 2141 | int i; |
2146 | 2142 | ||
2147 | spin_lock_irqsave(&priv->lec_arp_lock, flags); | 2143 | spin_lock_irqsave(&priv->lec_arp_lock, flags); |
2148 | for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) | 2144 | for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) |
2149 | hlist_for_each_entry(entry, node, | 2145 | hlist_for_each_entry(entry, |
2150 | &priv->lec_arp_tables[i], next) { | 2146 | &priv->lec_arp_tables[i], next) { |
2151 | if (!memcmp(atm_addr, entry->atm_addr, ATM_ESA_LEN)) { | 2147 | if (!memcmp(atm_addr, entry->atm_addr, ATM_ESA_LEN)) { |
2152 | entry->flush_tran_id = tran_id; | 2148 | entry->flush_tran_id = tran_id; |
@@ -2198,7 +2194,7 @@ out: | |||
2198 | static void lec_vcc_close(struct lec_priv *priv, struct atm_vcc *vcc) | 2194 | static void lec_vcc_close(struct lec_priv *priv, struct atm_vcc *vcc) |
2199 | { | 2195 | { |
2200 | unsigned long flags; | 2196 | unsigned long flags; |
2201 | struct hlist_node *node, *next; | 2197 | struct hlist_node *next; |
2202 | struct lec_arp_table *entry; | 2198 | struct lec_arp_table *entry; |
2203 | int i; | 2199 | int i; |
2204 | 2200 | ||
@@ -2208,7 +2204,7 @@ static void lec_vcc_close(struct lec_priv *priv, struct atm_vcc *vcc) | |||
2208 | spin_lock_irqsave(&priv->lec_arp_lock, flags); | 2204 | spin_lock_irqsave(&priv->lec_arp_lock, flags); |
2209 | 2205 | ||
2210 | for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) { | 2206 | for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) { |
2211 | hlist_for_each_entry_safe(entry, node, next, | 2207 | hlist_for_each_entry_safe(entry, next, |
2212 | &priv->lec_arp_tables[i], next) { | 2208 | &priv->lec_arp_tables[i], next) { |
2213 | if (vcc == entry->vcc) { | 2209 | if (vcc == entry->vcc) { |
2214 | lec_arp_remove(priv, entry); | 2210 | lec_arp_remove(priv, entry); |
@@ -2219,7 +2215,7 @@ static void lec_vcc_close(struct lec_priv *priv, struct atm_vcc *vcc) | |||
2219 | } | 2215 | } |
2220 | } | 2216 | } |
2221 | 2217 | ||
2222 | hlist_for_each_entry_safe(entry, node, next, | 2218 | hlist_for_each_entry_safe(entry, next, |
2223 | &priv->lec_arp_empty_ones, next) { | 2219 | &priv->lec_arp_empty_ones, next) { |
2224 | if (entry->vcc == vcc) { | 2220 | if (entry->vcc == vcc) { |
2225 | lec_arp_clear_vccs(entry); | 2221 | lec_arp_clear_vccs(entry); |
@@ -2229,7 +2225,7 @@ static void lec_vcc_close(struct lec_priv *priv, struct atm_vcc *vcc) | |||
2229 | } | 2225 | } |
2230 | } | 2226 | } |
2231 | 2227 | ||
2232 | hlist_for_each_entry_safe(entry, node, next, | 2228 | hlist_for_each_entry_safe(entry, next, |
2233 | &priv->lec_no_forward, next) { | 2229 | &priv->lec_no_forward, next) { |
2234 | if (entry->recv_vcc == vcc) { | 2230 | if (entry->recv_vcc == vcc) { |
2235 | lec_arp_clear_vccs(entry); | 2231 | lec_arp_clear_vccs(entry); |
@@ -2239,7 +2235,7 @@ static void lec_vcc_close(struct lec_priv *priv, struct atm_vcc *vcc) | |||
2239 | } | 2235 | } |
2240 | } | 2236 | } |
2241 | 2237 | ||
2242 | hlist_for_each_entry_safe(entry, node, next, &priv->mcast_fwds, next) { | 2238 | hlist_for_each_entry_safe(entry, next, &priv->mcast_fwds, next) { |
2243 | if (entry->recv_vcc == vcc) { | 2239 | if (entry->recv_vcc == vcc) { |
2244 | lec_arp_clear_vccs(entry); | 2240 | lec_arp_clear_vccs(entry); |
2245 | /* No timer, LANEv2 7.1.20 and 2.3.5.3 */ | 2241 | /* No timer, LANEv2 7.1.20 and 2.3.5.3 */ |
@@ -2257,13 +2253,13 @@ lec_arp_check_empties(struct lec_priv *priv, | |||
2257 | struct atm_vcc *vcc, struct sk_buff *skb) | 2253 | struct atm_vcc *vcc, struct sk_buff *skb) |
2258 | { | 2254 | { |
2259 | unsigned long flags; | 2255 | unsigned long flags; |
2260 | struct hlist_node *node, *next; | 2256 | struct hlist_node *next; |
2261 | struct lec_arp_table *entry, *tmp; | 2257 | struct lec_arp_table *entry, *tmp; |
2262 | struct lecdatahdr_8023 *hdr = (struct lecdatahdr_8023 *)skb->data; | 2258 | struct lecdatahdr_8023 *hdr = (struct lecdatahdr_8023 *)skb->data; |
2263 | unsigned char *src = hdr->h_source; | 2259 | unsigned char *src = hdr->h_source; |
2264 | 2260 | ||
2265 | spin_lock_irqsave(&priv->lec_arp_lock, flags); | 2261 | spin_lock_irqsave(&priv->lec_arp_lock, flags); |
2266 | hlist_for_each_entry_safe(entry, node, next, | 2262 | hlist_for_each_entry_safe(entry, next, |
2267 | &priv->lec_arp_empty_ones, next) { | 2263 | &priv->lec_arp_empty_ones, next) { |
2268 | if (vcc == entry->vcc) { | 2264 | if (vcc == entry->vcc) { |
2269 | del_timer(&entry->timer); | 2265 | del_timer(&entry->timer); |
diff --git a/net/atm/signaling.c b/net/atm/signaling.c index 86767ca908a3..4176887e72eb 100644 --- a/net/atm/signaling.c +++ b/net/atm/signaling.c | |||
@@ -217,7 +217,6 @@ static void purge_vcc(struct atm_vcc *vcc) | |||
217 | 217 | ||
218 | static void sigd_close(struct atm_vcc *vcc) | 218 | static void sigd_close(struct atm_vcc *vcc) |
219 | { | 219 | { |
220 | struct hlist_node *node; | ||
221 | struct sock *s; | 220 | struct sock *s; |
222 | int i; | 221 | int i; |
223 | 222 | ||
@@ -231,7 +230,7 @@ static void sigd_close(struct atm_vcc *vcc) | |||
231 | for (i = 0; i < VCC_HTABLE_SIZE; ++i) { | 230 | for (i = 0; i < VCC_HTABLE_SIZE; ++i) { |
232 | struct hlist_head *head = &vcc_hash[i]; | 231 | struct hlist_head *head = &vcc_hash[i]; |
233 | 232 | ||
234 | sk_for_each(s, node, head) { | 233 | sk_for_each(s, head) { |
235 | vcc = atm_sk(s); | 234 | vcc = atm_sk(s); |
236 | 235 | ||
237 | purge_vcc(vcc); | 236 | purge_vcc(vcc); |