aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorSasha Levin <sasha.levin@oracle.com>2013-02-27 20:06:00 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-02-27 22:10:24 -0500
commitb67bfe0d42cac56c512dd5da4b1b347a23f4b70a (patch)
tree3d465aea12b97683f26ffa38eba8744469de9997 /drivers/net
parent1e142b29e210b5dfb2deeb6ce2210b60af16d2a6 (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 'drivers/net')
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c18
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_main.c8
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_netdev.c17
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_rx.c4
-rw-r--r--drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c10
-rw-r--r--drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c10
-rw-r--r--drivers/net/ethernet/sun/sunvnet.c3
-rw-r--r--drivers/net/macvlan.c6
-rw-r--r--drivers/net/tun.c15
-rw-r--r--drivers/net/vxlan.c12
-rw-r--r--drivers/net/wireless/zd1201.c7
11 files changed, 50 insertions, 60 deletions
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
index f4d2e9e3c6d5..c3f1afd86906 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
@@ -2197,13 +2197,13 @@ static int ixgbe_get_ethtool_fdir_entry(struct ixgbe_adapter *adapter,
2197 union ixgbe_atr_input *mask = &adapter->fdir_mask; 2197 union ixgbe_atr_input *mask = &adapter->fdir_mask;
2198 struct ethtool_rx_flow_spec *fsp = 2198 struct ethtool_rx_flow_spec *fsp =
2199 (struct ethtool_rx_flow_spec *)&cmd->fs; 2199 (struct ethtool_rx_flow_spec *)&cmd->fs;
2200 struct hlist_node *node, *node2; 2200 struct hlist_node *node2;
2201 struct ixgbe_fdir_filter *rule = NULL; 2201 struct ixgbe_fdir_filter *rule = NULL;
2202 2202
2203 /* report total rule count */ 2203 /* report total rule count */
2204 cmd->data = (1024 << adapter->fdir_pballoc) - 2; 2204 cmd->data = (1024 << adapter->fdir_pballoc) - 2;
2205 2205
2206 hlist_for_each_entry_safe(rule, node, node2, 2206 hlist_for_each_entry_safe(rule, node2,
2207 &adapter->fdir_filter_list, fdir_node) { 2207 &adapter->fdir_filter_list, fdir_node) {
2208 if (fsp->location <= rule->sw_idx) 2208 if (fsp->location <= rule->sw_idx)
2209 break; 2209 break;
@@ -2264,14 +2264,14 @@ static int ixgbe_get_ethtool_fdir_all(struct ixgbe_adapter *adapter,
2264 struct ethtool_rxnfc *cmd, 2264 struct ethtool_rxnfc *cmd,
2265 u32 *rule_locs) 2265 u32 *rule_locs)
2266{ 2266{
2267 struct hlist_node *node, *node2; 2267 struct hlist_node *node2;
2268 struct ixgbe_fdir_filter *rule; 2268 struct ixgbe_fdir_filter *rule;
2269 int cnt = 0; 2269 int cnt = 0;
2270 2270
2271 /* report total rule count */ 2271 /* report total rule count */
2272 cmd->data = (1024 << adapter->fdir_pballoc) - 2; 2272 cmd->data = (1024 << adapter->fdir_pballoc) - 2;
2273 2273
2274 hlist_for_each_entry_safe(rule, node, node2, 2274 hlist_for_each_entry_safe(rule, node2,
2275 &adapter->fdir_filter_list, fdir_node) { 2275 &adapter->fdir_filter_list, fdir_node) {
2276 if (cnt == cmd->rule_cnt) 2276 if (cnt == cmd->rule_cnt)
2277 return -EMSGSIZE; 2277 return -EMSGSIZE;
@@ -2358,19 +2358,19 @@ static int ixgbe_update_ethtool_fdir_entry(struct ixgbe_adapter *adapter,
2358 u16 sw_idx) 2358 u16 sw_idx)
2359{ 2359{
2360 struct ixgbe_hw *hw = &adapter->hw; 2360 struct ixgbe_hw *hw = &adapter->hw;
2361 struct hlist_node *node, *node2, *parent; 2361 struct hlist_node *node2;
2362 struct ixgbe_fdir_filter *rule; 2362 struct ixgbe_fdir_filter *rule, *parent;
2363 int err = -EINVAL; 2363 int err = -EINVAL;
2364 2364
2365 parent = NULL; 2365 parent = NULL;
2366 rule = NULL; 2366 rule = NULL;
2367 2367
2368 hlist_for_each_entry_safe(rule, node, node2, 2368 hlist_for_each_entry_safe(rule, node2,
2369 &adapter->fdir_filter_list, fdir_node) { 2369 &adapter->fdir_filter_list, fdir_node) {
2370 /* hash found, or no matching entry */ 2370 /* hash found, or no matching entry */
2371 if (rule->sw_idx >= sw_idx) 2371 if (rule->sw_idx >= sw_idx)
2372 break; 2372 break;
2373 parent = node; 2373 parent = rule;
2374 } 2374 }
2375 2375
2376 /* if there is an old rule occupying our place remove it */ 2376 /* if there is an old rule occupying our place remove it */
@@ -2399,7 +2399,7 @@ static int ixgbe_update_ethtool_fdir_entry(struct ixgbe_adapter *adapter,
2399 2399
2400 /* add filter to the list */ 2400 /* add filter to the list */
2401 if (parent) 2401 if (parent)
2402 hlist_add_after(parent, &input->fdir_node); 2402 hlist_add_after(&parent->fdir_node, &input->fdir_node);
2403 else 2403 else
2404 hlist_add_head(&input->fdir_node, 2404 hlist_add_head(&input->fdir_node,
2405 &adapter->fdir_filter_list); 2405 &adapter->fdir_filter_list);
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 68478d6dfa2d..db5611ae407e 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -3891,7 +3891,7 @@ static void ixgbe_configure_pb(struct ixgbe_adapter *adapter)
3891static void ixgbe_fdir_filter_restore(struct ixgbe_adapter *adapter) 3891static void ixgbe_fdir_filter_restore(struct ixgbe_adapter *adapter)
3892{ 3892{
3893 struct ixgbe_hw *hw = &adapter->hw; 3893 struct ixgbe_hw *hw = &adapter->hw;
3894 struct hlist_node *node, *node2; 3894 struct hlist_node *node2;
3895 struct ixgbe_fdir_filter *filter; 3895 struct ixgbe_fdir_filter *filter;
3896 3896
3897 spin_lock(&adapter->fdir_perfect_lock); 3897 spin_lock(&adapter->fdir_perfect_lock);
@@ -3899,7 +3899,7 @@ static void ixgbe_fdir_filter_restore(struct ixgbe_adapter *adapter)
3899 if (!hlist_empty(&adapter->fdir_filter_list)) 3899 if (!hlist_empty(&adapter->fdir_filter_list))
3900 ixgbe_fdir_set_input_mask_82599(hw, &adapter->fdir_mask); 3900 ixgbe_fdir_set_input_mask_82599(hw, &adapter->fdir_mask);
3901 3901
3902 hlist_for_each_entry_safe(filter, node, node2, 3902 hlist_for_each_entry_safe(filter, node2,
3903 &adapter->fdir_filter_list, fdir_node) { 3903 &adapter->fdir_filter_list, fdir_node) {
3904 ixgbe_fdir_write_perfect_filter_82599(hw, 3904 ixgbe_fdir_write_perfect_filter_82599(hw,
3905 &filter->filter, 3905 &filter->filter,
@@ -4356,12 +4356,12 @@ static void ixgbe_clean_all_tx_rings(struct ixgbe_adapter *adapter)
4356 4356
4357static void ixgbe_fdir_filter_exit(struct ixgbe_adapter *adapter) 4357static void ixgbe_fdir_filter_exit(struct ixgbe_adapter *adapter)
4358{ 4358{
4359 struct hlist_node *node, *node2; 4359 struct hlist_node *node2;
4360 struct ixgbe_fdir_filter *filter; 4360 struct ixgbe_fdir_filter *filter;
4361 4361
4362 spin_lock(&adapter->fdir_perfect_lock); 4362 spin_lock(&adapter->fdir_perfect_lock);
4363 4363
4364 hlist_for_each_entry_safe(filter, node, node2, 4364 hlist_for_each_entry_safe(filter, node2,
4365 &adapter->fdir_filter_list, fdir_node) { 4365 &adapter->fdir_filter_list, fdir_node) {
4366 hlist_del(&filter->fdir_node); 4366 hlist_del(&filter->fdir_node);
4367 kfree(filter); 4367 kfree(filter);
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
index 5385474bb526..bb4d8d99f36d 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
@@ -225,11 +225,10 @@ static inline struct mlx4_en_filter *
225mlx4_en_filter_find(struct mlx4_en_priv *priv, __be32 src_ip, __be32 dst_ip, 225mlx4_en_filter_find(struct mlx4_en_priv *priv, __be32 src_ip, __be32 dst_ip,
226 __be16 src_port, __be16 dst_port) 226 __be16 src_port, __be16 dst_port)
227{ 227{
228 struct hlist_node *elem;
229 struct mlx4_en_filter *filter; 228 struct mlx4_en_filter *filter;
230 struct mlx4_en_filter *ret = NULL; 229 struct mlx4_en_filter *ret = NULL;
231 230
232 hlist_for_each_entry(filter, elem, 231 hlist_for_each_entry(filter,
233 filter_hash_bucket(priv, src_ip, dst_ip, 232 filter_hash_bucket(priv, src_ip, dst_ip,
234 src_port, dst_port), 233 src_port, dst_port),
235 filter_chain) { 234 filter_chain) {
@@ -574,13 +573,13 @@ static void mlx4_en_put_qp(struct mlx4_en_priv *priv)
574 573
575 if (dev->caps.steering_mode != MLX4_STEERING_MODE_A0) { 574 if (dev->caps.steering_mode != MLX4_STEERING_MODE_A0) {
576 struct mlx4_mac_entry *entry; 575 struct mlx4_mac_entry *entry;
577 struct hlist_node *n, *tmp; 576 struct hlist_node *tmp;
578 struct hlist_head *bucket; 577 struct hlist_head *bucket;
579 unsigned int mac_hash; 578 unsigned int mac_hash;
580 579
581 mac_hash = priv->dev->dev_addr[MLX4_EN_MAC_HASH_IDX]; 580 mac_hash = priv->dev->dev_addr[MLX4_EN_MAC_HASH_IDX];
582 bucket = &priv->mac_hash[mac_hash]; 581 bucket = &priv->mac_hash[mac_hash];
583 hlist_for_each_entry_safe(entry, n, tmp, bucket, hlist) { 582 hlist_for_each_entry_safe(entry, tmp, bucket, hlist) {
584 if (ether_addr_equal_64bits(entry->mac, 583 if (ether_addr_equal_64bits(entry->mac,
585 priv->dev->dev_addr)) { 584 priv->dev->dev_addr)) {
586 en_dbg(DRV, priv, "Releasing qp: port %d, MAC %pM, qpn %d\n", 585 en_dbg(DRV, priv, "Releasing qp: port %d, MAC %pM, qpn %d\n",
@@ -609,11 +608,11 @@ static int mlx4_en_replace_mac(struct mlx4_en_priv *priv, int qpn,
609 struct hlist_head *bucket; 608 struct hlist_head *bucket;
610 unsigned int mac_hash; 609 unsigned int mac_hash;
611 struct mlx4_mac_entry *entry; 610 struct mlx4_mac_entry *entry;
612 struct hlist_node *n, *tmp; 611 struct hlist_node *tmp;
613 u64 prev_mac_u64 = mlx4_en_mac_to_u64(prev_mac); 612 u64 prev_mac_u64 = mlx4_en_mac_to_u64(prev_mac);
614 613
615 bucket = &priv->mac_hash[prev_mac[MLX4_EN_MAC_HASH_IDX]]; 614 bucket = &priv->mac_hash[prev_mac[MLX4_EN_MAC_HASH_IDX]];
616 hlist_for_each_entry_safe(entry, n, tmp, bucket, hlist) { 615 hlist_for_each_entry_safe(entry, tmp, bucket, hlist) {
617 if (ether_addr_equal_64bits(entry->mac, prev_mac)) { 616 if (ether_addr_equal_64bits(entry->mac, prev_mac)) {
618 mlx4_en_uc_steer_release(priv, entry->mac, 617 mlx4_en_uc_steer_release(priv, entry->mac,
619 qpn, entry->reg_id); 618 qpn, entry->reg_id);
@@ -1019,7 +1018,7 @@ static void mlx4_en_do_uc_filter(struct mlx4_en_priv *priv,
1019{ 1018{
1020 struct netdev_hw_addr *ha; 1019 struct netdev_hw_addr *ha;
1021 struct mlx4_mac_entry *entry; 1020 struct mlx4_mac_entry *entry;
1022 struct hlist_node *n, *tmp; 1021 struct hlist_node *tmp;
1023 bool found; 1022 bool found;
1024 u64 mac; 1023 u64 mac;
1025 int err = 0; 1024 int err = 0;
@@ -1035,7 +1034,7 @@ static void mlx4_en_do_uc_filter(struct mlx4_en_priv *priv,
1035 /* find what to remove */ 1034 /* find what to remove */
1036 for (i = 0; i < MLX4_EN_MAC_HASH_SIZE; ++i) { 1035 for (i = 0; i < MLX4_EN_MAC_HASH_SIZE; ++i) {
1037 bucket = &priv->mac_hash[i]; 1036 bucket = &priv->mac_hash[i];
1038 hlist_for_each_entry_safe(entry, n, tmp, bucket, hlist) { 1037 hlist_for_each_entry_safe(entry, tmp, bucket, hlist) {
1039 found = false; 1038 found = false;
1040 netdev_for_each_uc_addr(ha, dev) { 1039 netdev_for_each_uc_addr(ha, dev) {
1041 if (ether_addr_equal_64bits(entry->mac, 1040 if (ether_addr_equal_64bits(entry->mac,
@@ -1078,7 +1077,7 @@ static void mlx4_en_do_uc_filter(struct mlx4_en_priv *priv,
1078 netdev_for_each_uc_addr(ha, dev) { 1077 netdev_for_each_uc_addr(ha, dev) {
1079 found = false; 1078 found = false;
1080 bucket = &priv->mac_hash[ha->addr[MLX4_EN_MAC_HASH_IDX]]; 1079 bucket = &priv->mac_hash[ha->addr[MLX4_EN_MAC_HASH_IDX]];
1081 hlist_for_each_entry(entry, n, bucket, hlist) { 1080 hlist_for_each_entry(entry, bucket, hlist) {
1082 if (ether_addr_equal_64bits(entry->mac, ha->addr)) { 1081 if (ether_addr_equal_64bits(entry->mac, ha->addr)) {
1083 found = true; 1082 found = true;
1084 break; 1083 break;
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_rx.c b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
index ce38654bbdd0..c7f856308e1a 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_rx.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
@@ -35,6 +35,7 @@
35#include <linux/slab.h> 35#include <linux/slab.h>
36#include <linux/mlx4/qp.h> 36#include <linux/mlx4/qp.h>
37#include <linux/skbuff.h> 37#include <linux/skbuff.h>
38#include <linux/rculist.h>
38#include <linux/if_ether.h> 39#include <linux/if_ether.h>
39#include <linux/if_vlan.h> 40#include <linux/if_vlan.h>
40#include <linux/vmalloc.h> 41#include <linux/vmalloc.h>
@@ -617,7 +618,6 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int bud
617 618
618 if (is_multicast_ether_addr(ethh->h_dest)) { 619 if (is_multicast_ether_addr(ethh->h_dest)) {
619 struct mlx4_mac_entry *entry; 620 struct mlx4_mac_entry *entry;
620 struct hlist_node *n;
621 struct hlist_head *bucket; 621 struct hlist_head *bucket;
622 unsigned int mac_hash; 622 unsigned int mac_hash;
623 623
@@ -625,7 +625,7 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int bud
625 mac_hash = ethh->h_source[MLX4_EN_MAC_HASH_IDX]; 625 mac_hash = ethh->h_source[MLX4_EN_MAC_HASH_IDX];
626 bucket = &priv->mac_hash[mac_hash]; 626 bucket = &priv->mac_hash[mac_hash];
627 rcu_read_lock(); 627 rcu_read_lock();
628 hlist_for_each_entry_rcu(entry, n, bucket, hlist) { 628 hlist_for_each_entry_rcu(entry, bucket, hlist) {
629 if (ether_addr_equal_64bits(entry->mac, 629 if (ether_addr_equal_64bits(entry->mac,
630 ethh->h_source)) { 630 ethh->h_source)) {
631 rcu_read_unlock(); 631 rcu_read_unlock();
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c
index 325e11e1ce0f..f89cc7a3fe6c 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c
@@ -576,7 +576,7 @@ void qlcnic_free_mac_list(struct qlcnic_adapter *adapter)
576void qlcnic_prune_lb_filters(struct qlcnic_adapter *adapter) 576void qlcnic_prune_lb_filters(struct qlcnic_adapter *adapter)
577{ 577{
578 struct qlcnic_filter *tmp_fil; 578 struct qlcnic_filter *tmp_fil;
579 struct hlist_node *tmp_hnode, *n; 579 struct hlist_node *n;
580 struct hlist_head *head; 580 struct hlist_head *head;
581 int i; 581 int i;
582 unsigned long time; 582 unsigned long time;
@@ -584,7 +584,7 @@ void qlcnic_prune_lb_filters(struct qlcnic_adapter *adapter)
584 584
585 for (i = 0; i < adapter->fhash.fbucket_size; i++) { 585 for (i = 0; i < adapter->fhash.fbucket_size; i++) {
586 head = &(adapter->fhash.fhead[i]); 586 head = &(adapter->fhash.fhead[i]);
587 hlist_for_each_entry_safe(tmp_fil, tmp_hnode, n, head, fnode) { 587 hlist_for_each_entry_safe(tmp_fil, n, head, fnode) {
588 cmd = tmp_fil->vlan_id ? QLCNIC_MAC_VLAN_DEL : 588 cmd = tmp_fil->vlan_id ? QLCNIC_MAC_VLAN_DEL :
589 QLCNIC_MAC_DEL; 589 QLCNIC_MAC_DEL;
590 time = tmp_fil->ftime; 590 time = tmp_fil->ftime;
@@ -604,7 +604,7 @@ void qlcnic_prune_lb_filters(struct qlcnic_adapter *adapter)
604 for (i = 0; i < adapter->rx_fhash.fbucket_size; i++) { 604 for (i = 0; i < adapter->rx_fhash.fbucket_size; i++) {
605 head = &(adapter->rx_fhash.fhead[i]); 605 head = &(adapter->rx_fhash.fhead[i]);
606 606
607 hlist_for_each_entry_safe(tmp_fil, tmp_hnode, n, head, fnode) 607 hlist_for_each_entry_safe(tmp_fil, n, head, fnode)
608 { 608 {
609 time = tmp_fil->ftime; 609 time = tmp_fil->ftime;
610 if (jiffies > (QLCNIC_FILTER_AGE * HZ + time)) { 610 if (jiffies > (QLCNIC_FILTER_AGE * HZ + time)) {
@@ -621,14 +621,14 @@ void qlcnic_prune_lb_filters(struct qlcnic_adapter *adapter)
621void qlcnic_delete_lb_filters(struct qlcnic_adapter *adapter) 621void qlcnic_delete_lb_filters(struct qlcnic_adapter *adapter)
622{ 622{
623 struct qlcnic_filter *tmp_fil; 623 struct qlcnic_filter *tmp_fil;
624 struct hlist_node *tmp_hnode, *n; 624 struct hlist_node *n;
625 struct hlist_head *head; 625 struct hlist_head *head;
626 int i; 626 int i;
627 u8 cmd; 627 u8 cmd;
628 628
629 for (i = 0; i < adapter->fhash.fbucket_size; i++) { 629 for (i = 0; i < adapter->fhash.fbucket_size; i++) {
630 head = &(adapter->fhash.fhead[i]); 630 head = &(adapter->fhash.fhead[i]);
631 hlist_for_each_entry_safe(tmp_fil, tmp_hnode, n, head, fnode) { 631 hlist_for_each_entry_safe(tmp_fil, n, head, fnode) {
632 cmd = tmp_fil->vlan_id ? QLCNIC_MAC_VLAN_DEL : 632 cmd = tmp_fil->vlan_id ? QLCNIC_MAC_VLAN_DEL :
633 QLCNIC_MAC_DEL; 633 QLCNIC_MAC_DEL;
634 qlcnic_sre_macaddr_change(adapter, 634 qlcnic_sre_macaddr_change(adapter,
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c
index 6387e0cc3ea9..0e630061bff3 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c
@@ -162,7 +162,7 @@ void qlcnic_add_lb_filter(struct qlcnic_adapter *adapter, struct sk_buff *skb,
162{ 162{
163 struct ethhdr *phdr = (struct ethhdr *)(skb->data); 163 struct ethhdr *phdr = (struct ethhdr *)(skb->data);
164 struct qlcnic_filter *fil, *tmp_fil; 164 struct qlcnic_filter *fil, *tmp_fil;
165 struct hlist_node *tmp_hnode, *n; 165 struct hlist_node *n;
166 struct hlist_head *head; 166 struct hlist_head *head;
167 unsigned long time; 167 unsigned long time;
168 u64 src_addr = 0; 168 u64 src_addr = 0;
@@ -179,7 +179,7 @@ void qlcnic_add_lb_filter(struct qlcnic_adapter *adapter, struct sk_buff *skb,
179 (adapter->fhash.fbucket_size - 1); 179 (adapter->fhash.fbucket_size - 1);
180 head = &(adapter->rx_fhash.fhead[hindex]); 180 head = &(adapter->rx_fhash.fhead[hindex]);
181 181
182 hlist_for_each_entry_safe(tmp_fil, tmp_hnode, n, head, fnode) { 182 hlist_for_each_entry_safe(tmp_fil, n, head, fnode) {
183 if (!memcmp(tmp_fil->faddr, &src_addr, ETH_ALEN) && 183 if (!memcmp(tmp_fil->faddr, &src_addr, ETH_ALEN) &&
184 tmp_fil->vlan_id == vlan_id) { 184 tmp_fil->vlan_id == vlan_id) {
185 time = tmp_fil->ftime; 185 time = tmp_fil->ftime;
@@ -205,7 +205,7 @@ void qlcnic_add_lb_filter(struct qlcnic_adapter *adapter, struct sk_buff *skb,
205 (adapter->fhash.fbucket_size - 1); 205 (adapter->fhash.fbucket_size - 1);
206 head = &(adapter->rx_fhash.fhead[hindex]); 206 head = &(adapter->rx_fhash.fhead[hindex]);
207 spin_lock(&adapter->rx_mac_learn_lock); 207 spin_lock(&adapter->rx_mac_learn_lock);
208 hlist_for_each_entry_safe(tmp_fil, tmp_hnode, n, head, fnode) { 208 hlist_for_each_entry_safe(tmp_fil, n, head, fnode) {
209 if (!memcmp(tmp_fil->faddr, &src_addr, ETH_ALEN) && 209 if (!memcmp(tmp_fil->faddr, &src_addr, ETH_ALEN) &&
210 tmp_fil->vlan_id == vlan_id) { 210 tmp_fil->vlan_id == vlan_id) {
211 found = 1; 211 found = 1;
@@ -272,7 +272,7 @@ static void qlcnic_send_filter(struct qlcnic_adapter *adapter,
272 struct sk_buff *skb) 272 struct sk_buff *skb)
273{ 273{
274 struct qlcnic_filter *fil, *tmp_fil; 274 struct qlcnic_filter *fil, *tmp_fil;
275 struct hlist_node *tmp_hnode, *n; 275 struct hlist_node *n;
276 struct hlist_head *head; 276 struct hlist_head *head;
277 struct net_device *netdev = adapter->netdev; 277 struct net_device *netdev = adapter->netdev;
278 struct ethhdr *phdr = (struct ethhdr *)(skb->data); 278 struct ethhdr *phdr = (struct ethhdr *)(skb->data);
@@ -294,7 +294,7 @@ static void qlcnic_send_filter(struct qlcnic_adapter *adapter,
294 hindex = qlcnic_mac_hash(src_addr) & (adapter->fhash.fbucket_size - 1); 294 hindex = qlcnic_mac_hash(src_addr) & (adapter->fhash.fbucket_size - 1);
295 head = &(adapter->fhash.fhead[hindex]); 295 head = &(adapter->fhash.fhead[hindex]);
296 296
297 hlist_for_each_entry_safe(tmp_fil, tmp_hnode, n, head, fnode) { 297 hlist_for_each_entry_safe(tmp_fil, n, head, fnode) {
298 if (!memcmp(tmp_fil->faddr, &src_addr, ETH_ALEN) && 298 if (!memcmp(tmp_fil->faddr, &src_addr, ETH_ALEN) &&
299 tmp_fil->vlan_id == vlan_id) { 299 tmp_fil->vlan_id == vlan_id) {
300 if (jiffies > (QLCNIC_READD_AGE * HZ + tmp_fil->ftime)) 300 if (jiffies > (QLCNIC_READD_AGE * HZ + tmp_fil->ftime))
diff --git a/drivers/net/ethernet/sun/sunvnet.c b/drivers/net/ethernet/sun/sunvnet.c
index 289b4eefb42f..1df0ff3839e8 100644
--- a/drivers/net/ethernet/sun/sunvnet.c
+++ b/drivers/net/ethernet/sun/sunvnet.c
@@ -614,10 +614,9 @@ struct vnet_port *__tx_port_find(struct vnet *vp, struct sk_buff *skb)
614{ 614{
615 unsigned int hash = vnet_hashfn(skb->data); 615 unsigned int hash = vnet_hashfn(skb->data);
616 struct hlist_head *hp = &vp->port_hash[hash]; 616 struct hlist_head *hp = &vp->port_hash[hash];
617 struct hlist_node *n;
618 struct vnet_port *port; 617 struct vnet_port *port;
619 618
620 hlist_for_each_entry(port, n, hp, hash) { 619 hlist_for_each_entry(port, hp, hash) {
621 if (ether_addr_equal(port->raddr, skb->data)) 620 if (ether_addr_equal(port->raddr, skb->data))
622 return port; 621 return port;
623 } 622 }
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index defcd8a85744..417b2af1aa80 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -55,9 +55,8 @@ static struct macvlan_dev *macvlan_hash_lookup(const struct macvlan_port *port,
55 const unsigned char *addr) 55 const unsigned char *addr)
56{ 56{
57 struct macvlan_dev *vlan; 57 struct macvlan_dev *vlan;
58 struct hlist_node *n;
59 58
60 hlist_for_each_entry_rcu(vlan, n, &port->vlan_hash[addr[5]], hlist) { 59 hlist_for_each_entry_rcu(vlan, &port->vlan_hash[addr[5]], hlist) {
61 if (ether_addr_equal_64bits(vlan->dev->dev_addr, addr)) 60 if (ether_addr_equal_64bits(vlan->dev->dev_addr, addr))
62 return vlan; 61 return vlan;
63 } 62 }
@@ -149,7 +148,6 @@ static void macvlan_broadcast(struct sk_buff *skb,
149{ 148{
150 const struct ethhdr *eth = eth_hdr(skb); 149 const struct ethhdr *eth = eth_hdr(skb);
151 const struct macvlan_dev *vlan; 150 const struct macvlan_dev *vlan;
152 struct hlist_node *n;
153 struct sk_buff *nskb; 151 struct sk_buff *nskb;
154 unsigned int i; 152 unsigned int i;
155 int err; 153 int err;
@@ -159,7 +157,7 @@ static void macvlan_broadcast(struct sk_buff *skb,
159 return; 157 return;
160 158
161 for (i = 0; i < MACVLAN_HASH_SIZE; i++) { 159 for (i = 0; i < MACVLAN_HASH_SIZE; i++) {
162 hlist_for_each_entry_rcu(vlan, n, &port->vlan_hash[i], hlist) { 160 hlist_for_each_entry_rcu(vlan, &port->vlan_hash[i], hlist) {
163 if (vlan->dev == src || !(vlan->mode & mode)) 161 if (vlan->dev == src || !(vlan->mode & mode))
164 continue; 162 continue;
165 163
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index b6f45c5d84d5..2c6a22e278ea 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -197,9 +197,8 @@ static inline u32 tun_hashfn(u32 rxhash)
197static struct tun_flow_entry *tun_flow_find(struct hlist_head *head, u32 rxhash) 197static struct tun_flow_entry *tun_flow_find(struct hlist_head *head, u32 rxhash)
198{ 198{
199 struct tun_flow_entry *e; 199 struct tun_flow_entry *e;
200 struct hlist_node *n;
201 200
202 hlist_for_each_entry_rcu(e, n, head, hash_link) { 201 hlist_for_each_entry_rcu(e, head, hash_link) {
203 if (e->rxhash == rxhash) 202 if (e->rxhash == rxhash)
204 return e; 203 return e;
205 } 204 }
@@ -241,9 +240,9 @@ static void tun_flow_flush(struct tun_struct *tun)
241 spin_lock_bh(&tun->lock); 240 spin_lock_bh(&tun->lock);
242 for (i = 0; i < TUN_NUM_FLOW_ENTRIES; i++) { 241 for (i = 0; i < TUN_NUM_FLOW_ENTRIES; i++) {
243 struct tun_flow_entry *e; 242 struct tun_flow_entry *e;
244 struct hlist_node *h, *n; 243 struct hlist_node *n;
245 244
246 hlist_for_each_entry_safe(e, h, n, &tun->flows[i], hash_link) 245 hlist_for_each_entry_safe(e, n, &tun->flows[i], hash_link)
247 tun_flow_delete(tun, e); 246 tun_flow_delete(tun, e);
248 } 247 }
249 spin_unlock_bh(&tun->lock); 248 spin_unlock_bh(&tun->lock);
@@ -256,9 +255,9 @@ static void tun_flow_delete_by_queue(struct tun_struct *tun, u16 queue_index)
256 spin_lock_bh(&tun->lock); 255 spin_lock_bh(&tun->lock);
257 for (i = 0; i < TUN_NUM_FLOW_ENTRIES; i++) { 256 for (i = 0; i < TUN_NUM_FLOW_ENTRIES; i++) {
258 struct tun_flow_entry *e; 257 struct tun_flow_entry *e;
259 struct hlist_node *h, *n; 258 struct hlist_node *n;
260 259
261 hlist_for_each_entry_safe(e, h, n, &tun->flows[i], hash_link) { 260 hlist_for_each_entry_safe(e, n, &tun->flows[i], hash_link) {
262 if (e->queue_index == queue_index) 261 if (e->queue_index == queue_index)
263 tun_flow_delete(tun, e); 262 tun_flow_delete(tun, e);
264 } 263 }
@@ -279,9 +278,9 @@ static void tun_flow_cleanup(unsigned long data)
279 spin_lock_bh(&tun->lock); 278 spin_lock_bh(&tun->lock);
280 for (i = 0; i < TUN_NUM_FLOW_ENTRIES; i++) { 279 for (i = 0; i < TUN_NUM_FLOW_ENTRIES; i++) {
281 struct tun_flow_entry *e; 280 struct tun_flow_entry *e;
282 struct hlist_node *h, *n; 281 struct hlist_node *n;
283 282
284 hlist_for_each_entry_safe(e, h, n, &tun->flows[i], hash_link) { 283 hlist_for_each_entry_safe(e, n, &tun->flows[i], hash_link) {
285 unsigned long this_timer; 284 unsigned long this_timer;
286 count++; 285 count++;
287 this_timer = e->updated + delay; 286 this_timer = e->updated + delay;
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index f736823f8437..f10e58ac9c1b 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -145,9 +145,8 @@ static inline struct hlist_head *vni_head(struct net *net, u32 id)
145static struct vxlan_dev *vxlan_find_vni(struct net *net, u32 id) 145static struct vxlan_dev *vxlan_find_vni(struct net *net, u32 id)
146{ 146{
147 struct vxlan_dev *vxlan; 147 struct vxlan_dev *vxlan;
148 struct hlist_node *node;
149 148
150 hlist_for_each_entry_rcu(vxlan, node, vni_head(net, id), hlist) { 149 hlist_for_each_entry_rcu(vxlan, vni_head(net, id), hlist) {
151 if (vxlan->vni == id) 150 if (vxlan->vni == id)
152 return vxlan; 151 return vxlan;
153 } 152 }
@@ -292,9 +291,8 @@ static struct vxlan_fdb *vxlan_find_mac(struct vxlan_dev *vxlan,
292{ 291{
293 struct hlist_head *head = vxlan_fdb_head(vxlan, mac); 292 struct hlist_head *head = vxlan_fdb_head(vxlan, mac);
294 struct vxlan_fdb *f; 293 struct vxlan_fdb *f;
295 struct hlist_node *node;
296 294
297 hlist_for_each_entry_rcu(f, node, head, hlist) { 295 hlist_for_each_entry_rcu(f, head, hlist) {
298 if (compare_ether_addr(mac, f->eth_addr) == 0) 296 if (compare_ether_addr(mac, f->eth_addr) == 0)
299 return f; 297 return f;
300 } 298 }
@@ -422,10 +420,9 @@ static int vxlan_fdb_dump(struct sk_buff *skb, struct netlink_callback *cb,
422 420
423 for (h = 0; h < FDB_HASH_SIZE; ++h) { 421 for (h = 0; h < FDB_HASH_SIZE; ++h) {
424 struct vxlan_fdb *f; 422 struct vxlan_fdb *f;
425 struct hlist_node *n;
426 int err; 423 int err;
427 424
428 hlist_for_each_entry_rcu(f, n, &vxlan->fdb_head[h], hlist) { 425 hlist_for_each_entry_rcu(f, &vxlan->fdb_head[h], hlist) {
429 if (idx < cb->args[0]) 426 if (idx < cb->args[0])
430 goto skip; 427 goto skip;
431 428
@@ -483,11 +480,10 @@ static bool vxlan_group_used(struct vxlan_net *vn,
483 const struct vxlan_dev *this) 480 const struct vxlan_dev *this)
484{ 481{
485 const struct vxlan_dev *vxlan; 482 const struct vxlan_dev *vxlan;
486 struct hlist_node *node;
487 unsigned h; 483 unsigned h;
488 484
489 for (h = 0; h < VNI_HASH_SIZE; ++h) 485 for (h = 0; h < VNI_HASH_SIZE; ++h)
490 hlist_for_each_entry(vxlan, node, &vn->vni_list[h], hlist) { 486 hlist_for_each_entry(vxlan, &vn->vni_list[h], hlist) {
491 if (vxlan == this) 487 if (vxlan == this)
492 continue; 488 continue;
493 489
diff --git a/drivers/net/wireless/zd1201.c b/drivers/net/wireless/zd1201.c
index 48273dd05b63..4941f201d6c8 100644
--- a/drivers/net/wireless/zd1201.c
+++ b/drivers/net/wireless/zd1201.c
@@ -309,7 +309,6 @@ static void zd1201_usbrx(struct urb *urb)
309 if (data[urb->actual_length-1] == ZD1201_PACKET_RXDATA) { 309 if (data[urb->actual_length-1] == ZD1201_PACKET_RXDATA) {
310 int datalen = urb->actual_length-1; 310 int datalen = urb->actual_length-1;
311 unsigned short len, fc, seq; 311 unsigned short len, fc, seq;
312 struct hlist_node *node;
313 312
314 len = ntohs(*(__be16 *)&data[datalen-2]); 313 len = ntohs(*(__be16 *)&data[datalen-2]);
315 if (len>datalen) 314 if (len>datalen)
@@ -362,7 +361,7 @@ static void zd1201_usbrx(struct urb *urb)
362 hlist_add_head(&frag->fnode, &zd->fraglist); 361 hlist_add_head(&frag->fnode, &zd->fraglist);
363 goto resubmit; 362 goto resubmit;
364 } 363 }
365 hlist_for_each_entry(frag, node, &zd->fraglist, fnode) 364 hlist_for_each_entry(frag, &zd->fraglist, fnode)
366 if (frag->seq == (seq&IEEE80211_SCTL_SEQ)) 365 if (frag->seq == (seq&IEEE80211_SCTL_SEQ))
367 break; 366 break;
368 if (!frag) 367 if (!frag)
@@ -1831,14 +1830,14 @@ err_zd:
1831static void zd1201_disconnect(struct usb_interface *interface) 1830static void zd1201_disconnect(struct usb_interface *interface)
1832{ 1831{
1833 struct zd1201 *zd = usb_get_intfdata(interface); 1832 struct zd1201 *zd = usb_get_intfdata(interface);
1834 struct hlist_node *node, *node2; 1833 struct hlist_node *node2;
1835 struct zd1201_frag *frag; 1834 struct zd1201_frag *frag;
1836 1835
1837 if (!zd) 1836 if (!zd)
1838 return; 1837 return;
1839 usb_set_intfdata(interface, NULL); 1838 usb_set_intfdata(interface, NULL);
1840 1839
1841 hlist_for_each_entry_safe(frag, node, node2, &zd->fraglist, fnode) { 1840 hlist_for_each_entry_safe(frag, node2, &zd->fraglist, fnode) {
1842 hlist_del_init(&frag->fnode); 1841 hlist_del_init(&frag->fnode);
1843 kfree_skb(frag->skb); 1842 kfree_skb(frag->skb);
1844 kfree(frag); 1843 kfree(frag);