packages: consistently use 'depends on' instead of 'depends'
[feed/routing.git] / patches / 0002-batman-adv-hlist-drop-the-node-parameter-from-iterators.patch
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
5
6 I'm not sure why, but the hlist for each entry iterators were conceived
7
8 list_for_each_entry(pos, head, member)
9
10 The hlist ones were greedy and wanted an extra parameter:
11
12 hlist_for_each_entry(tpos, pos, head, member)
13
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.
17
18 Besides the semantic patch, there was some manual work required:
19
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.
26
27 The semantic patch which is mostly the work of Peter Senna Tschudin is here:
28
29 @@
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;
31
32 type T;
33 expression a,c,d,e;
34 identifier b;
35 statement S;
36 @@
37
38 -T b;
39 <+... when != b
40 (
41 hlist_for_each_entry(a,
42 - b,
43 c, d) S
44 |
45 hlist_for_each_entry_continue(a,
46 - b,
47 c) S
48 |
49 hlist_for_each_entry_from(a,
50 - b,
51 c) S
52 |
53 hlist_for_each_entry_rcu(a,
54 - b,
55 c, d) S
56 |
57 hlist_for_each_entry_rcu_bh(a,
58 - b,
59 c, d) S
60 |
61 hlist_for_each_entry_continue_rcu_bh(a,
62 - b,
63 c) S
64 |
65 for_each_busy_worker(a, c,
66 - b,
67 d) S
68 |
69 ax25_uid_for_each(a,
70 - b,
71 c) S
72 |
73 ax25_for_each(a,
74 - b,
75 c) S
76 |
77 inet_bind_bucket_for_each(a,
78 - b,
79 c) S
80 |
81 sctp_for_each_hentry(a,
82 - b,
83 c) S
84 |
85 sk_for_each(a,
86 - b,
87 c) S
88 |
89 sk_for_each_rcu(a,
90 - b,
91 c) S
92 |
93 sk_for_each_from
94 -(a, b)
95 +(a)
96 S
97 + sk_for_each_from(a) S
98 |
99 sk_for_each_safe(a,
100 - b,
101 c, d) S
102 |
103 sk_for_each_bound(a,
104 - b,
105 c) S
106 |
107 hlist_for_each_entry_safe(a,
108 - b,
109 c, d, e) S
110 |
111 hlist_for_each_entry_continue_rcu(a,
112 - b,
113 c) S
114 |
115 nr_neigh_for_each(a,
116 - b,
117 c) S
118 |
119 nr_neigh_for_each_safe(a,
120 - b,
121 c, d) S
122 |
123 nr_node_for_each(a,
124 - b,
125 c) S
126 |
127 nr_node_for_each_safe(a,
128 - b,
129 c, d) S
130 |
131 - for_each_gfn_sp(a, c, d, b) S
132 + for_each_gfn_sp(a, c, d) S
133 |
134 - for_each_gfn_indirect_valid_sp(a, c, d, b) S
135 + for_each_gfn_indirect_valid_sp(a, c, d) S
136 |
137 for_each_host(a,
138 - b,
139 c) S
140 |
141 for_each_host_safe(a,
142 - b,
143 c, d) S
144 |
145 for_each_mesh_entry(a,
146 - b,
147 c, d) S
148 )
149 ...+>
150
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>
165 ---
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 +++-----
171 main.c | 6 ++--
172 originator.c | 31 ++++++++----------
173 originator.h | 3 +-
174 routing.c | 6 ++--
175 send.c | 6 ++--
176 translation-table.c | 82 ++++++++++++++++++++---------------------------
177 vis.c | 38 +++++++++-------------
178 12 files changed, 125 insertions(+), 149 deletions(-)
179
180 diff --git a/bat_iv_ogm.c b/bat_iv_ogm.c
181 index d5be889..a5bb0a7 100644
182 --- a/bat_iv_ogm.c
183 +++ b/bat_iv_ogm.c
184 @@ -487,7 +487,6 @@ static void batadv_iv_ogm_queue_add(struct batadv_priv *bat_priv,
185 */
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;
190 bool direct_link;
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;
206 int if_num;
207 uint8_t sum_orig, sum_neigh;
208 uint8_t *neigh_addr;
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");
211
212 rcu_read_lock();
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,
219 {
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;
223 uint8_t total_count;
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,
227
228 /* find corresponding one hop neighbor */
229 rcu_read_lock();
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;
241 int32_t seq_diff;
242 int need_update = 0;
243 @@ -943,7 +939,7 @@ batadv_iv_ogm_update_seqnos(const struct ethhdr *ethhdr,
244 goto out;
245
246 rcu_read_lock();
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
257 {
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;
263 int index;
264 @@ -156,7 +155,7 @@ static struct batadv_bla_claim
265 head = &hash->table[index];
266
267 rcu_read_lock();
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))
271 continue;
272
273 @@ -185,7 +184,6 @@ batadv_backbone_hash_find(struct batadv_priv *bat_priv,
274 {
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;
280 int index;
281 @@ -200,7 +198,7 @@ batadv_backbone_hash_find(struct batadv_priv *bat_priv,
282 head = &hash->table[index];
283
284 rcu_read_lock();
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,
288 &search_entry))
289 continue;
290 @@ -221,7 +219,7 @@ static void
291 batadv_bla_del_backbone_claims(struct batadv_bla_backbone_gw *backbone_gw)
292 {
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;
298 int i;
299 @@ -236,13 +234,13 @@ batadv_bla_del_backbone_claims(struct batadv_bla_backbone_gw *backbone_gw)
300 list_lock = &hash->list_locks[i];
301
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,
305 head, hash_entry) {
306 if (claim->backbone_gw != backbone_gw)
307 continue;
308
309 batadv_claim_free_ref(claim);
310 - hlist_del_rcu(node);
311 + hlist_del_rcu(&claim->hash_entry);
312 }
313 spin_unlock_bh(list_lock);
314 }
315 @@ -460,7 +458,6 @@ static void batadv_bla_answer_request(struct batadv_priv *bat_priv,
316 struct batadv_hard_iface *primary_if,
317 short vid)
318 {
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];
325
326 rcu_read_lock();
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)
331 continue;
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)
334 {
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];
343
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,
347 head, hash_entry) {
348 if (now)
349 goto purge_now;
350 @@ -992,7 +989,7 @@ purge_now:
351
352 batadv_bla_del_backbone_claims(backbone_gw);
353
354 - hlist_del_rcu(node);
355 + hlist_del_rcu(&backbone_gw->hash_entry);
356 batadv_backbone_gw_free_ref(backbone_gw);
357 }
358 spin_unlock_bh(list_lock);
359 @@ -1013,7 +1010,6 @@ static void batadv_bla_purge_claims(struct batadv_priv *bat_priv,
360 int now)
361 {
362 struct batadv_bla_claim *claim;
363 - struct hlist_node *node;
364 struct hlist_head *head;
365 struct batadv_hashtable *hash;
366 int i;
367 @@ -1026,7 +1022,7 @@ static void batadv_bla_purge_claims(struct batadv_priv *bat_priv,
368 head = &hash->table[i];
369
370 rcu_read_lock();
371 - hlist_for_each_entry_rcu(claim, node, head, hash_entry) {
372 + hlist_for_each_entry_rcu(claim, head, hash_entry) {
373 if (now)
374 goto purge_now;
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)
378 {
379 struct batadv_bla_backbone_gw *backbone_gw;
380 - struct hlist_node *node;
381 struct hlist_head *head;
382 struct batadv_hashtable *hash;
383 __be16 group;
384 @@ -1086,7 +1081,7 @@ void batadv_bla_update_orig_address(struct batadv_priv *bat_priv,
385 head = &hash->table[i];
386
387 rcu_read_lock();
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];
403
404 rcu_read_lock();
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))
409 continue;
410 @@ -1322,7 +1316,6 @@ int batadv_bla_is_backbone_gw_orig(struct batadv_priv *bat_priv, uint8_t *orig)
411 {
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;
416 int i;
417
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];
420
421 rcu_read_lock();
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)) {
425 rcu_read_unlock();
426 return 1;
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;
433 uint32_t i;
434 bool is_own;
435 @@ -1628,7 +1620,7 @@ int batadv_bla_claim_table_seq_print_text(struct seq_file *seq, void *offset)
436 head = &hash->table[i];
437
438 rcu_read_lock();
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,
442 primary_addr);
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;
450 int secs, msecs;
451 uint32_t i;
452 @@ -1674,7 +1665,7 @@ int batadv_bla_backbone_table_seq_print_text(struct seq_file *seq, void *offset)
453 head = &hash->table[i];
454
455 rcu_read_lock();
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);
460 secs = msecs / 1000;
461 diff --git a/compat.h b/compat.h
462 index e21b310..22ab781 100644
463 --- a/compat.h
464 +++ b/compat.h
465 @@ -211,6 +211,29 @@ static int batadv_interface_set_mac_addr(struct net_device *dev, void *p) \
466 }\
467 static int __batadv_interface_set_mac_addr(x, y)
468
469 +#define hlist_entry_safe(ptr, type, member) \
470 + (ptr) ? hlist_entry(ptr, type, member) : NULL
471 +
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);\
475 + pos; \
476 + pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member))
477 +
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); \
482 + pos; \
483 + pos = hlist_entry_safe(rcu_dereference_raw(hlist_next_rcu(\
484 + &(pos)->member)), typeof(*(pos)), member))
485 +
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))
491 +
492 #endif /* < KERNEL_VERSION(3, 9, 0) */
493
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,
500 {
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;
506 uint32_t i;
507
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];
510
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,
514 hash_entry) {
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))
519 continue;
520
521 - hlist_del_rcu(node);
522 + hlist_del_rcu(&dat_entry->hash_entry);
523 batadv_dat_entry_free_ref(dat_entry);
524 }
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)
528 {
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;
533 uint32_t index;
534 @@ -247,7 +246,7 @@ batadv_dat_entry_hash_find(struct batadv_priv *bat_priv, __be32 ip)
535 head = &hash->table[index];
536
537 rcu_read_lock();
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)
541 continue;
542
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;
549 int i;
550
551 @@ -481,7 +479,7 @@ static void batadv_choose_next_candidate(struct batadv_priv *bat_priv,
552 head = &hash->table[i];
553
554 rcu_read_lock();
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 +
559 ip_key;
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];
570
571 rcu_read_lock();
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)
583 {
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;
588 uint32_t gw_divisor;
589 @@ -127,7 +126,7 @@ batadv_gw_get_best_gw_node(struct batadv_priv *bat_priv)
590 gw_divisor *= 64;
591
592 rcu_read_lock();
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)
596 continue;
597
598 @@ -344,7 +343,6 @@ void batadv_gw_node_update(struct batadv_priv *bat_priv,
599 struct batadv_orig_node *orig_node,
600 uint8_t new_gwflags)
601 {
602 - struct hlist_node *node;
603 struct batadv_gw_node *gw_node, *curr_gw;
604
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);
608
609 rcu_read_lock();
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)
613 continue;
614
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)
617 {
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);
622 int do_deselect = 0;
623
624 @@ -411,7 +409,7 @@ void batadv_gw_node_purge(struct batadv_priv *bat_priv)
625
626 spin_lock_bh(&bat_priv->gw.list_lock);
627
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;
638 int gw_count = 0;
639
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);
643
644 rcu_read_lock();
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)
648 continue;
649
650 diff --git a/main.c b/main.c
651 index 21fe698..0488d70 100644
652 --- a/main.c
653 +++ b/main.c
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)
656 {
657 struct batadv_algo_ops *bat_algo_ops = NULL, *bat_algo_ops_tmp;
658 - struct hlist_node *node;
659
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)
663 continue;
664
665 @@ -411,11 +410,10 @@ out:
666 int batadv_algo_seq_print_text(struct seq_file *seq, void *offset)
667 {
668 struct batadv_algo_ops *bat_algo_ops;
669 - struct hlist_node *node;
670
671 seq_printf(seq, "Available routing algorithms:\n");
672
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);
676 }
677
678 diff --git a/originator.c b/originator.c
679 index 457ea44..96fb80b 100644
680 --- a/originator.c
681 +++ b/originator.c
682 @@ -118,7 +118,7 @@ out:
683
684 static void batadv_orig_node_free_rcu(struct rcu_head *rcu)
685 {
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;
690
691 @@ -134,7 +134,7 @@ static void batadv_orig_node_free_rcu(struct rcu_head *rcu)
692 }
693
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)
702 {
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];
711
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,
715 head, hash_entry) {
716 - hlist_del_rcu(node);
717 + hlist_del_rcu(&orig_node->hash_entry);
718 batadv_orig_node_free_ref(orig_node);
719 }
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)
724 {
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);
732
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)
741 {
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];
750
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,
754 head, hash_entry) {
755 if (batadv_purge_orig_node(bat_priv, orig_node)) {
756 if (orig_node->gw_flags)
757 batadv_gw_node_delete(bat_priv,
758 orig_node);
759 - hlist_del_rcu(node);
760 + hlist_del_rcu(&orig_node->hash_entry);
761 batadv_orig_node_free_ref(orig_node);
762 continue;
763 }
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];
774
775 rcu_read_lock();
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);
779 if (!neigh_node)
780 continue;
781 @@ -453,7 +452,7 @@ int batadv_orig_seq_print_text(struct seq_file *seq, void *offset)
782 neigh_node->addr,
783 neigh_node->if_incoming->net_dev->name);
784
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,
791 {
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;
797 uint32_t i;
798 @@ -524,7 +522,7 @@ int batadv_orig_hash_add_if(struct batadv_hard_iface *hard_iface,
799 head = &hash->table[i];
800
801 rcu_read_lock();
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,
808 {
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];
817
818 rcu_read_lock();
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,
823 hard_iface->if_num);
824 diff --git a/originator.h b/originator.h
825 index 286bf74..7df48fa 100644
826 --- a/originator.h
827 +++ b/originator.h
828 @@ -68,7 +68,6 @@ batadv_orig_hash_find(struct batadv_priv *bat_priv, const void *data)
829 {
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;
834 int index;
835
836 @@ -79,7 +78,7 @@ batadv_orig_hash_find(struct batadv_priv *bat_priv, const void *data)
837 head = &hash->table[index];
838
839 rcu_read_lock();
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))
843 continue;
844
845 diff --git a/routing.c b/routing.c
846 index 60ba03f..5ee21ce 100644
847 --- a/routing.c
848 +++ b/routing.c
849 @@ -37,7 +37,6 @@ void batadv_slide_own_bcast_window(struct batadv_hard_iface *hard_iface)
850 {
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;
856 unsigned long *word;
857 @@ -49,7 +48,7 @@ void batadv_slide_own_bcast_window(struct batadv_hard_iface *hard_iface)
858 head = &hash->table[i];
859
860 rcu_read_lock();
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)
869 {
870 - struct hlist_node *node;
871 struct batadv_neigh_node *tmp_neigh_node, *router = NULL;
872 uint8_t interference_candidate = 0;
873
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.
877 */
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)
882 continue;
883 diff --git a/send.c b/send.c
884 index 80ca65f..a67cffd 100644
885 --- a/send.c
886 +++ b/send.c
887 @@ -316,7 +316,7 @@ batadv_purge_outstanding_packets(struct batadv_priv *bat_priv,
888 const struct batadv_hard_iface *hard_iface)
889 {
890 struct batadv_forw_packet *forw_packet;
891 - struct hlist_node *tmp_node, *safe_tmp_node;
892 + struct hlist_node *safe_tmp_node;
893 bool pending;
894
895 if (hard_iface)
896 @@ -329,7 +329,7 @@ batadv_purge_outstanding_packets(struct batadv_priv *bat_priv,
897
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,
906
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)
920 {
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;
925 uint32_t index;
926 @@ -68,7 +67,7 @@ batadv_tt_hash_find(struct batadv_hashtable *hash, const void *data)
927 head = &hash->table[index];
928
929 rcu_read_lock();
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))
933 continue;
934
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;
941 int hash_added;
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;
946 rcu_read_lock();
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);
951 }
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;
958 uint32_t i;
959 int last_seen_secs;
960 @@ -494,7 +491,7 @@ int batadv_tt_local_seq_print_text(struct seq_file *seq, void *offset)
961 head = &hash->table[i];
962
963 rcu_read_lock();
964 - hlist_for_each_entry_rcu(tt_common_entry, node,
965 + hlist_for_each_entry_rcu(tt_common_entry,
966 head, hash_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,
970 {
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;
975
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,
978 hash_entry) {
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;
988 uint32_t i;
989
990 @@ -665,9 +662,9 @@ static void batadv_tt_local_table_free(struct batadv_priv *bat_priv)
991 list_lock = &hash->list_locks[i];
992
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,
996 head, hash_entry) {
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,
1001 common);
1002 @@ -724,11 +721,10 @@ batadv_tt_global_orig_entry_find(const struct batadv_tt_global_entry *entry,
1003 {
1004 struct batadv_tt_orig_list_entry *tmp_orig_entry, *orig_entry = NULL;
1005 const struct hlist_head *head;
1006 - struct hlist_node *node;
1007
1008 rcu_read_lock();
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)
1013 continue;
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)
1016 {
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;
1021 int best_tq = 0;
1022
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);
1027 if (!router)
1028 continue;
1029 @@ -973,7 +968,6 @@ batadv_tt_global_print_entry(struct batadv_tt_global_entry *tt_global_entry,
1030 struct seq_file *seq)
1031 {
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;
1036 uint16_t flags;
1037 @@ -997,7 +991,7 @@ batadv_tt_global_print_entry(struct batadv_tt_global_entry *tt_global_entry,
1038
1039 head = &tt_global_entry->orig_list;
1040
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)
1044 continue;
1045
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;
1052 uint32_t i;
1053
1054 @@ -1039,7 +1032,7 @@ int batadv_tt_global_seq_print_text(struct seq_file *seq, void *offset)
1055 head = &hash->table[i];
1056
1057 rcu_read_lock();
1058 - hlist_for_each_entry_rcu(tt_common_entry, node,
1059 + hlist_for_each_entry_rcu(tt_common_entry,
1060 head, hash_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)
1065 {
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;
1070
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);
1078 }
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)
1082 {
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;
1087
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",
1095 orig_node->orig,
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);
1100 }
1101 }
1102 @@ -1108,7 +1101,6 @@ batadv_tt_global_del_roaming(struct batadv_priv *bat_priv,
1103 {
1104 bool last_entry = true;
1105 struct hlist_head *head;
1106 - struct hlist_node *node;
1107 struct batadv_tt_orig_list_entry *orig_entry;
1108
1109 /* no local entry exists, case 1:
1110 @@ -1117,7 +1109,7 @@ batadv_tt_global_del_roaming(struct batadv_priv *bat_priv,
1111
1112 rcu_read_lock();
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) {
1117 last_entry = false;
1118 break;
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;
1121 uint32_t i;
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 */
1127
1128 @@ -1214,7 +1206,7 @@ void batadv_tt_global_del_orig(struct batadv_priv *bat_priv,
1129 list_lock = &hash->list_locks[i];
1130
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,
1134 head, hash_entry) {
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);
1144 }
1145 }
1146 @@ -1262,7 +1254,7 @@ static void batadv_tt_global_purge(struct batadv_priv *bat_priv)
1147 {
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 */
1153 uint32_t i;
1154 char *msg = NULL;
1155 @@ -1274,7 +1266,7 @@ static void batadv_tt_global_purge(struct batadv_priv *bat_priv)
1156 list_lock = &hash->list_locks[i];
1157
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,
1161 hash_entry) {
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);
1167
1168 - hlist_del_rcu(node);
1169 + hlist_del_rcu(&tt_common->hash_entry);
1170
1171 batadv_tt_global_entry_free_ref(tt_global);
1172 }
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;
1180 uint32_t i;
1181
1182 @@ -1315,9 +1307,9 @@ static void batadv_tt_global_table_free(struct batadv_priv *bat_priv)
1183 list_lock = &hash->list_locks[i];
1184
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,
1188 head, hash_entry) {
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,
1193 common);
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;
1200 uint32_t i;
1201 int j;
1202 @@ -1406,7 +1397,7 @@ static uint16_t batadv_tt_global_crc(struct batadv_priv *bat_priv,
1203 head = &hash->table[i];
1204
1205 rcu_read_lock();
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,
1210 common);
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;
1217 uint32_t i;
1218 int j;
1219 @@ -1458,7 +1448,7 @@ static uint16_t batadv_tt_local_crc(struct batadv_priv *bat_priv)
1220 head = &hash->table[i];
1221
1222 rcu_read_lock();
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
1227 */
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];
1239
1240 - hlist_for_each_entry_rcu(tt_common_entry, node,
1241 + hlist_for_each_entry_rcu(tt_common_entry,
1242 head, hash_entry) {
1243 if (tt_count == tt_tot)
1244 break;
1245 @@ -2307,7 +2296,6 @@ static uint16_t batadv_tt_set_flags(struct batadv_hashtable *hash,
1246 uint32_t i;
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;
1251
1252 if (!hash)
1253 @@ -2317,7 +2305,7 @@ static uint16_t batadv_tt_set_flags(struct batadv_hashtable *hash,
1254 head = &hash->table[i];
1255
1256 rcu_read_lock();
1257 - hlist_for_each_entry_rcu(tt_common_entry, node,
1258 + hlist_for_each_entry_rcu(tt_common_entry,
1259 head, hash_entry) {
1260 if (enable) {
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 */
1270 uint32_t i;
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];
1273
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,
1277 hash_entry) {
1278 if (!(tt_common->flags & BATADV_TT_CLIENT_PENDING))
1279 continue;
1280 @@ -2365,7 +2353,7 @@ static void batadv_tt_local_purge_pending_clients(struct batadv_priv *bat_priv)
1281 tt_common->addr);
1282
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,
1288 common);
1289 diff --git a/vis.c b/vis.c
1290 index 22d2785..c053244 100644
1291 --- a/vis.c
1292 +++ b/vis.c
1293 @@ -97,7 +97,6 @@ batadv_vis_hash_find(struct batadv_priv *bat_priv, const void *data)
1294 {
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;
1299 uint32_t index;
1300
1301 @@ -108,8 +107,8 @@ batadv_vis_hash_find(struct batadv_priv *bat_priv, const void *data)
1302 head = &hash->table[index];
1303
1304 rcu_read_lock();
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))
1309 continue;
1310
1311 vis_info_tmp = vis_info;
1312 @@ -128,9 +127,8 @@ static void batadv_vis_data_insert_interface(const uint8_t *interface,
1313 bool primary)
1314 {
1315 struct batadv_vis_if_list_entry *entry;
1316 - struct hlist_node *pos;
1317
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))
1321 return;
1322 }
1323 @@ -148,9 +146,8 @@ static void batadv_vis_data_read_prim_sec(struct seq_file *seq,
1324 const struct hlist_head *if_list)
1325 {
1326 struct batadv_vis_if_list_entry *entry;
1327 - struct hlist_node *pos;
1328
1329 - hlist_for_each_entry(entry, pos, if_list, list) {
1330 + hlist_for_each_entry(entry, if_list, list) {
1331 if (entry->primary)
1332 seq_printf(seq, "PRIMARY, ");
1333 else
1334 @@ -198,9 +195,8 @@ static void batadv_vis_data_read_entries(struct seq_file *seq,
1335 {
1336 int i;
1337 struct batadv_vis_if_list_entry *entry;
1338 - struct hlist_node *pos;
1339
1340 - hlist_for_each_entry(entry, pos, list, list) {
1341 + hlist_for_each_entry(entry, list, list) {
1342 seq_printf(seq, "%pM,", entry->addr);
1343
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)
1348 {
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;
1357
1358 HLIST_HEAD(vis_if_list);
1359
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,
1367 entries);
1368
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);
1372 kfree(entry);
1373 }
1374 @@ -519,7 +514,6 @@ static int batadv_find_best_vis_server(struct batadv_priv *bat_priv,
1375 {
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];
1384
1385 rcu_read_lock();
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);
1389 if (!router)
1390 continue;
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)
1393 {
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];
1401
1402 rcu_read_lock();
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);
1406 if (!router)
1407 continue;
1408 @@ -644,7 +637,7 @@ next:
1409 head = &hash->table[i];
1410
1411 rcu_read_lock();
1412 - hlist_for_each_entry_rcu(tt_common_entry, node, head,
1413 + hlist_for_each_entry_rcu(tt_common_entry, head,
1414 hash_entry) {
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)
1418 {
1419 uint32_t i;
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;
1425
1426 for (i = 0; i < hash->size; i++) {
1427 head = &hash->table[i];
1428
1429 - hlist_for_each_entry_safe(info, node, node_tmp,
1430 + hlist_for_each_entry_safe(info, node_tmp,
1431 head, hash_entry) {
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)
1435
1436 if (batadv_has_timed_out(info->first_seen,
1437 BATADV_VIS_TIMEOUT)) {
1438 - hlist_del(node);
1439 + hlist_del(&info->hash_entry);
1440 batadv_send_list_del(info);
1441 kref_put(&info->refcount, batadv_free_info);
1442 }
1443 @@ -700,7 +693,6 @@ static void batadv_broadcast_vis_packet(struct batadv_priv *bat_priv,
1444 struct batadv_vis_info *info)
1445 {
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];
1453
1454 rcu_read_lock();
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))
1459 continue;
1460 --
1461 1.7.10.4
1462