1 From c506b113c82319c43478ff31c933c4e98f0084d7 Mon Sep 17 00:00:00 2001
2 From: Sasha Levin <sasha.levin@oracle.com>
3 Date: Wed, 27 Feb 2013 17:06:00 -0800
4 Subject: [PATCH 2/3] hlist: drop the node parameter from iterators
6 I'm not sure why, but the hlist for each entry iterators were conceived
8 list_for_each_entry(pos, head, member)
10 The hlist ones were greedy and wanted an extra parameter:
12 hlist_for_each_entry(tpos, pos, head, member)
14 Why did they need an extra pos parameter? I'm not quite sure. Not only
15 they don't really need it, it also prevents the iterator from looking
16 exactly like the list iterator, which is unfortunate.
18 Besides the semantic patch, there was some manual work required:
20 - Fix up the actual hlist iterators in linux/list.h
21 - Fix up the declaration of other iterators based on the hlist ones.
22 - A very small amount of places were using the 'node' parameter, this
23 was modified to use 'obj->member' instead.
24 - Coccinelle didn't handle the hlist_for_each_entry_safe iterator
25 properly, so those had to be fixed up manually.
27 The semantic patch which is mostly the work of Peter Senna Tschudin is here:
30 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;
41 hlist_for_each_entry(a,
45 hlist_for_each_entry_continue(a,
49 hlist_for_each_entry_from(a,
53 hlist_for_each_entry_rcu(a,
57 hlist_for_each_entry_rcu_bh(a,
61 hlist_for_each_entry_continue_rcu_bh(a,
65 for_each_busy_worker(a, c,
77 inet_bind_bucket_for_each(a,
81 sctp_for_each_hentry(a,
97 + sk_for_each_from(a) S
107 hlist_for_each_entry_safe(a,
111 hlist_for_each_entry_continue_rcu(a,
119 nr_neigh_for_each_safe(a,
127 nr_node_for_each_safe(a,
131 - for_each_gfn_sp(a, c, d, b) S
132 + for_each_gfn_sp(a, c, d) S
134 - for_each_gfn_indirect_valid_sp(a, c, d, b) S
135 + for_each_gfn_indirect_valid_sp(a, c, d) S
141 for_each_host_safe(a,
145 for_each_mesh_entry(a,
151 [akpm@linux-foundation.org: drop bogus change from net/ipv4/raw.c]
152 [akpm@linux-foundation.org: drop bogus hunk from net/ipv6/raw.c]
153 [akpm@linux-foundation.org: checkpatch fixes]
154 [akpm@linux-foundation.org: fix warnings]
155 [akpm@linux-foudnation.org: redo intrusive kvm changes]
156 Tested-by: Peter Senna Tschudin <peter.senna@gmail.com>
157 Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
158 Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
159 Cc: Wu Fengguang <fengguang.wu@intel.com>
160 Cc: Marcelo Tosatti <mtosatti@redhat.com>
161 Cc: Gleb Natapov <gleb@redhat.com>
162 Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
163 Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
164 Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
166 bat_iv_ogm.c | 12 +++----
167 bridge_loop_avoidance.c | 39 +++++++++-------------
168 compat.h | 23 +++++++++++++
169 distributed-arp-table.c | 15 ++++-----
170 gateway_client.c | 13 +++-----
172 originator.c | 31 ++++++++----------
176 translation-table.c | 82 ++++++++++++++++++++---------------------------
177 vis.c | 38 +++++++++-------------
178 12 files changed, 125 insertions(+), 149 deletions(-)
180 diff --git a/bat_iv_ogm.c b/bat_iv_ogm.c
181 index d5be889..a5bb0a7 100644
184 @@ -487,7 +487,6 @@ static void batadv_iv_ogm_queue_add(struct batadv_priv *bat_priv,
186 struct batadv_forw_packet *forw_packet_aggr = NULL;
187 struct batadv_forw_packet *forw_packet_pos = NULL;
188 - struct hlist_node *tmp_node;
189 struct batadv_ogm_packet *batadv_ogm_packet;
191 unsigned long max_aggregation_jiffies;
192 @@ -500,7 +499,7 @@ static void batadv_iv_ogm_queue_add(struct batadv_priv *bat_priv,
193 spin_lock_bh(&bat_priv->forw_bat_list_lock);
194 /* own packets are not to be aggregated */
195 if ((atomic_read(&bat_priv->aggregated_ogms)) && (!own_packet)) {
196 - hlist_for_each_entry(forw_packet_pos, tmp_node,
197 + hlist_for_each_entry(forw_packet_pos,
198 &bat_priv->forw_bat_list, list) {
199 if (batadv_iv_ogm_can_aggregate(batadv_ogm_packet,
200 bat_priv, packet_len,
201 @@ -655,7 +654,6 @@ batadv_iv_ogm_orig_update(struct batadv_priv *bat_priv,
202 struct batadv_neigh_node *neigh_node = NULL, *tmp_neigh_node = NULL;
203 struct batadv_neigh_node *router = NULL;
204 struct batadv_orig_node *orig_node_tmp;
205 - struct hlist_node *node;
207 uint8_t sum_orig, sum_neigh;
209 @@ -665,7 +663,7 @@ batadv_iv_ogm_orig_update(struct batadv_priv *bat_priv,
210 "update_originator(): Searching and updating originator entry of received packet\n");
213 - hlist_for_each_entry_rcu(tmp_neigh_node, node,
214 + hlist_for_each_entry_rcu(tmp_neigh_node,
215 &orig_node->neigh_list, list) {
216 neigh_addr = tmp_neigh_node->addr;
217 if (batadv_compare_eth(neigh_addr, ethhdr->h_source) &&
218 @@ -801,7 +799,6 @@ static int batadv_iv_ogm_calc_tq(struct batadv_orig_node *orig_node,
220 struct batadv_priv *bat_priv = netdev_priv(if_incoming->soft_iface);
221 struct batadv_neigh_node *neigh_node = NULL, *tmp_neigh_node;
222 - struct hlist_node *node;
224 uint8_t orig_eq_count, neigh_rq_count, neigh_rq_inv, tq_own;
225 unsigned int neigh_rq_inv_cube, neigh_rq_max_cube;
226 @@ -810,7 +807,7 @@ static int batadv_iv_ogm_calc_tq(struct batadv_orig_node *orig_node,
228 /* find corresponding one hop neighbor */
230 - hlist_for_each_entry_rcu(tmp_neigh_node, node,
231 + hlist_for_each_entry_rcu(tmp_neigh_node,
232 &orig_neigh_node->neigh_list, list) {
233 if (!batadv_compare_eth(tmp_neigh_node->addr,
234 orig_neigh_node->orig))
235 @@ -920,7 +917,6 @@ batadv_iv_ogm_update_seqnos(const struct ethhdr *ethhdr,
236 struct batadv_priv *bat_priv = netdev_priv(if_incoming->soft_iface);
237 struct batadv_orig_node *orig_node;
238 struct batadv_neigh_node *tmp_neigh_node;
239 - struct hlist_node *node;
240 int is_duplicate = 0;
243 @@ -943,7 +939,7 @@ batadv_iv_ogm_update_seqnos(const struct ethhdr *ethhdr,
247 - hlist_for_each_entry_rcu(tmp_neigh_node, node,
248 + hlist_for_each_entry_rcu(tmp_neigh_node,
249 &orig_node->neigh_list, list) {
250 is_duplicate |= batadv_test_bit(tmp_neigh_node->real_bits,
251 orig_node->last_real_seqno,
252 diff --git a/bridge_loop_avoidance.c b/bridge_loop_avoidance.c
253 index 30f4652..6a4f728 100644
254 --- a/bridge_loop_avoidance.c
255 +++ b/bridge_loop_avoidance.c
256 @@ -144,7 +144,6 @@ static struct batadv_bla_claim
258 struct batadv_hashtable *hash = bat_priv->bla.claim_hash;
259 struct hlist_head *head;
260 - struct hlist_node *node;
261 struct batadv_bla_claim *claim;
262 struct batadv_bla_claim *claim_tmp = NULL;
264 @@ -156,7 +155,7 @@ static struct batadv_bla_claim
265 head = &hash->table[index];
268 - hlist_for_each_entry_rcu(claim, node, head, hash_entry) {
269 + hlist_for_each_entry_rcu(claim, head, hash_entry) {
270 if (!batadv_compare_claim(&claim->hash_entry, data))
273 @@ -185,7 +184,6 @@ batadv_backbone_hash_find(struct batadv_priv *bat_priv,
275 struct batadv_hashtable *hash = bat_priv->bla.backbone_hash;
276 struct hlist_head *head;
277 - struct hlist_node *node;
278 struct batadv_bla_backbone_gw search_entry, *backbone_gw;
279 struct batadv_bla_backbone_gw *backbone_gw_tmp = NULL;
281 @@ -200,7 +198,7 @@ batadv_backbone_hash_find(struct batadv_priv *bat_priv,
282 head = &hash->table[index];
285 - hlist_for_each_entry_rcu(backbone_gw, node, head, hash_entry) {
286 + hlist_for_each_entry_rcu(backbone_gw, head, hash_entry) {
287 if (!batadv_compare_backbone_gw(&backbone_gw->hash_entry,
290 @@ -221,7 +219,7 @@ static void
291 batadv_bla_del_backbone_claims(struct batadv_bla_backbone_gw *backbone_gw)
293 struct batadv_hashtable *hash;
294 - struct hlist_node *node, *node_tmp;
295 + struct hlist_node *node_tmp;
296 struct hlist_head *head;
297 struct batadv_bla_claim *claim;
299 @@ -236,13 +234,13 @@ batadv_bla_del_backbone_claims(struct batadv_bla_backbone_gw *backbone_gw)
300 list_lock = &hash->list_locks[i];
302 spin_lock_bh(list_lock);
303 - hlist_for_each_entry_safe(claim, node, node_tmp,
304 + hlist_for_each_entry_safe(claim, node_tmp,
306 if (claim->backbone_gw != backbone_gw)
309 batadv_claim_free_ref(claim);
310 - hlist_del_rcu(node);
311 + hlist_del_rcu(&claim->hash_entry);
313 spin_unlock_bh(list_lock);
315 @@ -460,7 +458,6 @@ static void batadv_bla_answer_request(struct batadv_priv *bat_priv,
316 struct batadv_hard_iface *primary_if,
319 - struct hlist_node *node;
320 struct hlist_head *head;
321 struct batadv_hashtable *hash;
322 struct batadv_bla_claim *claim;
323 @@ -481,7 +478,7 @@ static void batadv_bla_answer_request(struct batadv_priv *bat_priv,
324 head = &hash->table[i];
327 - hlist_for_each_entry_rcu(claim, node, head, hash_entry) {
328 + hlist_for_each_entry_rcu(claim, head, hash_entry) {
329 /* only own claims are interesting */
330 if (claim->backbone_gw != backbone_gw)
332 @@ -958,7 +955,7 @@ static int batadv_bla_process_claim(struct batadv_priv *bat_priv,
333 static void batadv_bla_purge_backbone_gw(struct batadv_priv *bat_priv, int now)
335 struct batadv_bla_backbone_gw *backbone_gw;
336 - struct hlist_node *node, *node_tmp;
337 + struct hlist_node *node_tmp;
338 struct hlist_head *head;
339 struct batadv_hashtable *hash;
340 spinlock_t *list_lock; /* protects write access to the hash lists */
341 @@ -973,7 +970,7 @@ static void batadv_bla_purge_backbone_gw(struct batadv_priv *bat_priv, int now)
342 list_lock = &hash->list_locks[i];
344 spin_lock_bh(list_lock);
345 - hlist_for_each_entry_safe(backbone_gw, node, node_tmp,
346 + hlist_for_each_entry_safe(backbone_gw, node_tmp,
350 @@ -992,7 +989,7 @@ purge_now:
352 batadv_bla_del_backbone_claims(backbone_gw);
354 - hlist_del_rcu(node);
355 + hlist_del_rcu(&backbone_gw->hash_entry);
356 batadv_backbone_gw_free_ref(backbone_gw);
358 spin_unlock_bh(list_lock);
359 @@ -1013,7 +1010,6 @@ static void batadv_bla_purge_claims(struct batadv_priv *bat_priv,
362 struct batadv_bla_claim *claim;
363 - struct hlist_node *node;
364 struct hlist_head *head;
365 struct batadv_hashtable *hash;
367 @@ -1026,7 +1022,7 @@ static void batadv_bla_purge_claims(struct batadv_priv *bat_priv,
368 head = &hash->table[i];
371 - hlist_for_each_entry_rcu(claim, node, head, hash_entry) {
372 + hlist_for_each_entry_rcu(claim, head, hash_entry) {
375 if (!batadv_compare_eth(claim->backbone_gw->orig,
376 @@ -1062,7 +1058,6 @@ void batadv_bla_update_orig_address(struct batadv_priv *bat_priv,
377 struct batadv_hard_iface *oldif)
379 struct batadv_bla_backbone_gw *backbone_gw;
380 - struct hlist_node *node;
381 struct hlist_head *head;
382 struct batadv_hashtable *hash;
384 @@ -1086,7 +1081,7 @@ void batadv_bla_update_orig_address(struct batadv_priv *bat_priv,
385 head = &hash->table[i];
388 - hlist_for_each_entry_rcu(backbone_gw, node, head, hash_entry) {
389 + hlist_for_each_entry_rcu(backbone_gw, head, hash_entry) {
390 /* own orig still holds the old value. */
391 if (!batadv_compare_eth(backbone_gw->orig,
392 oldif->net_dev->dev_addr))
393 @@ -1112,7 +1107,6 @@ static void batadv_bla_periodic_work(struct work_struct *work)
394 struct delayed_work *delayed_work;
395 struct batadv_priv *bat_priv;
396 struct batadv_priv_bla *priv_bla;
397 - struct hlist_node *node;
398 struct hlist_head *head;
399 struct batadv_bla_backbone_gw *backbone_gw;
400 struct batadv_hashtable *hash;
401 @@ -1140,7 +1134,7 @@ static void batadv_bla_periodic_work(struct work_struct *work)
402 head = &hash->table[i];
405 - hlist_for_each_entry_rcu(backbone_gw, node, head, hash_entry) {
406 + hlist_for_each_entry_rcu(backbone_gw, head, hash_entry) {
407 if (!batadv_compare_eth(backbone_gw->orig,
408 primary_if->net_dev->dev_addr))
410 @@ -1322,7 +1316,6 @@ int batadv_bla_is_backbone_gw_orig(struct batadv_priv *bat_priv, uint8_t *orig)
412 struct batadv_hashtable *hash = bat_priv->bla.backbone_hash;
413 struct hlist_head *head;
414 - struct hlist_node *node;
415 struct batadv_bla_backbone_gw *backbone_gw;
418 @@ -1336,7 +1329,7 @@ int batadv_bla_is_backbone_gw_orig(struct batadv_priv *bat_priv, uint8_t *orig)
419 head = &hash->table[i];
422 - hlist_for_each_entry_rcu(backbone_gw, node, head, hash_entry) {
423 + hlist_for_each_entry_rcu(backbone_gw, head, hash_entry) {
424 if (batadv_compare_eth(backbone_gw->orig, orig)) {
427 @@ -1607,7 +1600,6 @@ int batadv_bla_claim_table_seq_print_text(struct seq_file *seq, void *offset)
428 struct batadv_hashtable *hash = bat_priv->bla.claim_hash;
429 struct batadv_bla_claim *claim;
430 struct batadv_hard_iface *primary_if;
431 - struct hlist_node *node;
432 struct hlist_head *head;
435 @@ -1628,7 +1620,7 @@ int batadv_bla_claim_table_seq_print_text(struct seq_file *seq, void *offset)
436 head = &hash->table[i];
439 - hlist_for_each_entry_rcu(claim, node, head, hash_entry) {
440 + hlist_for_each_entry_rcu(claim, head, hash_entry) {
441 is_own = batadv_compare_eth(claim->backbone_gw->orig,
443 seq_printf(seq, " * %pM on % 5d by %pM [%c] (%#.4x)\n",
444 @@ -1652,7 +1644,6 @@ int batadv_bla_backbone_table_seq_print_text(struct seq_file *seq, void *offset)
445 struct batadv_hashtable *hash = bat_priv->bla.backbone_hash;
446 struct batadv_bla_backbone_gw *backbone_gw;
447 struct batadv_hard_iface *primary_if;
448 - struct hlist_node *node;
449 struct hlist_head *head;
452 @@ -1674,7 +1665,7 @@ int batadv_bla_backbone_table_seq_print_text(struct seq_file *seq, void *offset)
453 head = &hash->table[i];
456 - hlist_for_each_entry_rcu(backbone_gw, node, head, hash_entry) {
457 + hlist_for_each_entry_rcu(backbone_gw, head, hash_entry) {
458 msecs = jiffies_to_msecs(jiffies -
459 backbone_gw->lasttime);
461 diff --git a/compat.h b/compat.h
462 index e21b310..22ab781 100644
465 @@ -211,6 +211,29 @@ static int batadv_interface_set_mac_addr(struct net_device *dev, void *p) \
467 static int __batadv_interface_set_mac_addr(x, y)
469 +#define hlist_entry_safe(ptr, type, member) \
470 + (ptr) ? hlist_entry(ptr, type, member) : NULL
472 +#undef hlist_for_each_entry
473 +#define hlist_for_each_entry(pos, head, member) \
474 + for (pos = hlist_entry_safe((head)->first, typeof(*(pos)), member);\
476 + pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member))
478 +#undef hlist_for_each_entry_rcu
479 +#define hlist_for_each_entry_rcu(pos, head, member) \
480 + for (pos = hlist_entry_safe (rcu_dereference_raw(hlist_first_rcu(head)),\
481 + typeof(*(pos)), member); \
483 + pos = hlist_entry_safe(rcu_dereference_raw(hlist_next_rcu(\
484 + &(pos)->member)), typeof(*(pos)), member))
486 +#undef hlist_for_each_entry_safe
487 +#define hlist_for_each_entry_safe(pos, n, head, member) \
488 + for (pos = hlist_entry_safe((head)->first, typeof(*pos), member);\
489 + pos && ({ n = pos->member.next; 1; }); \
490 + pos = hlist_entry_safe(n, typeof(*pos), member))
492 #endif /* < KERNEL_VERSION(3, 9, 0) */
494 #endif /* _NET_BATMAN_ADV_COMPAT_H_ */
495 diff --git a/distributed-arp-table.c b/distributed-arp-table.c
496 index 761a590..d54188a 100644
497 --- a/distributed-arp-table.c
498 +++ b/distributed-arp-table.c
499 @@ -83,7 +83,7 @@ static void __batadv_dat_purge(struct batadv_priv *bat_priv,
501 spinlock_t *list_lock; /* protects write access to the hash lists */
502 struct batadv_dat_entry *dat_entry;
503 - struct hlist_node *node, *node_tmp;
504 + struct hlist_node *node_tmp;
505 struct hlist_head *head;
508 @@ -95,7 +95,7 @@ static void __batadv_dat_purge(struct batadv_priv *bat_priv,
509 list_lock = &bat_priv->dat.hash->list_locks[i];
511 spin_lock_bh(list_lock);
512 - hlist_for_each_entry_safe(dat_entry, node, node_tmp, head,
513 + hlist_for_each_entry_safe(dat_entry, node_tmp, head,
515 /* if an helper function has been passed as parameter,
516 * ask it if the entry has to be purged or not
517 @@ -103,7 +103,7 @@ static void __batadv_dat_purge(struct batadv_priv *bat_priv,
518 if (to_purge && !to_purge(dat_entry))
521 - hlist_del_rcu(node);
522 + hlist_del_rcu(&dat_entry->hash_entry);
523 batadv_dat_entry_free_ref(dat_entry);
525 spin_unlock_bh(list_lock);
526 @@ -235,7 +235,6 @@ static struct batadv_dat_entry *
527 batadv_dat_entry_hash_find(struct batadv_priv *bat_priv, __be32 ip)
529 struct hlist_head *head;
530 - struct hlist_node *node;
531 struct batadv_dat_entry *dat_entry, *dat_entry_tmp = NULL;
532 struct batadv_hashtable *hash = bat_priv->dat.hash;
534 @@ -247,7 +246,7 @@ batadv_dat_entry_hash_find(struct batadv_priv *bat_priv, __be32 ip)
535 head = &hash->table[index];
538 - hlist_for_each_entry_rcu(dat_entry, node, head, hash_entry) {
539 + hlist_for_each_entry_rcu(dat_entry, head, hash_entry) {
540 if (dat_entry->ip != ip)
543 @@ -465,7 +464,6 @@ static void batadv_choose_next_candidate(struct batadv_priv *bat_priv,
544 batadv_dat_addr_t max = 0, tmp_max = 0;
545 struct batadv_orig_node *orig_node, *max_orig_node = NULL;
546 struct batadv_hashtable *hash = bat_priv->orig_hash;
547 - struct hlist_node *node;
548 struct hlist_head *head;
551 @@ -481,7 +479,7 @@ static void batadv_choose_next_candidate(struct batadv_priv *bat_priv,
552 head = &hash->table[i];
555 - hlist_for_each_entry_rcu(orig_node, node, head, hash_entry) {
556 + hlist_for_each_entry_rcu(orig_node, head, hash_entry) {
557 /* the dht space is a ring and addresses are unsigned */
558 tmp_max = BATADV_DAT_ADDR_MAX - orig_node->dat_addr +
560 @@ -686,7 +684,6 @@ int batadv_dat_cache_seq_print_text(struct seq_file *seq, void *offset)
561 struct batadv_hashtable *hash = bat_priv->dat.hash;
562 struct batadv_dat_entry *dat_entry;
563 struct batadv_hard_iface *primary_if;
564 - struct hlist_node *node;
565 struct hlist_head *head;
566 unsigned long last_seen_jiffies;
567 int last_seen_msecs, last_seen_secs, last_seen_mins;
568 @@ -704,7 +701,7 @@ int batadv_dat_cache_seq_print_text(struct seq_file *seq, void *offset)
569 head = &hash->table[i];
572 - hlist_for_each_entry_rcu(dat_entry, node, head, hash_entry) {
573 + hlist_for_each_entry_rcu(dat_entry, head, hash_entry) {
574 last_seen_jiffies = jiffies - dat_entry->last_update;
575 last_seen_msecs = jiffies_to_msecs(last_seen_jiffies);
576 last_seen_mins = last_seen_msecs / 60000;
577 diff --git a/gateway_client.c b/gateway_client.c
578 index 074107f..34f99a4 100644
579 --- a/gateway_client.c
580 +++ b/gateway_client.c
581 @@ -114,7 +114,6 @@ static struct batadv_gw_node *
582 batadv_gw_get_best_gw_node(struct batadv_priv *bat_priv)
584 struct batadv_neigh_node *router;
585 - struct hlist_node *node;
586 struct batadv_gw_node *gw_node, *curr_gw = NULL;
587 uint32_t max_gw_factor = 0, tmp_gw_factor = 0;
589 @@ -127,7 +126,7 @@ batadv_gw_get_best_gw_node(struct batadv_priv *bat_priv)
593 - hlist_for_each_entry_rcu(gw_node, node, &bat_priv->gw.list, list) {
594 + hlist_for_each_entry_rcu(gw_node, &bat_priv->gw.list, list) {
595 if (gw_node->deleted)
598 @@ -344,7 +343,6 @@ void batadv_gw_node_update(struct batadv_priv *bat_priv,
599 struct batadv_orig_node *orig_node,
602 - struct hlist_node *node;
603 struct batadv_gw_node *gw_node, *curr_gw;
605 /* Note: We don't need a NULL check here, since curr_gw never gets
606 @@ -355,7 +353,7 @@ void batadv_gw_node_update(struct batadv_priv *bat_priv,
607 curr_gw = batadv_gw_get_selected_gw_node(bat_priv);
610 - hlist_for_each_entry_rcu(gw_node, node, &bat_priv->gw.list, list) {
611 + hlist_for_each_entry_rcu(gw_node, &bat_priv->gw.list, list) {
612 if (gw_node->orig_node != orig_node)
615 @@ -403,7 +401,7 @@ void batadv_gw_node_delete(struct batadv_priv *bat_priv,
616 void batadv_gw_node_purge(struct batadv_priv *bat_priv)
618 struct batadv_gw_node *gw_node, *curr_gw;
619 - struct hlist_node *node, *node_tmp;
620 + struct hlist_node *node_tmp;
621 unsigned long timeout = msecs_to_jiffies(2 * BATADV_PURGE_TIMEOUT);
624 @@ -411,7 +409,7 @@ void batadv_gw_node_purge(struct batadv_priv *bat_priv)
626 spin_lock_bh(&bat_priv->gw.list_lock);
628 - hlist_for_each_entry_safe(gw_node, node, node_tmp,
629 + hlist_for_each_entry_safe(gw_node, node_tmp,
630 &bat_priv->gw.list, list) {
631 if (((!gw_node->deleted) ||
632 (time_before(jiffies, gw_node->deleted + timeout))) &&
633 @@ -476,7 +474,6 @@ int batadv_gw_client_seq_print_text(struct seq_file *seq, void *offset)
634 struct batadv_priv *bat_priv = netdev_priv(net_dev);
635 struct batadv_hard_iface *primary_if;
636 struct batadv_gw_node *gw_node;
637 - struct hlist_node *node;
640 primary_if = batadv_seq_print_text_primary_if_get(seq);
641 @@ -490,7 +487,7 @@ int batadv_gw_client_seq_print_text(struct seq_file *seq, void *offset)
642 primary_if->net_dev->dev_addr, net_dev->name);
645 - hlist_for_each_entry_rcu(gw_node, node, &bat_priv->gw.list, list) {
646 + hlist_for_each_entry_rcu(gw_node, &bat_priv->gw.list, list) {
647 if (gw_node->deleted)
650 diff --git a/main.c b/main.c
651 index 21fe698..0488d70 100644
654 @@ -345,9 +345,8 @@ void batadv_recv_handler_unregister(uint8_t packet_type)
655 static struct batadv_algo_ops *batadv_algo_get(char *name)
657 struct batadv_algo_ops *bat_algo_ops = NULL, *bat_algo_ops_tmp;
658 - struct hlist_node *node;
660 - hlist_for_each_entry(bat_algo_ops_tmp, node, &batadv_algo_list, list) {
661 + hlist_for_each_entry(bat_algo_ops_tmp, &batadv_algo_list, list) {
662 if (strcmp(bat_algo_ops_tmp->name, name) != 0)
665 @@ -411,11 +410,10 @@ out:
666 int batadv_algo_seq_print_text(struct seq_file *seq, void *offset)
668 struct batadv_algo_ops *bat_algo_ops;
669 - struct hlist_node *node;
671 seq_printf(seq, "Available routing algorithms:\n");
673 - hlist_for_each_entry(bat_algo_ops, node, &batadv_algo_list, list) {
674 + hlist_for_each_entry(bat_algo_ops, &batadv_algo_list, list) {
675 seq_printf(seq, "%s\n", bat_algo_ops->name);
678 diff --git a/originator.c b/originator.c
679 index 457ea44..96fb80b 100644
682 @@ -118,7 +118,7 @@ out:
684 static void batadv_orig_node_free_rcu(struct rcu_head *rcu)
686 - struct hlist_node *node, *node_tmp;
687 + struct hlist_node *node_tmp;
688 struct batadv_neigh_node *neigh_node, *tmp_neigh_node;
689 struct batadv_orig_node *orig_node;
691 @@ -134,7 +134,7 @@ static void batadv_orig_node_free_rcu(struct rcu_head *rcu)
694 /* for all neighbors towards this originator ... */
695 - hlist_for_each_entry_safe(neigh_node, node, node_tmp,
696 + hlist_for_each_entry_safe(neigh_node, node_tmp,
697 &orig_node->neigh_list, list) {
698 hlist_del_rcu(&neigh_node->list);
699 batadv_neigh_node_free_ref(neigh_node);
700 @@ -161,7 +161,7 @@ void batadv_orig_node_free_ref(struct batadv_orig_node *orig_node)
701 void batadv_originator_free(struct batadv_priv *bat_priv)
703 struct batadv_hashtable *hash = bat_priv->orig_hash;
704 - struct hlist_node *node, *node_tmp;
705 + struct hlist_node *node_tmp;
706 struct hlist_head *head;
707 spinlock_t *list_lock; /* spinlock to protect write access */
708 struct batadv_orig_node *orig_node;
709 @@ -179,9 +179,9 @@ void batadv_originator_free(struct batadv_priv *bat_priv)
710 list_lock = &hash->list_locks[i];
712 spin_lock_bh(list_lock);
713 - hlist_for_each_entry_safe(orig_node, node, node_tmp,
714 + hlist_for_each_entry_safe(orig_node, node_tmp,
716 - hlist_del_rcu(node);
717 + hlist_del_rcu(&orig_node->hash_entry);
718 batadv_orig_node_free_ref(orig_node);
720 spin_unlock_bh(list_lock);
721 @@ -274,7 +274,7 @@ batadv_purge_orig_neighbors(struct batadv_priv *bat_priv,
722 struct batadv_orig_node *orig_node,
723 struct batadv_neigh_node **best_neigh_node)
725 - struct hlist_node *node, *node_tmp;
726 + struct hlist_node *node_tmp;
727 struct batadv_neigh_node *neigh_node;
728 bool neigh_purged = false;
729 unsigned long last_seen;
730 @@ -285,7 +285,7 @@ batadv_purge_orig_neighbors(struct batadv_priv *bat_priv,
731 spin_lock_bh(&orig_node->neigh_list_lock);
733 /* for all neighbors towards this originator ... */
734 - hlist_for_each_entry_safe(neigh_node, node, node_tmp,
735 + hlist_for_each_entry_safe(neigh_node, node_tmp,
736 &orig_node->neigh_list, list) {
737 last_seen = neigh_node->last_seen;
738 if_incoming = neigh_node->if_incoming;
739 @@ -348,7 +348,7 @@ static bool batadv_purge_orig_node(struct batadv_priv *bat_priv,
740 static void _batadv_purge_orig(struct batadv_priv *bat_priv)
742 struct batadv_hashtable *hash = bat_priv->orig_hash;
743 - struct hlist_node *node, *node_tmp;
744 + struct hlist_node *node_tmp;
745 struct hlist_head *head;
746 spinlock_t *list_lock; /* spinlock to protect write access */
747 struct batadv_orig_node *orig_node;
748 @@ -363,13 +363,13 @@ static void _batadv_purge_orig(struct batadv_priv *bat_priv)
749 list_lock = &hash->list_locks[i];
751 spin_lock_bh(list_lock);
752 - hlist_for_each_entry_safe(orig_node, node, node_tmp,
753 + hlist_for_each_entry_safe(orig_node, node_tmp,
755 if (batadv_purge_orig_node(bat_priv, orig_node)) {
756 if (orig_node->gw_flags)
757 batadv_gw_node_delete(bat_priv,
759 - hlist_del_rcu(node);
760 + hlist_del_rcu(&orig_node->hash_entry);
761 batadv_orig_node_free_ref(orig_node);
764 @@ -408,7 +408,6 @@ int batadv_orig_seq_print_text(struct seq_file *seq, void *offset)
765 struct net_device *net_dev = (struct net_device *)seq->private;
766 struct batadv_priv *bat_priv = netdev_priv(net_dev);
767 struct batadv_hashtable *hash = bat_priv->orig_hash;
768 - struct hlist_node *node, *node_tmp;
769 struct hlist_head *head;
770 struct batadv_hard_iface *primary_if;
771 struct batadv_orig_node *orig_node;
772 @@ -434,7 +433,7 @@ int batadv_orig_seq_print_text(struct seq_file *seq, void *offset)
773 head = &hash->table[i];
776 - hlist_for_each_entry_rcu(orig_node, node, head, hash_entry) {
777 + hlist_for_each_entry_rcu(orig_node, head, hash_entry) {
778 neigh_node = batadv_orig_node_get_router(orig_node);
781 @@ -453,7 +452,7 @@ int batadv_orig_seq_print_text(struct seq_file *seq, void *offset)
783 neigh_node->if_incoming->net_dev->name);
785 - hlist_for_each_entry_rcu(neigh_node_tmp, node_tmp,
786 + hlist_for_each_entry_rcu(neigh_node_tmp,
787 &orig_node->neigh_list, list) {
788 seq_printf(seq, " %pM (%3i)",
789 neigh_node_tmp->addr,
790 @@ -511,7 +510,6 @@ int batadv_orig_hash_add_if(struct batadv_hard_iface *hard_iface,
792 struct batadv_priv *bat_priv = netdev_priv(hard_iface->soft_iface);
793 struct batadv_hashtable *hash = bat_priv->orig_hash;
794 - struct hlist_node *node;
795 struct hlist_head *head;
796 struct batadv_orig_node *orig_node;
798 @@ -524,7 +522,7 @@ int batadv_orig_hash_add_if(struct batadv_hard_iface *hard_iface,
799 head = &hash->table[i];
802 - hlist_for_each_entry_rcu(orig_node, node, head, hash_entry) {
803 + hlist_for_each_entry_rcu(orig_node, head, hash_entry) {
804 spin_lock_bh(&orig_node->ogm_cnt_lock);
805 ret = batadv_orig_node_add_if(orig_node, max_if_num);
806 spin_unlock_bh(&orig_node->ogm_cnt_lock);
807 @@ -595,7 +593,6 @@ int batadv_orig_hash_del_if(struct batadv_hard_iface *hard_iface,
809 struct batadv_priv *bat_priv = netdev_priv(hard_iface->soft_iface);
810 struct batadv_hashtable *hash = bat_priv->orig_hash;
811 - struct hlist_node *node;
812 struct hlist_head *head;
813 struct batadv_hard_iface *hard_iface_tmp;
814 struct batadv_orig_node *orig_node;
815 @@ -609,7 +606,7 @@ int batadv_orig_hash_del_if(struct batadv_hard_iface *hard_iface,
816 head = &hash->table[i];
819 - hlist_for_each_entry_rcu(orig_node, node, head, hash_entry) {
820 + hlist_for_each_entry_rcu(orig_node, head, hash_entry) {
821 spin_lock_bh(&orig_node->ogm_cnt_lock);
822 ret = batadv_orig_node_del_if(orig_node, max_if_num,
824 diff --git a/originator.h b/originator.h
825 index 286bf74..7df48fa 100644
828 @@ -68,7 +68,6 @@ batadv_orig_hash_find(struct batadv_priv *bat_priv, const void *data)
830 struct batadv_hashtable *hash = bat_priv->orig_hash;
831 struct hlist_head *head;
832 - struct hlist_node *node;
833 struct batadv_orig_node *orig_node, *orig_node_tmp = NULL;
836 @@ -79,7 +78,7 @@ batadv_orig_hash_find(struct batadv_priv *bat_priv, const void *data)
837 head = &hash->table[index];
840 - hlist_for_each_entry_rcu(orig_node, node, head, hash_entry) {
841 + hlist_for_each_entry_rcu(orig_node, head, hash_entry) {
842 if (!batadv_compare_eth(orig_node, data))
845 diff --git a/routing.c b/routing.c
846 index 60ba03f..5ee21ce 100644
849 @@ -37,7 +37,6 @@ void batadv_slide_own_bcast_window(struct batadv_hard_iface *hard_iface)
851 struct batadv_priv *bat_priv = netdev_priv(hard_iface->soft_iface);
852 struct batadv_hashtable *hash = bat_priv->orig_hash;
853 - struct hlist_node *node;
854 struct hlist_head *head;
855 struct batadv_orig_node *orig_node;
857 @@ -49,7 +48,7 @@ void batadv_slide_own_bcast_window(struct batadv_hard_iface *hard_iface)
858 head = &hash->table[i];
861 - hlist_for_each_entry_rcu(orig_node, node, head, hash_entry) {
862 + hlist_for_each_entry_rcu(orig_node, head, hash_entry) {
863 spin_lock_bh(&orig_node->ogm_cnt_lock);
864 word_index = hard_iface->if_num * BATADV_NUM_WORDS;
865 word = &(orig_node->bcast_own[word_index]);
866 @@ -146,7 +145,6 @@ out:
867 void batadv_bonding_candidate_add(struct batadv_orig_node *orig_node,
868 struct batadv_neigh_node *neigh_node)
870 - struct hlist_node *node;
871 struct batadv_neigh_node *tmp_neigh_node, *router = NULL;
872 uint8_t interference_candidate = 0;
874 @@ -169,7 +167,7 @@ void batadv_bonding_candidate_add(struct batadv_orig_node *orig_node,
875 * interface. If we do, we won't select this candidate because of
876 * possible interference.
878 - hlist_for_each_entry_rcu(tmp_neigh_node, node,
879 + hlist_for_each_entry_rcu(tmp_neigh_node,
880 &orig_node->neigh_list, list) {
881 if (tmp_neigh_node == neigh_node)
883 diff --git a/send.c b/send.c
884 index 80ca65f..a67cffd 100644
887 @@ -316,7 +316,7 @@ batadv_purge_outstanding_packets(struct batadv_priv *bat_priv,
888 const struct batadv_hard_iface *hard_iface)
890 struct batadv_forw_packet *forw_packet;
891 - struct hlist_node *tmp_node, *safe_tmp_node;
892 + struct hlist_node *safe_tmp_node;
896 @@ -329,7 +329,7 @@ batadv_purge_outstanding_packets(struct batadv_priv *bat_priv,
898 /* free bcast list */
899 spin_lock_bh(&bat_priv->forw_bcast_list_lock);
900 - hlist_for_each_entry_safe(forw_packet, tmp_node, safe_tmp_node,
901 + hlist_for_each_entry_safe(forw_packet, safe_tmp_node,
902 &bat_priv->forw_bcast_list, list) {
903 /* if purge_outstanding_packets() was called with an argument
904 * we delete only packets belonging to the given interface
905 @@ -355,7 +355,7 @@ batadv_purge_outstanding_packets(struct batadv_priv *bat_priv,
907 /* free batman packet list */
908 spin_lock_bh(&bat_priv->forw_bat_list_lock);
909 - hlist_for_each_entry_safe(forw_packet, tmp_node, safe_tmp_node,
910 + hlist_for_each_entry_safe(forw_packet, safe_tmp_node,
911 &bat_priv->forw_bat_list, list) {
912 /* if purge_outstanding_packets() was called with an argument
913 * we delete only packets belonging to the given interface
914 diff --git a/translation-table.c b/translation-table.c
915 index d44672f..98a66a0 100644
916 --- a/translation-table.c
917 +++ b/translation-table.c
918 @@ -56,7 +56,6 @@ static struct batadv_tt_common_entry *
919 batadv_tt_hash_find(struct batadv_hashtable *hash, const void *data)
921 struct hlist_head *head;
922 - struct hlist_node *node;
923 struct batadv_tt_common_entry *tt_common_entry;
924 struct batadv_tt_common_entry *tt_common_entry_tmp = NULL;
926 @@ -68,7 +67,7 @@ batadv_tt_hash_find(struct batadv_hashtable *hash, const void *data)
927 head = &hash->table[index];
930 - hlist_for_each_entry_rcu(tt_common_entry, node, head, hash_entry) {
931 + hlist_for_each_entry_rcu(tt_common_entry, head, hash_entry) {
932 if (!batadv_compare_eth(tt_common_entry, data))
935 @@ -257,7 +256,6 @@ void batadv_tt_local_add(struct net_device *soft_iface, const uint8_t *addr,
936 struct batadv_tt_local_entry *tt_local;
937 struct batadv_tt_global_entry *tt_global;
938 struct hlist_head *head;
939 - struct hlist_node *node;
940 struct batadv_tt_orig_list_entry *orig_entry;
942 bool roamed_back = false;
943 @@ -339,7 +337,7 @@ check_roaming:
944 /* These node are probably going to update their tt table */
945 head = &tt_global->orig_list;
947 - hlist_for_each_entry_rcu(orig_entry, node, head, list) {
948 + hlist_for_each_entry_rcu(orig_entry, head, list) {
949 batadv_send_roam_adv(bat_priv, tt_global->common.addr,
950 orig_entry->orig_node);
952 @@ -470,7 +468,6 @@ int batadv_tt_local_seq_print_text(struct seq_file *seq, void *offset)
953 struct batadv_tt_common_entry *tt_common_entry;
954 struct batadv_tt_local_entry *tt_local;
955 struct batadv_hard_iface *primary_if;
956 - struct hlist_node *node;
957 struct hlist_head *head;
960 @@ -494,7 +491,7 @@ int batadv_tt_local_seq_print_text(struct seq_file *seq, void *offset)
961 head = &hash->table[i];
964 - hlist_for_each_entry_rcu(tt_common_entry, node,
965 + hlist_for_each_entry_rcu(tt_common_entry,
967 tt_local = container_of(tt_common_entry,
968 struct batadv_tt_local_entry,
969 @@ -605,9 +602,9 @@ static void batadv_tt_local_purge_list(struct batadv_priv *bat_priv,
971 struct batadv_tt_local_entry *tt_local_entry;
972 struct batadv_tt_common_entry *tt_common_entry;
973 - struct hlist_node *node, *node_tmp;
974 + struct hlist_node *node_tmp;
976 - hlist_for_each_entry_safe(tt_common_entry, node, node_tmp, head,
977 + hlist_for_each_entry_safe(tt_common_entry, node_tmp, head,
979 tt_local_entry = container_of(tt_common_entry,
980 struct batadv_tt_local_entry,
981 @@ -651,7 +648,7 @@ static void batadv_tt_local_table_free(struct batadv_priv *bat_priv)
982 spinlock_t *list_lock; /* protects write access to the hash lists */
983 struct batadv_tt_common_entry *tt_common_entry;
984 struct batadv_tt_local_entry *tt_local;
985 - struct hlist_node *node, *node_tmp;
986 + struct hlist_node *node_tmp;
987 struct hlist_head *head;
990 @@ -665,9 +662,9 @@ static void batadv_tt_local_table_free(struct batadv_priv *bat_priv)
991 list_lock = &hash->list_locks[i];
993 spin_lock_bh(list_lock);
994 - hlist_for_each_entry_safe(tt_common_entry, node, node_tmp,
995 + hlist_for_each_entry_safe(tt_common_entry, node_tmp,
997 - hlist_del_rcu(node);
998 + hlist_del_rcu(&tt_common_entry->hash_entry);
999 tt_local = container_of(tt_common_entry,
1000 struct batadv_tt_local_entry,
1002 @@ -724,11 +721,10 @@ batadv_tt_global_orig_entry_find(const struct batadv_tt_global_entry *entry,
1004 struct batadv_tt_orig_list_entry *tmp_orig_entry, *orig_entry = NULL;
1005 const struct hlist_head *head;
1006 - struct hlist_node *node;
1009 head = &entry->orig_list;
1010 - hlist_for_each_entry_rcu(tmp_orig_entry, node, head, list) {
1011 + hlist_for_each_entry_rcu(tmp_orig_entry, head, list) {
1012 if (tmp_orig_entry->orig_node != orig_node)
1014 if (!atomic_inc_not_zero(&tmp_orig_entry->refcount))
1015 @@ -940,12 +936,11 @@ batadv_transtable_best_orig(struct batadv_tt_global_entry *tt_global_entry)
1017 struct batadv_neigh_node *router = NULL;
1018 struct hlist_head *head;
1019 - struct hlist_node *node;
1020 struct batadv_tt_orig_list_entry *orig_entry, *best_entry = NULL;
1023 head = &tt_global_entry->orig_list;
1024 - hlist_for_each_entry_rcu(orig_entry, node, head, list) {
1025 + hlist_for_each_entry_rcu(orig_entry, head, list) {
1026 router = batadv_orig_node_get_router(orig_entry->orig_node);
1029 @@ -973,7 +968,6 @@ batadv_tt_global_print_entry(struct batadv_tt_global_entry *tt_global_entry,
1030 struct seq_file *seq)
1032 struct hlist_head *head;
1033 - struct hlist_node *node;
1034 struct batadv_tt_orig_list_entry *orig_entry, *best_entry;
1035 struct batadv_tt_common_entry *tt_common_entry;
1037 @@ -997,7 +991,7 @@ batadv_tt_global_print_entry(struct batadv_tt_global_entry *tt_global_entry,
1039 head = &tt_global_entry->orig_list;
1041 - hlist_for_each_entry_rcu(orig_entry, node, head, list) {
1042 + hlist_for_each_entry_rcu(orig_entry, head, list) {
1043 if (best_entry == orig_entry)
1046 @@ -1020,7 +1014,6 @@ int batadv_tt_global_seq_print_text(struct seq_file *seq, void *offset)
1047 struct batadv_tt_common_entry *tt_common_entry;
1048 struct batadv_tt_global_entry *tt_global;
1049 struct batadv_hard_iface *primary_if;
1050 - struct hlist_node *node;
1051 struct hlist_head *head;
1054 @@ -1039,7 +1032,7 @@ int batadv_tt_global_seq_print_text(struct seq_file *seq, void *offset)
1055 head = &hash->table[i];
1058 - hlist_for_each_entry_rcu(tt_common_entry, node,
1059 + hlist_for_each_entry_rcu(tt_common_entry,
1061 tt_global = container_of(tt_common_entry,
1062 struct batadv_tt_global_entry,
1063 @@ -1059,13 +1052,13 @@ static void
1064 batadv_tt_global_del_orig_list(struct batadv_tt_global_entry *tt_global_entry)
1066 struct hlist_head *head;
1067 - struct hlist_node *node, *safe;
1068 + struct hlist_node *safe;
1069 struct batadv_tt_orig_list_entry *orig_entry;
1071 spin_lock_bh(&tt_global_entry->list_lock);
1072 head = &tt_global_entry->orig_list;
1073 - hlist_for_each_entry_safe(orig_entry, node, safe, head, list) {
1074 - hlist_del_rcu(node);
1075 + hlist_for_each_entry_safe(orig_entry, safe, head, list) {
1076 + hlist_del_rcu(&orig_entry->list);
1077 batadv_tt_orig_list_entry_free_ref(orig_entry);
1079 spin_unlock_bh(&tt_global_entry->list_lock);
1080 @@ -1078,18 +1071,18 @@ batadv_tt_global_del_orig_entry(struct batadv_priv *bat_priv,
1081 const char *message)
1083 struct hlist_head *head;
1084 - struct hlist_node *node, *safe;
1085 + struct hlist_node *safe;
1086 struct batadv_tt_orig_list_entry *orig_entry;
1088 spin_lock_bh(&tt_global_entry->list_lock);
1089 head = &tt_global_entry->orig_list;
1090 - hlist_for_each_entry_safe(orig_entry, node, safe, head, list) {
1091 + hlist_for_each_entry_safe(orig_entry, safe, head, list) {
1092 if (orig_entry->orig_node == orig_node) {
1093 batadv_dbg(BATADV_DBG_TT, bat_priv,
1094 "Deleting %pM from global tt entry %pM: %s\n",
1096 tt_global_entry->common.addr, message);
1097 - hlist_del_rcu(node);
1098 + hlist_del_rcu(&orig_entry->list);
1099 batadv_tt_orig_list_entry_free_ref(orig_entry);
1102 @@ -1108,7 +1101,6 @@ batadv_tt_global_del_roaming(struct batadv_priv *bat_priv,
1104 bool last_entry = true;
1105 struct hlist_head *head;
1106 - struct hlist_node *node;
1107 struct batadv_tt_orig_list_entry *orig_entry;
1109 /* no local entry exists, case 1:
1110 @@ -1117,7 +1109,7 @@ batadv_tt_global_del_roaming(struct batadv_priv *bat_priv,
1113 head = &tt_global_entry->orig_list;
1114 - hlist_for_each_entry_rcu(orig_entry, node, head, list) {
1115 + hlist_for_each_entry_rcu(orig_entry, head, list) {
1116 if (orig_entry->orig_node != orig_node) {
1119 @@ -1202,7 +1194,7 @@ void batadv_tt_global_del_orig(struct batadv_priv *bat_priv,
1120 struct batadv_tt_common_entry *tt_common_entry;
1122 struct batadv_hashtable *hash = bat_priv->tt.global_hash;
1123 - struct hlist_node *node, *safe;
1124 + struct hlist_node *safe;
1125 struct hlist_head *head;
1126 spinlock_t *list_lock; /* protects write access to the hash lists */
1128 @@ -1214,7 +1206,7 @@ void batadv_tt_global_del_orig(struct batadv_priv *bat_priv,
1129 list_lock = &hash->list_locks[i];
1131 spin_lock_bh(list_lock);
1132 - hlist_for_each_entry_safe(tt_common_entry, node, safe,
1133 + hlist_for_each_entry_safe(tt_common_entry, safe,
1135 tt_global = container_of(tt_common_entry,
1136 struct batadv_tt_global_entry,
1137 @@ -1227,7 +1219,7 @@ void batadv_tt_global_del_orig(struct batadv_priv *bat_priv,
1138 batadv_dbg(BATADV_DBG_TT, bat_priv,
1139 "Deleting global tt entry %pM: %s\n",
1140 tt_global->common.addr, message);
1141 - hlist_del_rcu(node);
1142 + hlist_del_rcu(&tt_common_entry->hash_entry);
1143 batadv_tt_global_entry_free_ref(tt_global);
1146 @@ -1262,7 +1254,7 @@ static void batadv_tt_global_purge(struct batadv_priv *bat_priv)
1148 struct batadv_hashtable *hash = bat_priv->tt.global_hash;
1149 struct hlist_head *head;
1150 - struct hlist_node *node, *node_tmp;
1151 + struct hlist_node *node_tmp;
1152 spinlock_t *list_lock; /* protects write access to the hash lists */
1155 @@ -1274,7 +1266,7 @@ static void batadv_tt_global_purge(struct batadv_priv *bat_priv)
1156 list_lock = &hash->list_locks[i];
1158 spin_lock_bh(list_lock);
1159 - hlist_for_each_entry_safe(tt_common, node, node_tmp, head,
1160 + hlist_for_each_entry_safe(tt_common, node_tmp, head,
1162 tt_global = container_of(tt_common,
1163 struct batadv_tt_global_entry,
1164 @@ -1287,7 +1279,7 @@ static void batadv_tt_global_purge(struct batadv_priv *bat_priv)
1165 "Deleting global tt entry (%pM): %s\n",
1166 tt_global->common.addr, msg);
1168 - hlist_del_rcu(node);
1169 + hlist_del_rcu(&tt_common->hash_entry);
1171 batadv_tt_global_entry_free_ref(tt_global);
1173 @@ -1301,7 +1293,7 @@ static void batadv_tt_global_table_free(struct batadv_priv *bat_priv)
1174 spinlock_t *list_lock; /* protects write access to the hash lists */
1175 struct batadv_tt_common_entry *tt_common_entry;
1176 struct batadv_tt_global_entry *tt_global;
1177 - struct hlist_node *node, *node_tmp;
1178 + struct hlist_node *node_tmp;
1179 struct hlist_head *head;
1182 @@ -1315,9 +1307,9 @@ static void batadv_tt_global_table_free(struct batadv_priv *bat_priv)
1183 list_lock = &hash->list_locks[i];
1185 spin_lock_bh(list_lock);
1186 - hlist_for_each_entry_safe(tt_common_entry, node, node_tmp,
1187 + hlist_for_each_entry_safe(tt_common_entry, node_tmp,
1189 - hlist_del_rcu(node);
1190 + hlist_del_rcu(&tt_common_entry->hash_entry);
1191 tt_global = container_of(tt_common_entry,
1192 struct batadv_tt_global_entry,
1194 @@ -1397,7 +1389,6 @@ static uint16_t batadv_tt_global_crc(struct batadv_priv *bat_priv,
1195 struct batadv_hashtable *hash = bat_priv->tt.global_hash;
1196 struct batadv_tt_common_entry *tt_common;
1197 struct batadv_tt_global_entry *tt_global;
1198 - struct hlist_node *node;
1199 struct hlist_head *head;
1202 @@ -1406,7 +1397,7 @@ static uint16_t batadv_tt_global_crc(struct batadv_priv *bat_priv,
1203 head = &hash->table[i];
1206 - hlist_for_each_entry_rcu(tt_common, node, head, hash_entry) {
1207 + hlist_for_each_entry_rcu(tt_common, head, hash_entry) {
1208 tt_global = container_of(tt_common,
1209 struct batadv_tt_global_entry,
1211 @@ -1449,7 +1440,6 @@ static uint16_t batadv_tt_local_crc(struct batadv_priv *bat_priv)
1212 uint16_t total = 0, total_one;
1213 struct batadv_hashtable *hash = bat_priv->tt.local_hash;
1214 struct batadv_tt_common_entry *tt_common;
1215 - struct hlist_node *node;
1216 struct hlist_head *head;
1219 @@ -1458,7 +1448,7 @@ static uint16_t batadv_tt_local_crc(struct batadv_priv *bat_priv)
1220 head = &hash->table[i];
1223 - hlist_for_each_entry_rcu(tt_common, node, head, hash_entry) {
1224 + hlist_for_each_entry_rcu(tt_common, head, hash_entry) {
1225 /* not yet committed clients have not to be taken into
1226 * account while computing the CRC
1228 @@ -1597,7 +1587,6 @@ batadv_tt_response_fill_table(uint16_t tt_len, uint8_t ttvn,
1229 struct batadv_tt_common_entry *tt_common_entry;
1230 struct batadv_tt_query_packet *tt_response;
1231 struct batadv_tt_change *tt_change;
1232 - struct hlist_node *node;
1233 struct hlist_head *head;
1234 struct sk_buff *skb = NULL;
1235 uint16_t tt_tot, tt_count;
1236 @@ -1627,7 +1616,7 @@ batadv_tt_response_fill_table(uint16_t tt_len, uint8_t ttvn,
1237 for (i = 0; i < hash->size; i++) {
1238 head = &hash->table[i];
1240 - hlist_for_each_entry_rcu(tt_common_entry, node,
1241 + hlist_for_each_entry_rcu(tt_common_entry,
1243 if (tt_count == tt_tot)
1245 @@ -2307,7 +2296,6 @@ static uint16_t batadv_tt_set_flags(struct batadv_hashtable *hash,
1247 uint16_t changed_num = 0;
1248 struct hlist_head *head;
1249 - struct hlist_node *node;
1250 struct batadv_tt_common_entry *tt_common_entry;
1253 @@ -2317,7 +2305,7 @@ static uint16_t batadv_tt_set_flags(struct batadv_hashtable *hash,
1254 head = &hash->table[i];
1257 - hlist_for_each_entry_rcu(tt_common_entry, node,
1258 + hlist_for_each_entry_rcu(tt_common_entry,
1261 if ((tt_common_entry->flags & flags) == flags)
1262 @@ -2342,7 +2330,7 @@ static void batadv_tt_local_purge_pending_clients(struct batadv_priv *bat_priv)
1263 struct batadv_hashtable *hash = bat_priv->tt.local_hash;
1264 struct batadv_tt_common_entry *tt_common;
1265 struct batadv_tt_local_entry *tt_local;
1266 - struct hlist_node *node, *node_tmp;
1267 + struct hlist_node *node_tmp;
1268 struct hlist_head *head;
1269 spinlock_t *list_lock; /* protects write access to the hash lists */
1271 @@ -2355,7 +2343,7 @@ static void batadv_tt_local_purge_pending_clients(struct batadv_priv *bat_priv)
1272 list_lock = &hash->list_locks[i];
1274 spin_lock_bh(list_lock);
1275 - hlist_for_each_entry_safe(tt_common, node, node_tmp, head,
1276 + hlist_for_each_entry_safe(tt_common, node_tmp, head,
1278 if (!(tt_common->flags & BATADV_TT_CLIENT_PENDING))
1280 @@ -2365,7 +2353,7 @@ static void batadv_tt_local_purge_pending_clients(struct batadv_priv *bat_priv)
1283 atomic_dec(&bat_priv->tt.local_entry_num);
1284 - hlist_del_rcu(node);
1285 + hlist_del_rcu(&tt_common->hash_entry);
1286 tt_local = container_of(tt_common,
1287 struct batadv_tt_local_entry,
1289 diff --git a/vis.c b/vis.c
1290 index 22d2785..c053244 100644
1293 @@ -97,7 +97,6 @@ batadv_vis_hash_find(struct batadv_priv *bat_priv, const void *data)
1295 struct batadv_hashtable *hash = bat_priv->vis.hash;
1296 struct hlist_head *head;
1297 - struct hlist_node *node;
1298 struct batadv_vis_info *vis_info, *vis_info_tmp = NULL;
1301 @@ -108,8 +107,8 @@ batadv_vis_hash_find(struct batadv_priv *bat_priv, const void *data)
1302 head = &hash->table[index];
1305 - hlist_for_each_entry_rcu(vis_info, node, head, hash_entry) {
1306 - if (!batadv_vis_info_cmp(node, data))
1307 + hlist_for_each_entry_rcu(vis_info, head, hash_entry) {
1308 + if (!batadv_vis_info_cmp(&vis_info->hash_entry, data))
1311 vis_info_tmp = vis_info;
1312 @@ -128,9 +127,8 @@ static void batadv_vis_data_insert_interface(const uint8_t *interface,
1315 struct batadv_vis_if_list_entry *entry;
1316 - struct hlist_node *pos;
1318 - hlist_for_each_entry(entry, pos, if_list, list) {
1319 + hlist_for_each_entry(entry, if_list, list) {
1320 if (batadv_compare_eth(entry->addr, interface))
1323 @@ -148,9 +146,8 @@ static void batadv_vis_data_read_prim_sec(struct seq_file *seq,
1324 const struct hlist_head *if_list)
1326 struct batadv_vis_if_list_entry *entry;
1327 - struct hlist_node *pos;
1329 - hlist_for_each_entry(entry, pos, if_list, list) {
1330 + hlist_for_each_entry(entry, if_list, list) {
1332 seq_printf(seq, "PRIMARY, ");
1334 @@ -198,9 +195,8 @@ static void batadv_vis_data_read_entries(struct seq_file *seq,
1337 struct batadv_vis_if_list_entry *entry;
1338 - struct hlist_node *pos;
1340 - hlist_for_each_entry(entry, pos, list, list) {
1341 + hlist_for_each_entry(entry, list, list) {
1342 seq_printf(seq, "%pM,", entry->addr);
1344 for (i = 0; i < packet->entries; i++)
1345 @@ -218,17 +214,16 @@ static void batadv_vis_data_read_entries(struct seq_file *seq,
1346 static void batadv_vis_seq_print_text_bucket(struct seq_file *seq,
1347 const struct hlist_head *head)
1349 - struct hlist_node *node;
1350 struct batadv_vis_info *info;
1351 struct batadv_vis_packet *packet;
1352 uint8_t *entries_pos;
1353 struct batadv_vis_info_entry *entries;
1354 struct batadv_vis_if_list_entry *entry;
1355 - struct hlist_node *pos, *n;
1356 + struct hlist_node *n;
1358 HLIST_HEAD(vis_if_list);
1360 - hlist_for_each_entry_rcu(info, node, head, hash_entry) {
1361 + hlist_for_each_entry_rcu(info, head, hash_entry) {
1362 packet = (struct batadv_vis_packet *)info->skb_packet->data;
1363 entries_pos = (uint8_t *)packet + sizeof(*packet);
1364 entries = (struct batadv_vis_info_entry *)entries_pos;
1365 @@ -240,7 +235,7 @@ static void batadv_vis_seq_print_text_bucket(struct seq_file *seq,
1366 batadv_vis_data_read_entries(seq, &vis_if_list, packet,
1369 - hlist_for_each_entry_safe(entry, pos, n, &vis_if_list, list) {
1370 + hlist_for_each_entry_safe(entry, n, &vis_if_list, list) {
1371 hlist_del(&entry->list);
1374 @@ -519,7 +514,6 @@ static int batadv_find_best_vis_server(struct batadv_priv *bat_priv,
1376 struct batadv_hashtable *hash = bat_priv->orig_hash;
1377 struct batadv_neigh_node *router;
1378 - struct hlist_node *node;
1379 struct hlist_head *head;
1380 struct batadv_orig_node *orig_node;
1381 struct batadv_vis_packet *packet;
1382 @@ -532,7 +526,7 @@ static int batadv_find_best_vis_server(struct batadv_priv *bat_priv,
1383 head = &hash->table[i];
1386 - hlist_for_each_entry_rcu(orig_node, node, head, hash_entry) {
1387 + hlist_for_each_entry_rcu(orig_node, head, hash_entry) {
1388 router = batadv_orig_node_get_router(orig_node);
1391 @@ -571,7 +565,6 @@ static bool batadv_vis_packet_full(const struct batadv_vis_info *info)
1392 static int batadv_generate_vis_packet(struct batadv_priv *bat_priv)
1394 struct batadv_hashtable *hash = bat_priv->orig_hash;
1395 - struct hlist_node *node;
1396 struct hlist_head *head;
1397 struct batadv_orig_node *orig_node;
1398 struct batadv_neigh_node *router;
1399 @@ -605,7 +598,7 @@ static int batadv_generate_vis_packet(struct batadv_priv *bat_priv)
1400 head = &hash->table[i];
1403 - hlist_for_each_entry_rcu(orig_node, node, head, hash_entry) {
1404 + hlist_for_each_entry_rcu(orig_node, head, hash_entry) {
1405 router = batadv_orig_node_get_router(orig_node);
1408 @@ -644,7 +637,7 @@ next:
1409 head = &hash->table[i];
1412 - hlist_for_each_entry_rcu(tt_common_entry, node, head,
1413 + hlist_for_each_entry_rcu(tt_common_entry, head,
1415 packet_pos = skb_put(info->skb_packet, sizeof(*entry));
1416 entry = (struct batadv_vis_info_entry *)packet_pos;
1417 @@ -673,14 +666,14 @@ static void batadv_purge_vis_packets(struct batadv_priv *bat_priv)
1420 struct batadv_hashtable *hash = bat_priv->vis.hash;
1421 - struct hlist_node *node, *node_tmp;
1422 + struct hlist_node *node_tmp;
1423 struct hlist_head *head;
1424 struct batadv_vis_info *info;
1426 for (i = 0; i < hash->size; i++) {
1427 head = &hash->table[i];
1429 - hlist_for_each_entry_safe(info, node, node_tmp,
1430 + hlist_for_each_entry_safe(info, node_tmp,
1432 /* never purge own data. */
1433 if (info == bat_priv->vis.my_info)
1434 @@ -688,7 +681,7 @@ static void batadv_purge_vis_packets(struct batadv_priv *bat_priv)
1436 if (batadv_has_timed_out(info->first_seen,
1437 BATADV_VIS_TIMEOUT)) {
1439 + hlist_del(&info->hash_entry);
1440 batadv_send_list_del(info);
1441 kref_put(&info->refcount, batadv_free_info);
1443 @@ -700,7 +693,6 @@ static void batadv_broadcast_vis_packet(struct batadv_priv *bat_priv,
1444 struct batadv_vis_info *info)
1446 struct batadv_hashtable *hash = bat_priv->orig_hash;
1447 - struct hlist_node *node;
1448 struct hlist_head *head;
1449 struct batadv_orig_node *orig_node;
1450 struct batadv_vis_packet *packet;
1451 @@ -715,7 +707,7 @@ static void batadv_broadcast_vis_packet(struct batadv_priv *bat_priv,
1452 head = &hash->table[i];
1455 - hlist_for_each_entry_rcu(orig_node, node, head, hash_entry) {
1456 + hlist_for_each_entry_rcu(orig_node, head, hash_entry) {
1457 /* if it's a vis server and reachable, send it. */
1458 if (!(orig_node->flags & BATADV_VIS_SERVER))