aboutsummaryrefslogtreecommitdiffstats
path: root/net/batman-adv/translation-table.c
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 /net/batman-adv/translation-table.c
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 'net/batman-adv/translation-table.c')
-rw-r--r--net/batman-adv/translation-table.c82
1 files changed, 35 insertions, 47 deletions
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
index d44672f4a349..98a66a021a60 100644
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@ -56,7 +56,6 @@ static struct batadv_tt_common_entry *
56batadv_tt_hash_find(struct batadv_hashtable *hash, const void *data) 56batadv_tt_hash_find(struct batadv_hashtable *hash, const void *data)
57{ 57{
58 struct hlist_head *head; 58 struct hlist_head *head;
59 struct hlist_node *node;
60 struct batadv_tt_common_entry *tt_common_entry; 59 struct batadv_tt_common_entry *tt_common_entry;
61 struct batadv_tt_common_entry *tt_common_entry_tmp = NULL; 60 struct batadv_tt_common_entry *tt_common_entry_tmp = NULL;
62 uint32_t index; 61 uint32_t index;
@@ -68,7 +67,7 @@ batadv_tt_hash_find(struct batadv_hashtable *hash, const void *data)
68 head = &hash->table[index]; 67 head = &hash->table[index];
69 68
70 rcu_read_lock(); 69 rcu_read_lock();
71 hlist_for_each_entry_rcu(tt_common_entry, node, head, hash_entry) { 70 hlist_for_each_entry_rcu(tt_common_entry, head, hash_entry) {
72 if (!batadv_compare_eth(tt_common_entry, data)) 71 if (!batadv_compare_eth(tt_common_entry, data))
73 continue; 72 continue;
74 73
@@ -257,7 +256,6 @@ void batadv_tt_local_add(struct net_device *soft_iface, const uint8_t *addr,
257 struct batadv_tt_local_entry *tt_local; 256 struct batadv_tt_local_entry *tt_local;
258 struct batadv_tt_global_entry *tt_global; 257 struct batadv_tt_global_entry *tt_global;
259 struct hlist_head *head; 258 struct hlist_head *head;
260 struct hlist_node *node;
261 struct batadv_tt_orig_list_entry *orig_entry; 259 struct batadv_tt_orig_list_entry *orig_entry;
262 int hash_added; 260 int hash_added;
263 bool roamed_back = false; 261 bool roamed_back = false;
@@ -339,7 +337,7 @@ check_roaming:
339 /* These node are probably going to update their tt table */ 337 /* These node are probably going to update their tt table */
340 head = &tt_global->orig_list; 338 head = &tt_global->orig_list;
341 rcu_read_lock(); 339 rcu_read_lock();
342 hlist_for_each_entry_rcu(orig_entry, node, head, list) { 340 hlist_for_each_entry_rcu(orig_entry, head, list) {
343 batadv_send_roam_adv(bat_priv, tt_global->common.addr, 341 batadv_send_roam_adv(bat_priv, tt_global->common.addr,
344 orig_entry->orig_node); 342 orig_entry->orig_node);
345 } 343 }
@@ -470,7 +468,6 @@ int batadv_tt_local_seq_print_text(struct seq_file *seq, void *offset)
470 struct batadv_tt_common_entry *tt_common_entry; 468 struct batadv_tt_common_entry *tt_common_entry;
471 struct batadv_tt_local_entry *tt_local; 469 struct batadv_tt_local_entry *tt_local;
472 struct batadv_hard_iface *primary_if; 470 struct batadv_hard_iface *primary_if;
473 struct hlist_node *node;
474 struct hlist_head *head; 471 struct hlist_head *head;
475 uint32_t i; 472 uint32_t i;
476 int last_seen_secs; 473 int last_seen_secs;
@@ -494,7 +491,7 @@ int batadv_tt_local_seq_print_text(struct seq_file *seq, void *offset)
494 head = &hash->table[i]; 491 head = &hash->table[i];
495 492
496 rcu_read_lock(); 493 rcu_read_lock();
497 hlist_for_each_entry_rcu(tt_common_entry, node, 494 hlist_for_each_entry_rcu(tt_common_entry,
498 head, hash_entry) { 495 head, hash_entry) {
499 tt_local = container_of(tt_common_entry, 496 tt_local = container_of(tt_common_entry,
500 struct batadv_tt_local_entry, 497 struct batadv_tt_local_entry,
@@ -605,9 +602,9 @@ static void batadv_tt_local_purge_list(struct batadv_priv *bat_priv,
605{ 602{
606 struct batadv_tt_local_entry *tt_local_entry; 603 struct batadv_tt_local_entry *tt_local_entry;
607 struct batadv_tt_common_entry *tt_common_entry; 604 struct batadv_tt_common_entry *tt_common_entry;
608 struct hlist_node *node, *node_tmp; 605 struct hlist_node *node_tmp;
609 606
610 hlist_for_each_entry_safe(tt_common_entry, node, node_tmp, head, 607 hlist_for_each_entry_safe(tt_common_entry, node_tmp, head,
611 hash_entry) { 608 hash_entry) {
612 tt_local_entry = container_of(tt_common_entry, 609 tt_local_entry = container_of(tt_common_entry,
613 struct batadv_tt_local_entry, 610 struct batadv_tt_local_entry,
@@ -651,7 +648,7 @@ static void batadv_tt_local_table_free(struct batadv_priv *bat_priv)
651 spinlock_t *list_lock; /* protects write access to the hash lists */ 648 spinlock_t *list_lock; /* protects write access to the hash lists */
652 struct batadv_tt_common_entry *tt_common_entry; 649 struct batadv_tt_common_entry *tt_common_entry;
653 struct batadv_tt_local_entry *tt_local; 650 struct batadv_tt_local_entry *tt_local;
654 struct hlist_node *node, *node_tmp; 651 struct hlist_node *node_tmp;
655 struct hlist_head *head; 652 struct hlist_head *head;
656 uint32_t i; 653 uint32_t i;
657 654
@@ -665,9 +662,9 @@ static void batadv_tt_local_table_free(struct batadv_priv *bat_priv)
665 list_lock = &hash->list_locks[i]; 662 list_lock = &hash->list_locks[i];
666 663
667 spin_lock_bh(list_lock); 664 spin_lock_bh(list_lock);
668 hlist_for_each_entry_safe(tt_common_entry, node, node_tmp, 665 hlist_for_each_entry_safe(tt_common_entry, node_tmp,
669 head, hash_entry) { 666 head, hash_entry) {
670 hlist_del_rcu(node); 667 hlist_del_rcu(&tt_common_entry->hash_entry);
671 tt_local = container_of(tt_common_entry, 668 tt_local = container_of(tt_common_entry,
672 struct batadv_tt_local_entry, 669 struct batadv_tt_local_entry,
673 common); 670 common);
@@ -724,11 +721,10 @@ batadv_tt_global_orig_entry_find(const struct batadv_tt_global_entry *entry,
724{ 721{
725 struct batadv_tt_orig_list_entry *tmp_orig_entry, *orig_entry = NULL; 722 struct batadv_tt_orig_list_entry *tmp_orig_entry, *orig_entry = NULL;
726 const struct hlist_head *head; 723 const struct hlist_head *head;
727 struct hlist_node *node;
728 724
729 rcu_read_lock(); 725 rcu_read_lock();
730 head = &entry->orig_list; 726 head = &entry->orig_list;
731 hlist_for_each_entry_rcu(tmp_orig_entry, node, head, list) { 727 hlist_for_each_entry_rcu(tmp_orig_entry, head, list) {
732 if (tmp_orig_entry->orig_node != orig_node) 728 if (tmp_orig_entry->orig_node != orig_node)
733 continue; 729 continue;
734 if (!atomic_inc_not_zero(&tmp_orig_entry->refcount)) 730 if (!atomic_inc_not_zero(&tmp_orig_entry->refcount))
@@ -940,12 +936,11 @@ batadv_transtable_best_orig(struct batadv_tt_global_entry *tt_global_entry)
940{ 936{
941 struct batadv_neigh_node *router = NULL; 937 struct batadv_neigh_node *router = NULL;
942 struct hlist_head *head; 938 struct hlist_head *head;
943 struct hlist_node *node;
944 struct batadv_tt_orig_list_entry *orig_entry, *best_entry = NULL; 939 struct batadv_tt_orig_list_entry *orig_entry, *best_entry = NULL;
945 int best_tq = 0; 940 int best_tq = 0;
946 941
947 head = &tt_global_entry->orig_list; 942 head = &tt_global_entry->orig_list;
948 hlist_for_each_entry_rcu(orig_entry, node, head, list) { 943 hlist_for_each_entry_rcu(orig_entry, head, list) {
949 router = batadv_orig_node_get_router(orig_entry->orig_node); 944 router = batadv_orig_node_get_router(orig_entry->orig_node);
950 if (!router) 945 if (!router)
951 continue; 946 continue;
@@ -973,7 +968,6 @@ batadv_tt_global_print_entry(struct batadv_tt_global_entry *tt_global_entry,
973 struct seq_file *seq) 968 struct seq_file *seq)
974{ 969{
975 struct hlist_head *head; 970 struct hlist_head *head;
976 struct hlist_node *node;
977 struct batadv_tt_orig_list_entry *orig_entry, *best_entry; 971 struct batadv_tt_orig_list_entry *orig_entry, *best_entry;
978 struct batadv_tt_common_entry *tt_common_entry; 972 struct batadv_tt_common_entry *tt_common_entry;
979 uint16_t flags; 973 uint16_t flags;
@@ -997,7 +991,7 @@ batadv_tt_global_print_entry(struct batadv_tt_global_entry *tt_global_entry,
997 991
998 head = &tt_global_entry->orig_list; 992 head = &tt_global_entry->orig_list;
999 993
1000 hlist_for_each_entry_rcu(orig_entry, node, head, list) { 994 hlist_for_each_entry_rcu(orig_entry, head, list) {
1001 if (best_entry == orig_entry) 995 if (best_entry == orig_entry)
1002 continue; 996 continue;
1003 997
@@ -1020,7 +1014,6 @@ int batadv_tt_global_seq_print_text(struct seq_file *seq, void *offset)
1020 struct batadv_tt_common_entry *tt_common_entry; 1014 struct batadv_tt_common_entry *tt_common_entry;
1021 struct batadv_tt_global_entry *tt_global; 1015 struct batadv_tt_global_entry *tt_global;
1022 struct batadv_hard_iface *primary_if; 1016 struct batadv_hard_iface *primary_if;
1023 struct hlist_node *node;
1024 struct hlist_head *head; 1017 struct hlist_head *head;
1025 uint32_t i; 1018 uint32_t i;
1026 1019
@@ -1039,7 +1032,7 @@ int batadv_tt_global_seq_print_text(struct seq_file *seq, void *offset)
1039 head = &hash->table[i]; 1032 head = &hash->table[i];
1040 1033
1041 rcu_read_lock(); 1034 rcu_read_lock();
1042 hlist_for_each_entry_rcu(tt_common_entry, node, 1035 hlist_for_each_entry_rcu(tt_common_entry,
1043 head, hash_entry) { 1036 head, hash_entry) {
1044 tt_global = container_of(tt_common_entry, 1037 tt_global = container_of(tt_common_entry,
1045 struct batadv_tt_global_entry, 1038 struct batadv_tt_global_entry,
@@ -1059,13 +1052,13 @@ static void
1059batadv_tt_global_del_orig_list(struct batadv_tt_global_entry *tt_global_entry) 1052batadv_tt_global_del_orig_list(struct batadv_tt_global_entry *tt_global_entry)
1060{ 1053{
1061 struct hlist_head *head; 1054 struct hlist_head *head;
1062 struct hlist_node *node, *safe; 1055 struct hlist_node *safe;
1063 struct batadv_tt_orig_list_entry *orig_entry; 1056 struct batadv_tt_orig_list_entry *orig_entry;
1064 1057
1065 spin_lock_bh(&tt_global_entry->list_lock); 1058 spin_lock_bh(&tt_global_entry->list_lock);
1066 head = &tt_global_entry->orig_list; 1059 head = &tt_global_entry->orig_list;
1067 hlist_for_each_entry_safe(orig_entry, node, safe, head, list) { 1060 hlist_for_each_entry_safe(orig_entry, safe, head, list) {
1068 hlist_del_rcu(node); 1061 hlist_del_rcu(&orig_entry->list);
1069 batadv_tt_orig_list_entry_free_ref(orig_entry); 1062 batadv_tt_orig_list_entry_free_ref(orig_entry);
1070 } 1063 }
1071 spin_unlock_bh(&tt_global_entry->list_lock); 1064 spin_unlock_bh(&tt_global_entry->list_lock);
@@ -1078,18 +1071,18 @@ batadv_tt_global_del_orig_entry(struct batadv_priv *bat_priv,
1078 const char *message) 1071 const char *message)
1079{ 1072{
1080 struct hlist_head *head; 1073 struct hlist_head *head;
1081 struct hlist_node *node, *safe; 1074 struct hlist_node *safe;
1082 struct batadv_tt_orig_list_entry *orig_entry; 1075 struct batadv_tt_orig_list_entry *orig_entry;
1083 1076
1084 spin_lock_bh(&tt_global_entry->list_lock); 1077 spin_lock_bh(&tt_global_entry->list_lock);
1085 head = &tt_global_entry->orig_list; 1078 head = &tt_global_entry->orig_list;
1086 hlist_for_each_entry_safe(orig_entry, node, safe, head, list) { 1079 hlist_for_each_entry_safe(orig_entry, safe, head, list) {
1087 if (orig_entry->orig_node == orig_node) { 1080 if (orig_entry->orig_node == orig_node) {
1088 batadv_dbg(BATADV_DBG_TT, bat_priv, 1081 batadv_dbg(BATADV_DBG_TT, bat_priv,
1089 "Deleting %pM from global tt entry %pM: %s\n", 1082 "Deleting %pM from global tt entry %pM: %s\n",
1090 orig_node->orig, 1083 orig_node->orig,
1091 tt_global_entry->common.addr, message); 1084 tt_global_entry->common.addr, message);
1092 hlist_del_rcu(node); 1085 hlist_del_rcu(&orig_entry->list);
1093 batadv_tt_orig_list_entry_free_ref(orig_entry); 1086 batadv_tt_orig_list_entry_free_ref(orig_entry);
1094 } 1087 }
1095 } 1088 }
@@ -1108,7 +1101,6 @@ batadv_tt_global_del_roaming(struct batadv_priv *bat_priv,
1108{ 1101{
1109 bool last_entry = true; 1102 bool last_entry = true;
1110 struct hlist_head *head; 1103 struct hlist_head *head;
1111 struct hlist_node *node;
1112 struct batadv_tt_orig_list_entry *orig_entry; 1104 struct batadv_tt_orig_list_entry *orig_entry;
1113 1105
1114 /* no local entry exists, case 1: 1106 /* no local entry exists, case 1:
@@ -1117,7 +1109,7 @@ batadv_tt_global_del_roaming(struct batadv_priv *bat_priv,
1117 1109
1118 rcu_read_lock(); 1110 rcu_read_lock();
1119 head = &tt_global_entry->orig_list; 1111 head = &tt_global_entry->orig_list;
1120 hlist_for_each_entry_rcu(orig_entry, node, head, list) { 1112 hlist_for_each_entry_rcu(orig_entry, head, list) {
1121 if (orig_entry->orig_node != orig_node) { 1113 if (orig_entry->orig_node != orig_node) {
1122 last_entry = false; 1114 last_entry = false;
1123 break; 1115 break;
@@ -1202,7 +1194,7 @@ void batadv_tt_global_del_orig(struct batadv_priv *bat_priv,
1202 struct batadv_tt_common_entry *tt_common_entry; 1194 struct batadv_tt_common_entry *tt_common_entry;
1203 uint32_t i; 1195 uint32_t i;
1204 struct batadv_hashtable *hash = bat_priv->tt.global_hash; 1196 struct batadv_hashtable *hash = bat_priv->tt.global_hash;
1205 struct hlist_node *node, *safe; 1197 struct hlist_node *safe;
1206 struct hlist_head *head; 1198 struct hlist_head *head;
1207 spinlock_t *list_lock; /* protects write access to the hash lists */ 1199 spinlock_t *list_lock; /* protects write access to the hash lists */
1208 1200
@@ -1214,7 +1206,7 @@ void batadv_tt_global_del_orig(struct batadv_priv *bat_priv,
1214 list_lock = &hash->list_locks[i]; 1206 list_lock = &hash->list_locks[i];
1215 1207
1216 spin_lock_bh(list_lock); 1208 spin_lock_bh(list_lock);
1217 hlist_for_each_entry_safe(tt_common_entry, node, safe, 1209 hlist_for_each_entry_safe(tt_common_entry, safe,
1218 head, hash_entry) { 1210 head, hash_entry) {
1219 tt_global = container_of(tt_common_entry, 1211 tt_global = container_of(tt_common_entry,
1220 struct batadv_tt_global_entry, 1212 struct batadv_tt_global_entry,
@@ -1227,7 +1219,7 @@ void batadv_tt_global_del_orig(struct batadv_priv *bat_priv,
1227 batadv_dbg(BATADV_DBG_TT, bat_priv, 1219 batadv_dbg(BATADV_DBG_TT, bat_priv,
1228 "Deleting global tt entry %pM: %s\n", 1220 "Deleting global tt entry %pM: %s\n",
1229 tt_global->common.addr, message); 1221 tt_global->common.addr, message);
1230 hlist_del_rcu(node); 1222 hlist_del_rcu(&tt_common_entry->hash_entry);
1231 batadv_tt_global_entry_free_ref(tt_global); 1223 batadv_tt_global_entry_free_ref(tt_global);
1232 } 1224 }
1233 } 1225 }
@@ -1262,7 +1254,7 @@ static void batadv_tt_global_purge(struct batadv_priv *bat_priv)
1262{ 1254{
1263 struct batadv_hashtable *hash = bat_priv->tt.global_hash; 1255 struct batadv_hashtable *hash = bat_priv->tt.global_hash;
1264 struct hlist_head *head; 1256 struct hlist_head *head;
1265 struct hlist_node *node, *node_tmp; 1257 struct hlist_node *node_tmp;
1266 spinlock_t *list_lock; /* protects write access to the hash lists */ 1258 spinlock_t *list_lock; /* protects write access to the hash lists */
1267 uint32_t i; 1259 uint32_t i;
1268 char *msg = NULL; 1260 char *msg = NULL;
@@ -1274,7 +1266,7 @@ static void batadv_tt_global_purge(struct batadv_priv *bat_priv)
1274 list_lock = &hash->list_locks[i]; 1266 list_lock = &hash->list_locks[i];
1275 1267
1276 spin_lock_bh(list_lock); 1268 spin_lock_bh(list_lock);
1277 hlist_for_each_entry_safe(tt_common, node, node_tmp, head, 1269 hlist_for_each_entry_safe(tt_common, node_tmp, head,
1278 hash_entry) { 1270 hash_entry) {
1279 tt_global = container_of(tt_common, 1271 tt_global = container_of(tt_common,
1280 struct batadv_tt_global_entry, 1272 struct batadv_tt_global_entry,
@@ -1287,7 +1279,7 @@ static void batadv_tt_global_purge(struct batadv_priv *bat_priv)
1287 "Deleting global tt entry (%pM): %s\n", 1279 "Deleting global tt entry (%pM): %s\n",
1288 tt_global->common.addr, msg); 1280 tt_global->common.addr, msg);
1289 1281
1290 hlist_del_rcu(node); 1282 hlist_del_rcu(&tt_common->hash_entry);
1291 1283
1292 batadv_tt_global_entry_free_ref(tt_global); 1284 batadv_tt_global_entry_free_ref(tt_global);
1293 } 1285 }
@@ -1301,7 +1293,7 @@ static void batadv_tt_global_table_free(struct batadv_priv *bat_priv)
1301 spinlock_t *list_lock; /* protects write access to the hash lists */ 1293 spinlock_t *list_lock; /* protects write access to the hash lists */
1302 struct batadv_tt_common_entry *tt_common_entry; 1294 struct batadv_tt_common_entry *tt_common_entry;
1303 struct batadv_tt_global_entry *tt_global; 1295 struct batadv_tt_global_entry *tt_global;
1304 struct hlist_node *node, *node_tmp; 1296 struct hlist_node *node_tmp;
1305 struct hlist_head *head; 1297 struct hlist_head *head;
1306 uint32_t i; 1298 uint32_t i;
1307 1299
@@ -1315,9 +1307,9 @@ static void batadv_tt_global_table_free(struct batadv_priv *bat_priv)
1315 list_lock = &hash->list_locks[i]; 1307 list_lock = &hash->list_locks[i];
1316 1308
1317 spin_lock_bh(list_lock); 1309 spin_lock_bh(list_lock);
1318 hlist_for_each_entry_safe(tt_common_entry, node, node_tmp, 1310 hlist_for_each_entry_safe(tt_common_entry, node_tmp,
1319 head, hash_entry) { 1311 head, hash_entry) {
1320 hlist_del_rcu(node); 1312 hlist_del_rcu(&tt_common_entry->hash_entry);
1321 tt_global = container_of(tt_common_entry, 1313 tt_global = container_of(tt_common_entry,
1322 struct batadv_tt_global_entry, 1314 struct batadv_tt_global_entry,
1323 common); 1315 common);
@@ -1397,7 +1389,6 @@ static uint16_t batadv_tt_global_crc(struct batadv_priv *bat_priv,
1397 struct batadv_hashtable *hash = bat_priv->tt.global_hash; 1389 struct batadv_hashtable *hash = bat_priv->tt.global_hash;
1398 struct batadv_tt_common_entry *tt_common; 1390 struct batadv_tt_common_entry *tt_common;
1399 struct batadv_tt_global_entry *tt_global; 1391 struct batadv_tt_global_entry *tt_global;
1400 struct hlist_node *node;
1401 struct hlist_head *head; 1392 struct hlist_head *head;
1402 uint32_t i; 1393 uint32_t i;
1403 int j; 1394 int j;
@@ -1406,7 +1397,7 @@ static uint16_t batadv_tt_global_crc(struct batadv_priv *bat_priv,
1406 head = &hash->table[i]; 1397 head = &hash->table[i];
1407 1398
1408 rcu_read_lock(); 1399 rcu_read_lock();
1409 hlist_for_each_entry_rcu(tt_common, node, head, hash_entry) { 1400 hlist_for_each_entry_rcu(tt_common, head, hash_entry) {
1410 tt_global = container_of(tt_common, 1401 tt_global = container_of(tt_common,
1411 struct batadv_tt_global_entry, 1402 struct batadv_tt_global_entry,
1412 common); 1403 common);
@@ -1449,7 +1440,6 @@ static uint16_t batadv_tt_local_crc(struct batadv_priv *bat_priv)
1449 uint16_t total = 0, total_one; 1440 uint16_t total = 0, total_one;
1450 struct batadv_hashtable *hash = bat_priv->tt.local_hash; 1441 struct batadv_hashtable *hash = bat_priv->tt.local_hash;
1451 struct batadv_tt_common_entry *tt_common; 1442 struct batadv_tt_common_entry *tt_common;
1452 struct hlist_node *node;
1453 struct hlist_head *head; 1443 struct hlist_head *head;
1454 uint32_t i; 1444 uint32_t i;
1455 int j; 1445 int j;
@@ -1458,7 +1448,7 @@ static uint16_t batadv_tt_local_crc(struct batadv_priv *bat_priv)
1458 head = &hash->table[i]; 1448 head = &hash->table[i];
1459 1449
1460 rcu_read_lock(); 1450 rcu_read_lock();
1461 hlist_for_each_entry_rcu(tt_common, node, head, hash_entry) { 1451 hlist_for_each_entry_rcu(tt_common, head, hash_entry) {
1462 /* not yet committed clients have not to be taken into 1452 /* not yet committed clients have not to be taken into
1463 * account while computing the CRC 1453 * account while computing the CRC
1464 */ 1454 */
@@ -1597,7 +1587,6 @@ batadv_tt_response_fill_table(uint16_t tt_len, uint8_t ttvn,
1597 struct batadv_tt_common_entry *tt_common_entry; 1587 struct batadv_tt_common_entry *tt_common_entry;
1598 struct batadv_tt_query_packet *tt_response; 1588 struct batadv_tt_query_packet *tt_response;
1599 struct batadv_tt_change *tt_change; 1589 struct batadv_tt_change *tt_change;
1600 struct hlist_node *node;
1601 struct hlist_head *head; 1590 struct hlist_head *head;
1602 struct sk_buff *skb = NULL; 1591 struct sk_buff *skb = NULL;
1603 uint16_t tt_tot, tt_count; 1592 uint16_t tt_tot, tt_count;
@@ -1627,7 +1616,7 @@ batadv_tt_response_fill_table(uint16_t tt_len, uint8_t ttvn,
1627 for (i = 0; i < hash->size; i++) { 1616 for (i = 0; i < hash->size; i++) {
1628 head = &hash->table[i]; 1617 head = &hash->table[i];
1629 1618
1630 hlist_for_each_entry_rcu(tt_common_entry, node, 1619 hlist_for_each_entry_rcu(tt_common_entry,
1631 head, hash_entry) { 1620 head, hash_entry) {
1632 if (tt_count == tt_tot) 1621 if (tt_count == tt_tot)
1633 break; 1622 break;
@@ -2307,7 +2296,6 @@ static uint16_t batadv_tt_set_flags(struct batadv_hashtable *hash,
2307 uint32_t i; 2296 uint32_t i;
2308 uint16_t changed_num = 0; 2297 uint16_t changed_num = 0;
2309 struct hlist_head *head; 2298 struct hlist_head *head;
2310 struct hlist_node *node;
2311 struct batadv_tt_common_entry *tt_common_entry; 2299 struct batadv_tt_common_entry *tt_common_entry;
2312 2300
2313 if (!hash) 2301 if (!hash)
@@ -2317,7 +2305,7 @@ static uint16_t batadv_tt_set_flags(struct batadv_hashtable *hash,
2317 head = &hash->table[i]; 2305 head = &hash->table[i];
2318 2306
2319 rcu_read_lock(); 2307 rcu_read_lock();
2320 hlist_for_each_entry_rcu(tt_common_entry, node, 2308 hlist_for_each_entry_rcu(tt_common_entry,
2321 head, hash_entry) { 2309 head, hash_entry) {
2322 if (enable) { 2310 if (enable) {
2323 if ((tt_common_entry->flags & flags) == flags) 2311 if ((tt_common_entry->flags & flags) == flags)
@@ -2342,7 +2330,7 @@ static void batadv_tt_local_purge_pending_clients(struct batadv_priv *bat_priv)
2342 struct batadv_hashtable *hash = bat_priv->tt.local_hash; 2330 struct batadv_hashtable *hash = bat_priv->tt.local_hash;
2343 struct batadv_tt_common_entry *tt_common; 2331 struct batadv_tt_common_entry *tt_common;
2344 struct batadv_tt_local_entry *tt_local; 2332 struct batadv_tt_local_entry *tt_local;
2345 struct hlist_node *node, *node_tmp; 2333 struct hlist_node *node_tmp;
2346 struct hlist_head *head; 2334 struct hlist_head *head;
2347 spinlock_t *list_lock; /* protects write access to the hash lists */ 2335 spinlock_t *list_lock; /* protects write access to the hash lists */
2348 uint32_t i; 2336 uint32_t i;
@@ -2355,7 +2343,7 @@ static void batadv_tt_local_purge_pending_clients(struct batadv_priv *bat_priv)
2355 list_lock = &hash->list_locks[i]; 2343 list_lock = &hash->list_locks[i];
2356 2344
2357 spin_lock_bh(list_lock); 2345 spin_lock_bh(list_lock);
2358 hlist_for_each_entry_safe(tt_common, node, node_tmp, head, 2346 hlist_for_each_entry_safe(tt_common, node_tmp, head,
2359 hash_entry) { 2347 hash_entry) {
2360 if (!(tt_common->flags & BATADV_TT_CLIENT_PENDING)) 2348 if (!(tt_common->flags & BATADV_TT_CLIENT_PENDING))
2361 continue; 2349 continue;
@@ -2365,7 +2353,7 @@ static void batadv_tt_local_purge_pending_clients(struct batadv_priv *bat_priv)
2365 tt_common->addr); 2353 tt_common->addr);
2366 2354
2367 atomic_dec(&bat_priv->tt.local_entry_num); 2355 atomic_dec(&bat_priv->tt.local_entry_num);
2368 hlist_del_rcu(node); 2356 hlist_del_rcu(&tt_common->hash_entry);
2369 tt_local = container_of(tt_common, 2357 tt_local = container_of(tt_common,
2370 struct batadv_tt_local_entry, 2358 struct batadv_tt_local_entry,
2371 common); 2359 common);