diff options
author | Sasha Levin <sasha.levin@oracle.com> | 2013-02-27 20:06:00 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-02-27 22:10:24 -0500 |
commit | b67bfe0d42cac56c512dd5da4b1b347a23f4b70a (patch) | |
tree | 3d465aea12b97683f26ffa38eba8744469de9997 /drivers | |
parent | 1e142b29e210b5dfb2deeb6ce2210b60af16d2a6 (diff) |
hlist: drop the node parameter from iterators
I'm not sure why, but the hlist for each entry iterators were conceived
list_for_each_entry(pos, head, member)
The hlist ones were greedy and wanted an extra parameter:
hlist_for_each_entry(tpos, pos, head, member)
Why did they need an extra pos parameter? I'm not quite sure. Not only
they don't really need it, it also prevents the iterator from looking
exactly like the list iterator, which is unfortunate.
Besides the semantic patch, there was some manual work required:
- Fix up the actual hlist iterators in linux/list.h
- Fix up the declaration of other iterators based on the hlist ones.
- A very small amount of places were using the 'node' parameter, this
was modified to use 'obj->member' instead.
- Coccinelle didn't handle the hlist_for_each_entry_safe iterator
properly, so those had to be fixed up manually.
The semantic patch which is mostly the work of Peter Senna Tschudin is here:
@@
iterator name hlist_for_each_entry, hlist_for_each_entry_continue, hlist_for_each_entry_from, hlist_for_each_entry_rcu, hlist_for_each_entry_rcu_bh, hlist_for_each_entry_continue_rcu_bh, for_each_busy_worker, ax25_uid_for_each, ax25_for_each, inet_bind_bucket_for_each, sctp_for_each_hentry, sk_for_each, sk_for_each_rcu, sk_for_each_from, sk_for_each_safe, sk_for_each_bound, hlist_for_each_entry_safe, hlist_for_each_entry_continue_rcu, nr_neigh_for_each, nr_neigh_for_each_safe, nr_node_for_each, nr_node_for_each_safe, for_each_gfn_indirect_valid_sp, for_each_gfn_sp, for_each_host;
type T;
expression a,c,d,e;
identifier b;
statement S;
@@
-T b;
<+... when != b
(
hlist_for_each_entry(a,
- b,
c, d) S
|
hlist_for_each_entry_continue(a,
- b,
c) S
|
hlist_for_each_entry_from(a,
- b,
c) S
|
hlist_for_each_entry_rcu(a,
- b,
c, d) S
|
hlist_for_each_entry_rcu_bh(a,
- b,
c, d) S
|
hlist_for_each_entry_continue_rcu_bh(a,
- b,
c) S
|
for_each_busy_worker(a, c,
- b,
d) S
|
ax25_uid_for_each(a,
- b,
c) S
|
ax25_for_each(a,
- b,
c) S
|
inet_bind_bucket_for_each(a,
- b,
c) S
|
sctp_for_each_hentry(a,
- b,
c) S
|
sk_for_each(a,
- b,
c) S
|
sk_for_each_rcu(a,
- b,
c) S
|
sk_for_each_from
-(a, b)
+(a)
S
+ sk_for_each_from(a) S
|
sk_for_each_safe(a,
- b,
c, d) S
|
sk_for_each_bound(a,
- b,
c) S
|
hlist_for_each_entry_safe(a,
- b,
c, d, e) S
|
hlist_for_each_entry_continue_rcu(a,
- b,
c) S
|
nr_neigh_for_each(a,
- b,
c) S
|
nr_neigh_for_each_safe(a,
- b,
c, d) S
|
nr_node_for_each(a,
- b,
c) S
|
nr_node_for_each_safe(a,
- b,
c, d) S
|
- for_each_gfn_sp(a, c, d, b) S
+ for_each_gfn_sp(a, c, d) S
|
- for_each_gfn_indirect_valid_sp(a, c, d, b) S
+ for_each_gfn_indirect_valid_sp(a, c, d) S
|
for_each_host(a,
- b,
c) S
|
for_each_host_safe(a,
- b,
c, d) S
|
for_each_mesh_entry(a,
- b,
c, d) S
)
...+>
[akpm@linux-foundation.org: drop bogus change from net/ipv4/raw.c]
[akpm@linux-foundation.org: drop bogus hunk from net/ipv6/raw.c]
[akpm@linux-foundation.org: checkpatch fixes]
[akpm@linux-foundation.org: fix warnings]
[akpm@linux-foudnation.org: redo intrusive kvm changes]
Tested-by: Peter Senna Tschudin <peter.senna@gmail.com>
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Cc: Wu Fengguang <fengguang.wu@intel.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers')
32 files changed, 117 insertions, 176 deletions
diff --git a/drivers/atm/atmtcp.c b/drivers/atm/atmtcp.c index b22d71cac54c..0e3f8f9dcd29 100644 --- a/drivers/atm/atmtcp.c +++ b/drivers/atm/atmtcp.c | |||
@@ -157,7 +157,6 @@ static int atmtcp_v_ioctl(struct atm_dev *dev,unsigned int cmd,void __user *arg) | |||
157 | { | 157 | { |
158 | struct atm_cirange ci; | 158 | struct atm_cirange ci; |
159 | struct atm_vcc *vcc; | 159 | struct atm_vcc *vcc; |
160 | struct hlist_node *node; | ||
161 | struct sock *s; | 160 | struct sock *s; |
162 | int i; | 161 | int i; |
163 | 162 | ||
@@ -171,7 +170,7 @@ static int atmtcp_v_ioctl(struct atm_dev *dev,unsigned int cmd,void __user *arg) | |||
171 | for(i = 0; i < VCC_HTABLE_SIZE; ++i) { | 170 | for(i = 0; i < VCC_HTABLE_SIZE; ++i) { |
172 | struct hlist_head *head = &vcc_hash[i]; | 171 | struct hlist_head *head = &vcc_hash[i]; |
173 | 172 | ||
174 | sk_for_each(s, node, head) { | 173 | sk_for_each(s, head) { |
175 | vcc = atm_sk(s); | 174 | vcc = atm_sk(s); |
176 | if (vcc->dev != dev) | 175 | if (vcc->dev != dev) |
177 | continue; | 176 | continue; |
@@ -264,12 +263,11 @@ static struct atm_vcc *find_vcc(struct atm_dev *dev, short vpi, int vci) | |||
264 | { | 263 | { |
265 | struct hlist_head *head; | 264 | struct hlist_head *head; |
266 | struct atm_vcc *vcc; | 265 | struct atm_vcc *vcc; |
267 | struct hlist_node *node; | ||
268 | struct sock *s; | 266 | struct sock *s; |
269 | 267 | ||
270 | head = &vcc_hash[vci & (VCC_HTABLE_SIZE -1)]; | 268 | head = &vcc_hash[vci & (VCC_HTABLE_SIZE -1)]; |
271 | 269 | ||
272 | sk_for_each(s, node, head) { | 270 | sk_for_each(s, head) { |
273 | vcc = atm_sk(s); | 271 | vcc = atm_sk(s); |
274 | if (vcc->dev == dev && | 272 | if (vcc->dev == dev && |
275 | vcc->vci == vci && vcc->vpi == vpi && | 273 | vcc->vci == vci && vcc->vpi == vpi && |
diff --git a/drivers/atm/eni.c b/drivers/atm/eni.c index c1eb6fa8ac35..b1955ba40d63 100644 --- a/drivers/atm/eni.c +++ b/drivers/atm/eni.c | |||
@@ -2093,7 +2093,6 @@ static unsigned char eni_phy_get(struct atm_dev *dev,unsigned long addr) | |||
2093 | 2093 | ||
2094 | static int eni_proc_read(struct atm_dev *dev,loff_t *pos,char *page) | 2094 | static int eni_proc_read(struct atm_dev *dev,loff_t *pos,char *page) |
2095 | { | 2095 | { |
2096 | struct hlist_node *node; | ||
2097 | struct sock *s; | 2096 | struct sock *s; |
2098 | static const char *signal[] = { "LOST","unknown","okay" }; | 2097 | static const char *signal[] = { "LOST","unknown","okay" }; |
2099 | struct eni_dev *eni_dev = ENI_DEV(dev); | 2098 | struct eni_dev *eni_dev = ENI_DEV(dev); |
@@ -2171,7 +2170,7 @@ static int eni_proc_read(struct atm_dev *dev,loff_t *pos,char *page) | |||
2171 | for(i = 0; i < VCC_HTABLE_SIZE; ++i) { | 2170 | for(i = 0; i < VCC_HTABLE_SIZE; ++i) { |
2172 | struct hlist_head *head = &vcc_hash[i]; | 2171 | struct hlist_head *head = &vcc_hash[i]; |
2173 | 2172 | ||
2174 | sk_for_each(s, node, head) { | 2173 | sk_for_each(s, head) { |
2175 | struct eni_vcc *eni_vcc; | 2174 | struct eni_vcc *eni_vcc; |
2176 | int length; | 2175 | int length; |
2177 | 2176 | ||
diff --git a/drivers/atm/he.c b/drivers/atm/he.c index 72b6960fa95f..d6891267f5bb 100644 --- a/drivers/atm/he.c +++ b/drivers/atm/he.c | |||
@@ -329,7 +329,6 @@ __find_vcc(struct he_dev *he_dev, unsigned cid) | |||
329 | { | 329 | { |
330 | struct hlist_head *head; | 330 | struct hlist_head *head; |
331 | struct atm_vcc *vcc; | 331 | struct atm_vcc *vcc; |
332 | struct hlist_node *node; | ||
333 | struct sock *s; | 332 | struct sock *s; |
334 | short vpi; | 333 | short vpi; |
335 | int vci; | 334 | int vci; |
@@ -338,7 +337,7 @@ __find_vcc(struct he_dev *he_dev, unsigned cid) | |||
338 | vci = cid & ((1 << he_dev->vcibits) - 1); | 337 | vci = cid & ((1 << he_dev->vcibits) - 1); |
339 | head = &vcc_hash[vci & (VCC_HTABLE_SIZE -1)]; | 338 | head = &vcc_hash[vci & (VCC_HTABLE_SIZE -1)]; |
340 | 339 | ||
341 | sk_for_each(s, node, head) { | 340 | sk_for_each(s, head) { |
342 | vcc = atm_sk(s); | 341 | vcc = atm_sk(s); |
343 | if (vcc->dev == he_dev->atm_dev && | 342 | if (vcc->dev == he_dev->atm_dev && |
344 | vcc->vci == vci && vcc->vpi == vpi && | 343 | vcc->vci == vci && vcc->vpi == vpi && |
diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c index 0474a89170b9..32784d18d1f7 100644 --- a/drivers/atm/solos-pci.c +++ b/drivers/atm/solos-pci.c | |||
@@ -896,12 +896,11 @@ static struct atm_vcc *find_vcc(struct atm_dev *dev, short vpi, int vci) | |||
896 | { | 896 | { |
897 | struct hlist_head *head; | 897 | struct hlist_head *head; |
898 | struct atm_vcc *vcc = NULL; | 898 | struct atm_vcc *vcc = NULL; |
899 | struct hlist_node *node; | ||
900 | struct sock *s; | 899 | struct sock *s; |
901 | 900 | ||
902 | read_lock(&vcc_sklist_lock); | 901 | read_lock(&vcc_sklist_lock); |
903 | head = &vcc_hash[vci & (VCC_HTABLE_SIZE -1)]; | 902 | head = &vcc_hash[vci & (VCC_HTABLE_SIZE -1)]; |
904 | sk_for_each(s, node, head) { | 903 | sk_for_each(s, head) { |
905 | vcc = atm_sk(s); | 904 | vcc = atm_sk(s); |
906 | if (vcc->dev == dev && vcc->vci == vci && | 905 | if (vcc->dev == dev && vcc->vci == vci && |
907 | vcc->vpi == vpi && vcc->qos.rxtp.traffic_class != ATM_NONE && | 906 | vcc->vpi == vpi && vcc->qos.rxtp.traffic_class != ATM_NONE && |
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index fabbfe1a9253..ed87b2405806 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c | |||
@@ -52,31 +52,29 @@ static void clk_summary_show_subtree(struct seq_file *s, struct clk *c, | |||
52 | int level) | 52 | int level) |
53 | { | 53 | { |
54 | struct clk *child; | 54 | struct clk *child; |
55 | struct hlist_node *tmp; | ||
56 | 55 | ||
57 | if (!c) | 56 | if (!c) |
58 | return; | 57 | return; |
59 | 58 | ||
60 | clk_summary_show_one(s, c, level); | 59 | clk_summary_show_one(s, c, level); |
61 | 60 | ||
62 | hlist_for_each_entry(child, tmp, &c->children, child_node) | 61 | hlist_for_each_entry(child, &c->children, child_node) |
63 | clk_summary_show_subtree(s, child, level + 1); | 62 | clk_summary_show_subtree(s, child, level + 1); |
64 | } | 63 | } |
65 | 64 | ||
66 | static int clk_summary_show(struct seq_file *s, void *data) | 65 | static int clk_summary_show(struct seq_file *s, void *data) |
67 | { | 66 | { |
68 | struct clk *c; | 67 | struct clk *c; |
69 | struct hlist_node *tmp; | ||
70 | 68 | ||
71 | seq_printf(s, " clock enable_cnt prepare_cnt rate\n"); | 69 | seq_printf(s, " clock enable_cnt prepare_cnt rate\n"); |
72 | seq_printf(s, "---------------------------------------------------------------------\n"); | 70 | seq_printf(s, "---------------------------------------------------------------------\n"); |
73 | 71 | ||
74 | mutex_lock(&prepare_lock); | 72 | mutex_lock(&prepare_lock); |
75 | 73 | ||
76 | hlist_for_each_entry(c, tmp, &clk_root_list, child_node) | 74 | hlist_for_each_entry(c, &clk_root_list, child_node) |
77 | clk_summary_show_subtree(s, c, 0); | 75 | clk_summary_show_subtree(s, c, 0); |
78 | 76 | ||
79 | hlist_for_each_entry(c, tmp, &clk_orphan_list, child_node) | 77 | hlist_for_each_entry(c, &clk_orphan_list, child_node) |
80 | clk_summary_show_subtree(s, c, 0); | 78 | clk_summary_show_subtree(s, c, 0); |
81 | 79 | ||
82 | mutex_unlock(&prepare_lock); | 80 | mutex_unlock(&prepare_lock); |
@@ -111,14 +109,13 @@ static void clk_dump_one(struct seq_file *s, struct clk *c, int level) | |||
111 | static void clk_dump_subtree(struct seq_file *s, struct clk *c, int level) | 109 | static void clk_dump_subtree(struct seq_file *s, struct clk *c, int level) |
112 | { | 110 | { |
113 | struct clk *child; | 111 | struct clk *child; |
114 | struct hlist_node *tmp; | ||
115 | 112 | ||
116 | if (!c) | 113 | if (!c) |
117 | return; | 114 | return; |
118 | 115 | ||
119 | clk_dump_one(s, c, level); | 116 | clk_dump_one(s, c, level); |
120 | 117 | ||
121 | hlist_for_each_entry(child, tmp, &c->children, child_node) { | 118 | hlist_for_each_entry(child, &c->children, child_node) { |
122 | seq_printf(s, ","); | 119 | seq_printf(s, ","); |
123 | clk_dump_subtree(s, child, level + 1); | 120 | clk_dump_subtree(s, child, level + 1); |
124 | } | 121 | } |
@@ -129,21 +126,20 @@ static void clk_dump_subtree(struct seq_file *s, struct clk *c, int level) | |||
129 | static int clk_dump(struct seq_file *s, void *data) | 126 | static int clk_dump(struct seq_file *s, void *data) |
130 | { | 127 | { |
131 | struct clk *c; | 128 | struct clk *c; |
132 | struct hlist_node *tmp; | ||
133 | bool first_node = true; | 129 | bool first_node = true; |
134 | 130 | ||
135 | seq_printf(s, "{"); | 131 | seq_printf(s, "{"); |
136 | 132 | ||
137 | mutex_lock(&prepare_lock); | 133 | mutex_lock(&prepare_lock); |
138 | 134 | ||
139 | hlist_for_each_entry(c, tmp, &clk_root_list, child_node) { | 135 | hlist_for_each_entry(c, &clk_root_list, child_node) { |
140 | if (!first_node) | 136 | if (!first_node) |
141 | seq_printf(s, ","); | 137 | seq_printf(s, ","); |
142 | first_node = false; | 138 | first_node = false; |
143 | clk_dump_subtree(s, c, 0); | 139 | clk_dump_subtree(s, c, 0); |
144 | } | 140 | } |
145 | 141 | ||
146 | hlist_for_each_entry(c, tmp, &clk_orphan_list, child_node) { | 142 | hlist_for_each_entry(c, &clk_orphan_list, child_node) { |
147 | seq_printf(s, ","); | 143 | seq_printf(s, ","); |
148 | clk_dump_subtree(s, c, 0); | 144 | clk_dump_subtree(s, c, 0); |
149 | } | 145 | } |
@@ -222,7 +218,6 @@ out: | |||
222 | static int clk_debug_create_subtree(struct clk *clk, struct dentry *pdentry) | 218 | static int clk_debug_create_subtree(struct clk *clk, struct dentry *pdentry) |
223 | { | 219 | { |
224 | struct clk *child; | 220 | struct clk *child; |
225 | struct hlist_node *tmp; | ||
226 | int ret = -EINVAL;; | 221 | int ret = -EINVAL;; |
227 | 222 | ||
228 | if (!clk || !pdentry) | 223 | if (!clk || !pdentry) |
@@ -233,7 +228,7 @@ static int clk_debug_create_subtree(struct clk *clk, struct dentry *pdentry) | |||
233 | if (ret) | 228 | if (ret) |
234 | goto out; | 229 | goto out; |
235 | 230 | ||
236 | hlist_for_each_entry(child, tmp, &clk->children, child_node) | 231 | hlist_for_each_entry(child, &clk->children, child_node) |
237 | clk_debug_create_subtree(child, clk->dentry); | 232 | clk_debug_create_subtree(child, clk->dentry); |
238 | 233 | ||
239 | ret = 0; | 234 | ret = 0; |
@@ -299,7 +294,6 @@ out: | |||
299 | static int __init clk_debug_init(void) | 294 | static int __init clk_debug_init(void) |
300 | { | 295 | { |
301 | struct clk *clk; | 296 | struct clk *clk; |
302 | struct hlist_node *tmp; | ||
303 | struct dentry *d; | 297 | struct dentry *d; |
304 | 298 | ||
305 | rootdir = debugfs_create_dir("clk", NULL); | 299 | rootdir = debugfs_create_dir("clk", NULL); |
@@ -324,10 +318,10 @@ static int __init clk_debug_init(void) | |||
324 | 318 | ||
325 | mutex_lock(&prepare_lock); | 319 | mutex_lock(&prepare_lock); |
326 | 320 | ||
327 | hlist_for_each_entry(clk, tmp, &clk_root_list, child_node) | 321 | hlist_for_each_entry(clk, &clk_root_list, child_node) |
328 | clk_debug_create_subtree(clk, rootdir); | 322 | clk_debug_create_subtree(clk, rootdir); |
329 | 323 | ||
330 | hlist_for_each_entry(clk, tmp, &clk_orphan_list, child_node) | 324 | hlist_for_each_entry(clk, &clk_orphan_list, child_node) |
331 | clk_debug_create_subtree(clk, orphandir); | 325 | clk_debug_create_subtree(clk, orphandir); |
332 | 326 | ||
333 | inited = 1; | 327 | inited = 1; |
@@ -345,13 +339,12 @@ static inline int clk_debug_register(struct clk *clk) { return 0; } | |||
345 | static void clk_disable_unused_subtree(struct clk *clk) | 339 | static void clk_disable_unused_subtree(struct clk *clk) |
346 | { | 340 | { |
347 | struct clk *child; | 341 | struct clk *child; |
348 | struct hlist_node *tmp; | ||
349 | unsigned long flags; | 342 | unsigned long flags; |
350 | 343 | ||
351 | if (!clk) | 344 | if (!clk) |
352 | goto out; | 345 | goto out; |
353 | 346 | ||
354 | hlist_for_each_entry(child, tmp, &clk->children, child_node) | 347 | hlist_for_each_entry(child, &clk->children, child_node) |
355 | clk_disable_unused_subtree(child); | 348 | clk_disable_unused_subtree(child); |
356 | 349 | ||
357 | spin_lock_irqsave(&enable_lock, flags); | 350 | spin_lock_irqsave(&enable_lock, flags); |
@@ -384,14 +377,13 @@ out: | |||
384 | static int clk_disable_unused(void) | 377 | static int clk_disable_unused(void) |
385 | { | 378 | { |
386 | struct clk *clk; | 379 | struct clk *clk; |
387 | struct hlist_node *tmp; | ||
388 | 380 | ||
389 | mutex_lock(&prepare_lock); | 381 | mutex_lock(&prepare_lock); |
390 | 382 | ||
391 | hlist_for_each_entry(clk, tmp, &clk_root_list, child_node) | 383 | hlist_for_each_entry(clk, &clk_root_list, child_node) |
392 | clk_disable_unused_subtree(clk); | 384 | clk_disable_unused_subtree(clk); |
393 | 385 | ||
394 | hlist_for_each_entry(clk, tmp, &clk_orphan_list, child_node) | 386 | hlist_for_each_entry(clk, &clk_orphan_list, child_node) |
395 | clk_disable_unused_subtree(clk); | 387 | clk_disable_unused_subtree(clk); |
396 | 388 | ||
397 | mutex_unlock(&prepare_lock); | 389 | mutex_unlock(&prepare_lock); |
@@ -484,12 +476,11 @@ static struct clk *__clk_lookup_subtree(const char *name, struct clk *clk) | |||
484 | { | 476 | { |
485 | struct clk *child; | 477 | struct clk *child; |
486 | struct clk *ret; | 478 | struct clk *ret; |
487 | struct hlist_node *tmp; | ||
488 | 479 | ||
489 | if (!strcmp(clk->name, name)) | 480 | if (!strcmp(clk->name, name)) |
490 | return clk; | 481 | return clk; |
491 | 482 | ||
492 | hlist_for_each_entry(child, tmp, &clk->children, child_node) { | 483 | hlist_for_each_entry(child, &clk->children, child_node) { |
493 | ret = __clk_lookup_subtree(name, child); | 484 | ret = __clk_lookup_subtree(name, child); |
494 | if (ret) | 485 | if (ret) |
495 | return ret; | 486 | return ret; |
@@ -502,20 +493,19 @@ struct clk *__clk_lookup(const char *name) | |||
502 | { | 493 | { |
503 | struct clk *root_clk; | 494 | struct clk *root_clk; |
504 | struct clk *ret; | 495 | struct clk *ret; |
505 | struct hlist_node *tmp; | ||
506 | 496 | ||
507 | if (!name) | 497 | if (!name) |
508 | return NULL; | 498 | return NULL; |
509 | 499 | ||
510 | /* search the 'proper' clk tree first */ | 500 | /* search the 'proper' clk tree first */ |
511 | hlist_for_each_entry(root_clk, tmp, &clk_root_list, child_node) { | 501 | hlist_for_each_entry(root_clk, &clk_root_list, child_node) { |
512 | ret = __clk_lookup_subtree(name, root_clk); | 502 | ret = __clk_lookup_subtree(name, root_clk); |
513 | if (ret) | 503 | if (ret) |
514 | return ret; | 504 | return ret; |
515 | } | 505 | } |
516 | 506 | ||
517 | /* if not found, then search the orphan tree */ | 507 | /* if not found, then search the orphan tree */ |
518 | hlist_for_each_entry(root_clk, tmp, &clk_orphan_list, child_node) { | 508 | hlist_for_each_entry(root_clk, &clk_orphan_list, child_node) { |
519 | ret = __clk_lookup_subtree(name, root_clk); | 509 | ret = __clk_lookup_subtree(name, root_clk); |
520 | if (ret) | 510 | if (ret) |
521 | return ret; | 511 | return ret; |
@@ -812,7 +802,6 @@ static void __clk_recalc_rates(struct clk *clk, unsigned long msg) | |||
812 | { | 802 | { |
813 | unsigned long old_rate; | 803 | unsigned long old_rate; |
814 | unsigned long parent_rate = 0; | 804 | unsigned long parent_rate = 0; |
815 | struct hlist_node *tmp; | ||
816 | struct clk *child; | 805 | struct clk *child; |
817 | 806 | ||
818 | old_rate = clk->rate; | 807 | old_rate = clk->rate; |
@@ -832,7 +821,7 @@ static void __clk_recalc_rates(struct clk *clk, unsigned long msg) | |||
832 | if (clk->notifier_count && msg) | 821 | if (clk->notifier_count && msg) |
833 | __clk_notify(clk, msg, old_rate, clk->rate); | 822 | __clk_notify(clk, msg, old_rate, clk->rate); |
834 | 823 | ||
835 | hlist_for_each_entry(child, tmp, &clk->children, child_node) | 824 | hlist_for_each_entry(child, &clk->children, child_node) |
836 | __clk_recalc_rates(child, msg); | 825 | __clk_recalc_rates(child, msg); |
837 | } | 826 | } |
838 | 827 | ||
@@ -878,7 +867,6 @@ EXPORT_SYMBOL_GPL(clk_get_rate); | |||
878 | */ | 867 | */ |
879 | static int __clk_speculate_rates(struct clk *clk, unsigned long parent_rate) | 868 | static int __clk_speculate_rates(struct clk *clk, unsigned long parent_rate) |
880 | { | 869 | { |
881 | struct hlist_node *tmp; | ||
882 | struct clk *child; | 870 | struct clk *child; |
883 | unsigned long new_rate; | 871 | unsigned long new_rate; |
884 | int ret = NOTIFY_DONE; | 872 | int ret = NOTIFY_DONE; |
@@ -895,7 +883,7 @@ static int __clk_speculate_rates(struct clk *clk, unsigned long parent_rate) | |||
895 | if (ret == NOTIFY_BAD) | 883 | if (ret == NOTIFY_BAD) |
896 | goto out; | 884 | goto out; |
897 | 885 | ||
898 | hlist_for_each_entry(child, tmp, &clk->children, child_node) { | 886 | hlist_for_each_entry(child, &clk->children, child_node) { |
899 | ret = __clk_speculate_rates(child, new_rate); | 887 | ret = __clk_speculate_rates(child, new_rate); |
900 | if (ret == NOTIFY_BAD) | 888 | if (ret == NOTIFY_BAD) |
901 | break; | 889 | break; |
@@ -908,11 +896,10 @@ out: | |||
908 | static void clk_calc_subtree(struct clk *clk, unsigned long new_rate) | 896 | static void clk_calc_subtree(struct clk *clk, unsigned long new_rate) |
909 | { | 897 | { |
910 | struct clk *child; | 898 | struct clk *child; |
911 | struct hlist_node *tmp; | ||
912 | 899 | ||
913 | clk->new_rate = new_rate; | 900 | clk->new_rate = new_rate; |
914 | 901 | ||
915 | hlist_for_each_entry(child, tmp, &clk->children, child_node) { | 902 | hlist_for_each_entry(child, &clk->children, child_node) { |
916 | if (child->ops->recalc_rate) | 903 | if (child->ops->recalc_rate) |
917 | child->new_rate = child->ops->recalc_rate(child->hw, new_rate); | 904 | child->new_rate = child->ops->recalc_rate(child->hw, new_rate); |
918 | else | 905 | else |
@@ -983,7 +970,6 @@ out: | |||
983 | */ | 970 | */ |
984 | static struct clk *clk_propagate_rate_change(struct clk *clk, unsigned long event) | 971 | static struct clk *clk_propagate_rate_change(struct clk *clk, unsigned long event) |
985 | { | 972 | { |
986 | struct hlist_node *tmp; | ||
987 | struct clk *child, *fail_clk = NULL; | 973 | struct clk *child, *fail_clk = NULL; |
988 | int ret = NOTIFY_DONE; | 974 | int ret = NOTIFY_DONE; |
989 | 975 | ||
@@ -996,7 +982,7 @@ static struct clk *clk_propagate_rate_change(struct clk *clk, unsigned long even | |||
996 | fail_clk = clk; | 982 | fail_clk = clk; |
997 | } | 983 | } |
998 | 984 | ||
999 | hlist_for_each_entry(child, tmp, &clk->children, child_node) { | 985 | hlist_for_each_entry(child, &clk->children, child_node) { |
1000 | clk = clk_propagate_rate_change(child, event); | 986 | clk = clk_propagate_rate_change(child, event); |
1001 | if (clk) | 987 | if (clk) |
1002 | fail_clk = clk; | 988 | fail_clk = clk; |
@@ -1014,7 +1000,6 @@ static void clk_change_rate(struct clk *clk) | |||
1014 | struct clk *child; | 1000 | struct clk *child; |
1015 | unsigned long old_rate; | 1001 | unsigned long old_rate; |
1016 | unsigned long best_parent_rate = 0; | 1002 | unsigned long best_parent_rate = 0; |
1017 | struct hlist_node *tmp; | ||
1018 | 1003 | ||
1019 | old_rate = clk->rate; | 1004 | old_rate = clk->rate; |
1020 | 1005 | ||
@@ -1032,7 +1017,7 @@ static void clk_change_rate(struct clk *clk) | |||
1032 | if (clk->notifier_count && old_rate != clk->rate) | 1017 | if (clk->notifier_count && old_rate != clk->rate) |
1033 | __clk_notify(clk, POST_RATE_CHANGE, old_rate, clk->rate); | 1018 | __clk_notify(clk, POST_RATE_CHANGE, old_rate, clk->rate); |
1034 | 1019 | ||
1035 | hlist_for_each_entry(child, tmp, &clk->children, child_node) | 1020 | hlist_for_each_entry(child, &clk->children, child_node) |
1036 | clk_change_rate(child); | 1021 | clk_change_rate(child); |
1037 | } | 1022 | } |
1038 | 1023 | ||
@@ -1348,7 +1333,7 @@ int __clk_init(struct device *dev, struct clk *clk) | |||
1348 | { | 1333 | { |
1349 | int i, ret = 0; | 1334 | int i, ret = 0; |
1350 | struct clk *orphan; | 1335 | struct clk *orphan; |
1351 | struct hlist_node *tmp, *tmp2; | 1336 | struct hlist_node *tmp2; |
1352 | 1337 | ||
1353 | if (!clk) | 1338 | if (!clk) |
1354 | return -EINVAL; | 1339 | return -EINVAL; |
@@ -1448,7 +1433,7 @@ int __clk_init(struct device *dev, struct clk *clk) | |||
1448 | * walk the list of orphan clocks and reparent any that are children of | 1433 | * walk the list of orphan clocks and reparent any that are children of |
1449 | * this clock | 1434 | * this clock |
1450 | */ | 1435 | */ |
1451 | hlist_for_each_entry_safe(orphan, tmp, tmp2, &clk_orphan_list, child_node) { | 1436 | hlist_for_each_entry_safe(orphan, tmp2, &clk_orphan_list, child_node) { |
1452 | if (orphan->ops->get_parent) { | 1437 | if (orphan->ops->get_parent) { |
1453 | i = orphan->ops->get_parent(orphan->hw); | 1438 | i = orphan->ops->get_parent(orphan->hw); |
1454 | if (!strcmp(clk->name, orphan->parent_names[i])) | 1439 | if (!strcmp(clk->name, orphan->parent_names[i])) |
diff --git a/drivers/gpu/drm/drm_hashtab.c b/drivers/gpu/drm/drm_hashtab.c index 80254547a3f8..7e4bae760e27 100644 --- a/drivers/gpu/drm/drm_hashtab.c +++ b/drivers/gpu/drm/drm_hashtab.c | |||
@@ -60,14 +60,13 @@ void drm_ht_verbose_list(struct drm_open_hash *ht, unsigned long key) | |||
60 | { | 60 | { |
61 | struct drm_hash_item *entry; | 61 | struct drm_hash_item *entry; |
62 | struct hlist_head *h_list; | 62 | struct hlist_head *h_list; |
63 | struct hlist_node *list; | ||
64 | unsigned int hashed_key; | 63 | unsigned int hashed_key; |
65 | int count = 0; | 64 | int count = 0; |
66 | 65 | ||
67 | hashed_key = hash_long(key, ht->order); | 66 | hashed_key = hash_long(key, ht->order); |
68 | DRM_DEBUG("Key is 0x%08lx, Hashed key is 0x%08x\n", key, hashed_key); | 67 | DRM_DEBUG("Key is 0x%08lx, Hashed key is 0x%08x\n", key, hashed_key); |
69 | h_list = &ht->table[hashed_key]; | 68 | h_list = &ht->table[hashed_key]; |
70 | hlist_for_each_entry(entry, list, h_list, head) | 69 | hlist_for_each_entry(entry, h_list, head) |
71 | DRM_DEBUG("count %d, key: 0x%08lx\n", count++, entry->key); | 70 | DRM_DEBUG("count %d, key: 0x%08lx\n", count++, entry->key); |
72 | } | 71 | } |
73 | 72 | ||
@@ -76,14 +75,13 @@ static struct hlist_node *drm_ht_find_key(struct drm_open_hash *ht, | |||
76 | { | 75 | { |
77 | struct drm_hash_item *entry; | 76 | struct drm_hash_item *entry; |
78 | struct hlist_head *h_list; | 77 | struct hlist_head *h_list; |
79 | struct hlist_node *list; | ||
80 | unsigned int hashed_key; | 78 | unsigned int hashed_key; |
81 | 79 | ||
82 | hashed_key = hash_long(key, ht->order); | 80 | hashed_key = hash_long(key, ht->order); |
83 | h_list = &ht->table[hashed_key]; | 81 | h_list = &ht->table[hashed_key]; |
84 | hlist_for_each_entry(entry, list, h_list, head) { | 82 | hlist_for_each_entry(entry, h_list, head) { |
85 | if (entry->key == key) | 83 | if (entry->key == key) |
86 | return list; | 84 | return &entry->head; |
87 | if (entry->key > key) | 85 | if (entry->key > key) |
88 | break; | 86 | break; |
89 | } | 87 | } |
@@ -95,14 +93,13 @@ static struct hlist_node *drm_ht_find_key_rcu(struct drm_open_hash *ht, | |||
95 | { | 93 | { |
96 | struct drm_hash_item *entry; | 94 | struct drm_hash_item *entry; |
97 | struct hlist_head *h_list; | 95 | struct hlist_head *h_list; |
98 | struct hlist_node *list; | ||
99 | unsigned int hashed_key; | 96 | unsigned int hashed_key; |
100 | 97 | ||
101 | hashed_key = hash_long(key, ht->order); | 98 | hashed_key = hash_long(key, ht->order); |
102 | h_list = &ht->table[hashed_key]; | 99 | h_list = &ht->table[hashed_key]; |
103 | hlist_for_each_entry_rcu(entry, list, h_list, head) { | 100 | hlist_for_each_entry_rcu(entry, h_list, head) { |
104 | if (entry->key == key) | 101 | if (entry->key == key) |
105 | return list; | 102 | return &entry->head; |
106 | if (entry->key > key) | 103 | if (entry->key > key) |
107 | break; | 104 | break; |
108 | } | 105 | } |
@@ -113,19 +110,19 @@ int drm_ht_insert_item(struct drm_open_hash *ht, struct drm_hash_item *item) | |||
113 | { | 110 | { |
114 | struct drm_hash_item *entry; | 111 | struct drm_hash_item *entry; |
115 | struct hlist_head *h_list; | 112 | struct hlist_head *h_list; |
116 | struct hlist_node *list, *parent; | 113 | struct hlist_node *parent; |
117 | unsigned int hashed_key; | 114 | unsigned int hashed_key; |
118 | unsigned long key = item->key; | 115 | unsigned long key = item->key; |
119 | 116 | ||
120 | hashed_key = hash_long(key, ht->order); | 117 | hashed_key = hash_long(key, ht->order); |
121 | h_list = &ht->table[hashed_key]; | 118 | h_list = &ht->table[hashed_key]; |
122 | parent = NULL; | 119 | parent = NULL; |
123 | hlist_for_each_entry(entry, list, h_list, head) { | 120 | hlist_for_each_entry(entry, h_list, head) { |
124 | if (entry->key == key) | 121 | if (entry->key == key) |
125 | return -EINVAL; | 122 | return -EINVAL; |
126 | if (entry->key > key) | 123 | if (entry->key > key) |
127 | break; | 124 | break; |
128 | parent = list; | 125 | parent = &entry->head; |
129 | } | 126 | } |
130 | if (parent) { | 127 | if (parent) { |
131 | hlist_add_after_rcu(parent, &item->head); | 128 | hlist_add_after_rcu(parent, &item->head); |
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c index c32eeaa3f3b1..71c2c7116802 100644 --- a/drivers/infiniband/core/cma.c +++ b/drivers/infiniband/core/cma.c | |||
@@ -2204,10 +2204,9 @@ static int cma_check_port(struct rdma_bind_list *bind_list, | |||
2204 | { | 2204 | { |
2205 | struct rdma_id_private *cur_id; | 2205 | struct rdma_id_private *cur_id; |
2206 | struct sockaddr *addr, *cur_addr; | 2206 | struct sockaddr *addr, *cur_addr; |
2207 | struct hlist_node *node; | ||
2208 | 2207 | ||
2209 | addr = (struct sockaddr *) &id_priv->id.route.addr.src_addr; | 2208 | addr = (struct sockaddr *) &id_priv->id.route.addr.src_addr; |
2210 | hlist_for_each_entry(cur_id, node, &bind_list->owners, node) { | 2209 | hlist_for_each_entry(cur_id, &bind_list->owners, node) { |
2211 | if (id_priv == cur_id) | 2210 | if (id_priv == cur_id) |
2212 | continue; | 2211 | continue; |
2213 | 2212 | ||
diff --git a/drivers/infiniband/core/fmr_pool.c b/drivers/infiniband/core/fmr_pool.c index 176c8f90f2bb..9f5ad7cc33c8 100644 --- a/drivers/infiniband/core/fmr_pool.c +++ b/drivers/infiniband/core/fmr_pool.c | |||
@@ -118,14 +118,13 @@ static inline struct ib_pool_fmr *ib_fmr_cache_lookup(struct ib_fmr_pool *pool, | |||
118 | { | 118 | { |
119 | struct hlist_head *bucket; | 119 | struct hlist_head *bucket; |
120 | struct ib_pool_fmr *fmr; | 120 | struct ib_pool_fmr *fmr; |
121 | struct hlist_node *pos; | ||
122 | 121 | ||
123 | if (!pool->cache_bucket) | 122 | if (!pool->cache_bucket) |
124 | return NULL; | 123 | return NULL; |
125 | 124 | ||
126 | bucket = pool->cache_bucket + ib_fmr_hash(*page_list); | 125 | bucket = pool->cache_bucket + ib_fmr_hash(*page_list); |
127 | 126 | ||
128 | hlist_for_each_entry(fmr, pos, bucket, cache_node) | 127 | hlist_for_each_entry(fmr, bucket, cache_node) |
129 | if (io_virtual_address == fmr->io_virtual_address && | 128 | if (io_virtual_address == fmr->io_virtual_address && |
130 | page_list_len == fmr->page_list_len && | 129 | page_list_len == fmr->page_list_len && |
131 | !memcmp(page_list, fmr->page_list, | 130 | !memcmp(page_list, fmr->page_list, |
diff --git a/drivers/isdn/mISDN/socket.c b/drivers/isdn/mISDN/socket.c index abe2d699b6f3..8b07f83d48ad 100644 --- a/drivers/isdn/mISDN/socket.c +++ b/drivers/isdn/mISDN/socket.c | |||
@@ -483,7 +483,6 @@ data_sock_bind(struct socket *sock, struct sockaddr *addr, int addr_len) | |||
483 | { | 483 | { |
484 | struct sockaddr_mISDN *maddr = (struct sockaddr_mISDN *) addr; | 484 | struct sockaddr_mISDN *maddr = (struct sockaddr_mISDN *) addr; |
485 | struct sock *sk = sock->sk; | 485 | struct sock *sk = sock->sk; |
486 | struct hlist_node *node; | ||
487 | struct sock *csk; | 486 | struct sock *csk; |
488 | int err = 0; | 487 | int err = 0; |
489 | 488 | ||
@@ -508,7 +507,7 @@ data_sock_bind(struct socket *sock, struct sockaddr *addr, int addr_len) | |||
508 | 507 | ||
509 | if (sk->sk_protocol < ISDN_P_B_START) { | 508 | if (sk->sk_protocol < ISDN_P_B_START) { |
510 | read_lock_bh(&data_sockets.lock); | 509 | read_lock_bh(&data_sockets.lock); |
511 | sk_for_each(csk, node, &data_sockets.head) { | 510 | sk_for_each(csk, &data_sockets.head) { |
512 | if (sk == csk) | 511 | if (sk == csk) |
513 | continue; | 512 | continue; |
514 | if (_pms(csk)->dev != _pms(sk)->dev) | 513 | if (_pms(csk)->dev != _pms(sk)->dev) |
diff --git a/drivers/isdn/mISDN/stack.c b/drivers/isdn/mISDN/stack.c index deda591f70b9..9cb4b621fbc3 100644 --- a/drivers/isdn/mISDN/stack.c +++ b/drivers/isdn/mISDN/stack.c | |||
@@ -64,12 +64,11 @@ unlock: | |||
64 | static void | 64 | static void |
65 | send_socklist(struct mISDN_sock_list *sl, struct sk_buff *skb) | 65 | send_socklist(struct mISDN_sock_list *sl, struct sk_buff *skb) |
66 | { | 66 | { |
67 | struct hlist_node *node; | ||
68 | struct sock *sk; | 67 | struct sock *sk; |
69 | struct sk_buff *cskb = NULL; | 68 | struct sk_buff *cskb = NULL; |
70 | 69 | ||
71 | read_lock(&sl->lock); | 70 | read_lock(&sl->lock); |
72 | sk_for_each(sk, node, &sl->head) { | 71 | sk_for_each(sk, &sl->head) { |
73 | if (sk->sk_state != MISDN_BOUND) | 72 | if (sk->sk_state != MISDN_BOUND) |
74 | continue; | 73 | continue; |
75 | if (!cskb) | 74 | if (!cskb) |
diff --git a/drivers/md/dm-bio-prison.c b/drivers/md/dm-bio-prison.c index aefb78e3cbf9..d9d3f1c7b662 100644 --- a/drivers/md/dm-bio-prison.c +++ b/drivers/md/dm-bio-prison.c | |||
@@ -106,9 +106,8 @@ static struct dm_bio_prison_cell *__search_bucket(struct hlist_head *bucket, | |||
106 | struct dm_cell_key *key) | 106 | struct dm_cell_key *key) |
107 | { | 107 | { |
108 | struct dm_bio_prison_cell *cell; | 108 | struct dm_bio_prison_cell *cell; |
109 | struct hlist_node *tmp; | ||
110 | 109 | ||
111 | hlist_for_each_entry(cell, tmp, bucket, list) | 110 | hlist_for_each_entry(cell, bucket, list) |
112 | if (keys_equal(&cell->key, key)) | 111 | if (keys_equal(&cell->key, key)) |
113 | return cell; | 112 | return cell; |
114 | 113 | ||
diff --git a/drivers/md/dm-bufio.c b/drivers/md/dm-bufio.c index 651ca79881dd..93205e32a004 100644 --- a/drivers/md/dm-bufio.c +++ b/drivers/md/dm-bufio.c | |||
@@ -859,9 +859,8 @@ static void __check_watermark(struct dm_bufio_client *c) | |||
859 | static struct dm_buffer *__find(struct dm_bufio_client *c, sector_t block) | 859 | static struct dm_buffer *__find(struct dm_bufio_client *c, sector_t block) |
860 | { | 860 | { |
861 | struct dm_buffer *b; | 861 | struct dm_buffer *b; |
862 | struct hlist_node *hn; | ||
863 | 862 | ||
864 | hlist_for_each_entry(b, hn, &c->cache_hash[DM_BUFIO_HASH(block)], | 863 | hlist_for_each_entry(b, &c->cache_hash[DM_BUFIO_HASH(block)], |
865 | hash_list) { | 864 | hash_list) { |
866 | dm_bufio_cond_resched(); | 865 | dm_bufio_cond_resched(); |
867 | if (b->block == block) | 866 | if (b->block == block) |
diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c index 59fc18ae52c2..10079e07edf4 100644 --- a/drivers/md/dm-snap.c +++ b/drivers/md/dm-snap.c | |||
@@ -227,12 +227,11 @@ static void stop_tracking_chunk(struct dm_snapshot *s, struct bio *bio) | |||
227 | static int __chunk_is_tracked(struct dm_snapshot *s, chunk_t chunk) | 227 | static int __chunk_is_tracked(struct dm_snapshot *s, chunk_t chunk) |
228 | { | 228 | { |
229 | struct dm_snap_tracked_chunk *c; | 229 | struct dm_snap_tracked_chunk *c; |
230 | struct hlist_node *hn; | ||
231 | int found = 0; | 230 | int found = 0; |
232 | 231 | ||
233 | spin_lock_irq(&s->tracked_chunk_lock); | 232 | spin_lock_irq(&s->tracked_chunk_lock); |
234 | 233 | ||
235 | hlist_for_each_entry(c, hn, | 234 | hlist_for_each_entry(c, |
236 | &s->tracked_chunk_hash[DM_TRACKED_CHUNK_HASH(chunk)], node) { | 235 | &s->tracked_chunk_hash[DM_TRACKED_CHUNK_HASH(chunk)], node) { |
237 | if (c->chunk == chunk) { | 236 | if (c->chunk == chunk) { |
238 | found = 1; | 237 | found = 1; |
diff --git a/drivers/md/persistent-data/dm-transaction-manager.c b/drivers/md/persistent-data/dm-transaction-manager.c index 7b17a1fdeaf9..81da1a26042e 100644 --- a/drivers/md/persistent-data/dm-transaction-manager.c +++ b/drivers/md/persistent-data/dm-transaction-manager.c | |||
@@ -46,10 +46,9 @@ static int is_shadow(struct dm_transaction_manager *tm, dm_block_t b) | |||
46 | int r = 0; | 46 | int r = 0; |
47 | unsigned bucket = dm_hash_block(b, DM_HASH_MASK); | 47 | unsigned bucket = dm_hash_block(b, DM_HASH_MASK); |
48 | struct shadow_info *si; | 48 | struct shadow_info *si; |
49 | struct hlist_node *n; | ||
50 | 49 | ||
51 | spin_lock(&tm->lock); | 50 | spin_lock(&tm->lock); |
52 | hlist_for_each_entry(si, n, tm->buckets + bucket, hlist) | 51 | hlist_for_each_entry(si, tm->buckets + bucket, hlist) |
53 | if (si->where == b) { | 52 | if (si->where == b) { |
54 | r = 1; | 53 | r = 1; |
55 | break; | 54 | break; |
@@ -81,14 +80,14 @@ static void insert_shadow(struct dm_transaction_manager *tm, dm_block_t b) | |||
81 | static void wipe_shadow_table(struct dm_transaction_manager *tm) | 80 | static void wipe_shadow_table(struct dm_transaction_manager *tm) |
82 | { | 81 | { |
83 | struct shadow_info *si; | 82 | struct shadow_info *si; |
84 | struct hlist_node *n, *tmp; | 83 | struct hlist_node *tmp; |
85 | struct hlist_head *bucket; | 84 | struct hlist_head *bucket; |
86 | int i; | 85 | int i; |
87 | 86 | ||
88 | spin_lock(&tm->lock); | 87 | spin_lock(&tm->lock); |
89 | for (i = 0; i < DM_HASH_SIZE; i++) { | 88 | for (i = 0; i < DM_HASH_SIZE; i++) { |
90 | bucket = tm->buckets + i; | 89 | bucket = tm->buckets + i; |
91 | hlist_for_each_entry_safe(si, n, tmp, bucket, hlist) | 90 | hlist_for_each_entry_safe(si, tmp, bucket, hlist) |
92 | kfree(si); | 91 | kfree(si); |
93 | 92 | ||
94 | INIT_HLIST_HEAD(bucket); | 93 | INIT_HLIST_HEAD(bucket); |
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 19d77a026639..697f026cb318 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -365,10 +365,9 @@ static struct stripe_head *__find_stripe(struct r5conf *conf, sector_t sector, | |||
365 | short generation) | 365 | short generation) |
366 | { | 366 | { |
367 | struct stripe_head *sh; | 367 | struct stripe_head *sh; |
368 | struct hlist_node *hn; | ||
369 | 368 | ||
370 | pr_debug("__find_stripe, sector %llu\n", (unsigned long long)sector); | 369 | pr_debug("__find_stripe, sector %llu\n", (unsigned long long)sector); |
371 | hlist_for_each_entry(sh, hn, stripe_hash(conf, sector), hash) | 370 | hlist_for_each_entry(sh, stripe_hash(conf, sector), hash) |
372 | if (sh->sector == sector && sh->generation == generation) | 371 | if (sh->sector == sector && sh->generation == generation) |
373 | return sh; | 372 | return sh; |
374 | pr_debug("__stripe %llu not in cache\n", (unsigned long long)sector); | 373 | pr_debug("__stripe %llu not in cache\n", (unsigned long long)sector); |
diff --git a/drivers/misc/sgi-gru/grutlbpurge.c b/drivers/misc/sgi-gru/grutlbpurge.c index 240a6d361665..2129274ef7ab 100644 --- a/drivers/misc/sgi-gru/grutlbpurge.c +++ b/drivers/misc/sgi-gru/grutlbpurge.c | |||
@@ -280,11 +280,10 @@ static struct mmu_notifier *mmu_find_ops(struct mm_struct *mm, | |||
280 | const struct mmu_notifier_ops *ops) | 280 | const struct mmu_notifier_ops *ops) |
281 | { | 281 | { |
282 | struct mmu_notifier *mn, *gru_mn = NULL; | 282 | struct mmu_notifier *mn, *gru_mn = NULL; |
283 | struct hlist_node *n; | ||
284 | 283 | ||
285 | if (mm->mmu_notifier_mm) { | 284 | if (mm->mmu_notifier_mm) { |
286 | rcu_read_lock(); | 285 | rcu_read_lock(); |
287 | hlist_for_each_entry_rcu(mn, n, &mm->mmu_notifier_mm->list, | 286 | hlist_for_each_entry_rcu(mn, &mm->mmu_notifier_mm->list, |
288 | hlist) | 287 | hlist) |
289 | if (mn->ops == ops) { | 288 | if (mn->ops == ops) { |
290 | gru_mn = mn; | 289 | gru_mn = mn; |
diff --git a/drivers/misc/vmw_vmci/vmci_doorbell.c b/drivers/misc/vmw_vmci/vmci_doorbell.c index c3e8397f62ed..a8cee33ae8d2 100644 --- a/drivers/misc/vmw_vmci/vmci_doorbell.c +++ b/drivers/misc/vmw_vmci/vmci_doorbell.c | |||
@@ -127,9 +127,8 @@ static struct dbell_entry *dbell_index_table_find(u32 idx) | |||
127 | { | 127 | { |
128 | u32 bucket = VMCI_DOORBELL_HASH(idx); | 128 | u32 bucket = VMCI_DOORBELL_HASH(idx); |
129 | struct dbell_entry *dbell; | 129 | struct dbell_entry *dbell; |
130 | struct hlist_node *node; | ||
131 | 130 | ||
132 | hlist_for_each_entry(dbell, node, &vmci_doorbell_it.entries[bucket], | 131 | hlist_for_each_entry(dbell, &vmci_doorbell_it.entries[bucket], |
133 | node) { | 132 | node) { |
134 | if (idx == dbell->idx) | 133 | if (idx == dbell->idx) |
135 | return dbell; | 134 | return dbell; |
@@ -359,12 +358,10 @@ static void dbell_fire_entries(u32 notify_idx) | |||
359 | { | 358 | { |
360 | u32 bucket = VMCI_DOORBELL_HASH(notify_idx); | 359 | u32 bucket = VMCI_DOORBELL_HASH(notify_idx); |
361 | struct dbell_entry *dbell; | 360 | struct dbell_entry *dbell; |
362 | struct hlist_node *node; | ||
363 | 361 | ||
364 | spin_lock_bh(&vmci_doorbell_it.lock); | 362 | spin_lock_bh(&vmci_doorbell_it.lock); |
365 | 363 | ||
366 | hlist_for_each_entry(dbell, node, | 364 | hlist_for_each_entry(dbell, &vmci_doorbell_it.entries[bucket], node) { |
367 | &vmci_doorbell_it.entries[bucket], node) { | ||
368 | if (dbell->idx == notify_idx && | 365 | if (dbell->idx == notify_idx && |
369 | atomic_read(&dbell->active) == 1) { | 366 | atomic_read(&dbell->active) == 1) { |
370 | if (dbell->run_delayed) { | 367 | if (dbell->run_delayed) { |
diff --git a/drivers/misc/vmw_vmci/vmci_resource.c b/drivers/misc/vmw_vmci/vmci_resource.c index a196f84a4fd2..9a53a30de445 100644 --- a/drivers/misc/vmw_vmci/vmci_resource.c +++ b/drivers/misc/vmw_vmci/vmci_resource.c | |||
@@ -46,11 +46,10 @@ static struct vmci_resource *vmci_resource_lookup(struct vmci_handle handle, | |||
46 | enum vmci_resource_type type) | 46 | enum vmci_resource_type type) |
47 | { | 47 | { |
48 | struct vmci_resource *r, *resource = NULL; | 48 | struct vmci_resource *r, *resource = NULL; |
49 | struct hlist_node *node; | ||
50 | unsigned int idx = vmci_resource_hash(handle); | 49 | unsigned int idx = vmci_resource_hash(handle); |
51 | 50 | ||
52 | rcu_read_lock(); | 51 | rcu_read_lock(); |
53 | hlist_for_each_entry_rcu(r, node, | 52 | hlist_for_each_entry_rcu(r, |
54 | &vmci_resource_table.entries[idx], node) { | 53 | &vmci_resource_table.entries[idx], node) { |
55 | u32 cid = r->handle.context; | 54 | u32 cid = r->handle.context; |
56 | u32 rid = r->handle.resource; | 55 | u32 rid = r->handle.resource; |
@@ -146,12 +145,11 @@ void vmci_resource_remove(struct vmci_resource *resource) | |||
146 | struct vmci_handle handle = resource->handle; | 145 | struct vmci_handle handle = resource->handle; |
147 | unsigned int idx = vmci_resource_hash(handle); | 146 | unsigned int idx = vmci_resource_hash(handle); |
148 | struct vmci_resource *r; | 147 | struct vmci_resource *r; |
149 | struct hlist_node *node; | ||
150 | 148 | ||
151 | /* Remove resource from hash table. */ | 149 | /* Remove resource from hash table. */ |
152 | spin_lock(&vmci_resource_table.lock); | 150 | spin_lock(&vmci_resource_table.lock); |
153 | 151 | ||
154 | hlist_for_each_entry(r, node, &vmci_resource_table.entries[idx], node) { | 152 | hlist_for_each_entry(r, &vmci_resource_table.entries[idx], node) { |
155 | if (vmci_handle_is_equal(r->handle, resource->handle)) { | 153 | if (vmci_handle_is_equal(r->handle, resource->handle)) { |
156 | hlist_del_init_rcu(&r->node); | 154 | hlist_del_init_rcu(&r->node); |
157 | break; | 155 | break; |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c index f4d2e9e3c6d5..c3f1afd86906 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | |||
@@ -2197,13 +2197,13 @@ static int ixgbe_get_ethtool_fdir_entry(struct ixgbe_adapter *adapter, | |||
2197 | union ixgbe_atr_input *mask = &adapter->fdir_mask; | 2197 | union ixgbe_atr_input *mask = &adapter->fdir_mask; |
2198 | struct ethtool_rx_flow_spec *fsp = | 2198 | struct ethtool_rx_flow_spec *fsp = |
2199 | (struct ethtool_rx_flow_spec *)&cmd->fs; | 2199 | (struct ethtool_rx_flow_spec *)&cmd->fs; |
2200 | struct hlist_node *node, *node2; | 2200 | struct hlist_node *node2; |
2201 | struct ixgbe_fdir_filter *rule = NULL; | 2201 | struct ixgbe_fdir_filter *rule = NULL; |
2202 | 2202 | ||
2203 | /* report total rule count */ | 2203 | /* report total rule count */ |
2204 | cmd->data = (1024 << adapter->fdir_pballoc) - 2; | 2204 | cmd->data = (1024 << adapter->fdir_pballoc) - 2; |
2205 | 2205 | ||
2206 | hlist_for_each_entry_safe(rule, node, node2, | 2206 | hlist_for_each_entry_safe(rule, node2, |
2207 | &adapter->fdir_filter_list, fdir_node) { | 2207 | &adapter->fdir_filter_list, fdir_node) { |
2208 | if (fsp->location <= rule->sw_idx) | 2208 | if (fsp->location <= rule->sw_idx) |
2209 | break; | 2209 | break; |
@@ -2264,14 +2264,14 @@ static int ixgbe_get_ethtool_fdir_all(struct ixgbe_adapter *adapter, | |||
2264 | struct ethtool_rxnfc *cmd, | 2264 | struct ethtool_rxnfc *cmd, |
2265 | u32 *rule_locs) | 2265 | u32 *rule_locs) |
2266 | { | 2266 | { |
2267 | struct hlist_node *node, *node2; | 2267 | struct hlist_node *node2; |
2268 | struct ixgbe_fdir_filter *rule; | 2268 | struct ixgbe_fdir_filter *rule; |
2269 | int cnt = 0; | 2269 | int cnt = 0; |
2270 | 2270 | ||
2271 | /* report total rule count */ | 2271 | /* report total rule count */ |
2272 | cmd->data = (1024 << adapter->fdir_pballoc) - 2; | 2272 | cmd->data = (1024 << adapter->fdir_pballoc) - 2; |
2273 | 2273 | ||
2274 | hlist_for_each_entry_safe(rule, node, node2, | 2274 | hlist_for_each_entry_safe(rule, node2, |
2275 | &adapter->fdir_filter_list, fdir_node) { | 2275 | &adapter->fdir_filter_list, fdir_node) { |
2276 | if (cnt == cmd->rule_cnt) | 2276 | if (cnt == cmd->rule_cnt) |
2277 | return -EMSGSIZE; | 2277 | return -EMSGSIZE; |
@@ -2358,19 +2358,19 @@ static int ixgbe_update_ethtool_fdir_entry(struct ixgbe_adapter *adapter, | |||
2358 | u16 sw_idx) | 2358 | u16 sw_idx) |
2359 | { | 2359 | { |
2360 | struct ixgbe_hw *hw = &adapter->hw; | 2360 | struct ixgbe_hw *hw = &adapter->hw; |
2361 | struct hlist_node *node, *node2, *parent; | 2361 | struct hlist_node *node2; |
2362 | struct ixgbe_fdir_filter *rule; | 2362 | struct ixgbe_fdir_filter *rule, *parent; |
2363 | int err = -EINVAL; | 2363 | int err = -EINVAL; |
2364 | 2364 | ||
2365 | parent = NULL; | 2365 | parent = NULL; |
2366 | rule = NULL; | 2366 | rule = NULL; |
2367 | 2367 | ||
2368 | hlist_for_each_entry_safe(rule, node, node2, | 2368 | hlist_for_each_entry_safe(rule, node2, |
2369 | &adapter->fdir_filter_list, fdir_node) { | 2369 | &adapter->fdir_filter_list, fdir_node) { |
2370 | /* hash found, or no matching entry */ | 2370 | /* hash found, or no matching entry */ |
2371 | if (rule->sw_idx >= sw_idx) | 2371 | if (rule->sw_idx >= sw_idx) |
2372 | break; | 2372 | break; |
2373 | parent = node; | 2373 | parent = rule; |
2374 | } | 2374 | } |
2375 | 2375 | ||
2376 | /* if there is an old rule occupying our place remove it */ | 2376 | /* if there is an old rule occupying our place remove it */ |
@@ -2399,7 +2399,7 @@ static int ixgbe_update_ethtool_fdir_entry(struct ixgbe_adapter *adapter, | |||
2399 | 2399 | ||
2400 | /* add filter to the list */ | 2400 | /* add filter to the list */ |
2401 | if (parent) | 2401 | if (parent) |
2402 | hlist_add_after(parent, &input->fdir_node); | 2402 | hlist_add_after(&parent->fdir_node, &input->fdir_node); |
2403 | else | 2403 | else |
2404 | hlist_add_head(&input->fdir_node, | 2404 | hlist_add_head(&input->fdir_node, |
2405 | &adapter->fdir_filter_list); | 2405 | &adapter->fdir_filter_list); |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index 68478d6dfa2d..db5611ae407e 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | |||
@@ -3891,7 +3891,7 @@ static void ixgbe_configure_pb(struct ixgbe_adapter *adapter) | |||
3891 | static void ixgbe_fdir_filter_restore(struct ixgbe_adapter *adapter) | 3891 | static void ixgbe_fdir_filter_restore(struct ixgbe_adapter *adapter) |
3892 | { | 3892 | { |
3893 | struct ixgbe_hw *hw = &adapter->hw; | 3893 | struct ixgbe_hw *hw = &adapter->hw; |
3894 | struct hlist_node *node, *node2; | 3894 | struct hlist_node *node2; |
3895 | struct ixgbe_fdir_filter *filter; | 3895 | struct ixgbe_fdir_filter *filter; |
3896 | 3896 | ||
3897 | spin_lock(&adapter->fdir_perfect_lock); | 3897 | spin_lock(&adapter->fdir_perfect_lock); |
@@ -3899,7 +3899,7 @@ static void ixgbe_fdir_filter_restore(struct ixgbe_adapter *adapter) | |||
3899 | if (!hlist_empty(&adapter->fdir_filter_list)) | 3899 | if (!hlist_empty(&adapter->fdir_filter_list)) |
3900 | ixgbe_fdir_set_input_mask_82599(hw, &adapter->fdir_mask); | 3900 | ixgbe_fdir_set_input_mask_82599(hw, &adapter->fdir_mask); |
3901 | 3901 | ||
3902 | hlist_for_each_entry_safe(filter, node, node2, | 3902 | hlist_for_each_entry_safe(filter, node2, |
3903 | &adapter->fdir_filter_list, fdir_node) { | 3903 | &adapter->fdir_filter_list, fdir_node) { |
3904 | ixgbe_fdir_write_perfect_filter_82599(hw, | 3904 | ixgbe_fdir_write_perfect_filter_82599(hw, |
3905 | &filter->filter, | 3905 | &filter->filter, |
@@ -4356,12 +4356,12 @@ static void ixgbe_clean_all_tx_rings(struct ixgbe_adapter *adapter) | |||
4356 | 4356 | ||
4357 | static void ixgbe_fdir_filter_exit(struct ixgbe_adapter *adapter) | 4357 | static void ixgbe_fdir_filter_exit(struct ixgbe_adapter *adapter) |
4358 | { | 4358 | { |
4359 | struct hlist_node *node, *node2; | 4359 | struct hlist_node *node2; |
4360 | struct ixgbe_fdir_filter *filter; | 4360 | struct ixgbe_fdir_filter *filter; |
4361 | 4361 | ||
4362 | spin_lock(&adapter->fdir_perfect_lock); | 4362 | spin_lock(&adapter->fdir_perfect_lock); |
4363 | 4363 | ||
4364 | hlist_for_each_entry_safe(filter, node, node2, | 4364 | hlist_for_each_entry_safe(filter, node2, |
4365 | &adapter->fdir_filter_list, fdir_node) { | 4365 | &adapter->fdir_filter_list, fdir_node) { |
4366 | hlist_del(&filter->fdir_node); | 4366 | hlist_del(&filter->fdir_node); |
4367 | kfree(filter); | 4367 | kfree(filter); |
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c index 5385474bb526..bb4d8d99f36d 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c | |||
@@ -225,11 +225,10 @@ static inline struct mlx4_en_filter * | |||
225 | mlx4_en_filter_find(struct mlx4_en_priv *priv, __be32 src_ip, __be32 dst_ip, | 225 | mlx4_en_filter_find(struct mlx4_en_priv *priv, __be32 src_ip, __be32 dst_ip, |
226 | __be16 src_port, __be16 dst_port) | 226 | __be16 src_port, __be16 dst_port) |
227 | { | 227 | { |
228 | struct hlist_node *elem; | ||
229 | struct mlx4_en_filter *filter; | 228 | struct mlx4_en_filter *filter; |
230 | struct mlx4_en_filter *ret = NULL; | 229 | struct mlx4_en_filter *ret = NULL; |
231 | 230 | ||
232 | hlist_for_each_entry(filter, elem, | 231 | hlist_for_each_entry(filter, |
233 | filter_hash_bucket(priv, src_ip, dst_ip, | 232 | filter_hash_bucket(priv, src_ip, dst_ip, |
234 | src_port, dst_port), | 233 | src_port, dst_port), |
235 | filter_chain) { | 234 | filter_chain) { |
@@ -574,13 +573,13 @@ static void mlx4_en_put_qp(struct mlx4_en_priv *priv) | |||
574 | 573 | ||
575 | if (dev->caps.steering_mode != MLX4_STEERING_MODE_A0) { | 574 | if (dev->caps.steering_mode != MLX4_STEERING_MODE_A0) { |
576 | struct mlx4_mac_entry *entry; | 575 | struct mlx4_mac_entry *entry; |
577 | struct hlist_node *n, *tmp; | 576 | struct hlist_node *tmp; |
578 | struct hlist_head *bucket; | 577 | struct hlist_head *bucket; |
579 | unsigned int mac_hash; | 578 | unsigned int mac_hash; |
580 | 579 | ||
581 | mac_hash = priv->dev->dev_addr[MLX4_EN_MAC_HASH_IDX]; | 580 | mac_hash = priv->dev->dev_addr[MLX4_EN_MAC_HASH_IDX]; |
582 | bucket = &priv->mac_hash[mac_hash]; | 581 | bucket = &priv->mac_hash[mac_hash]; |
583 | hlist_for_each_entry_safe(entry, n, tmp, bucket, hlist) { | 582 | hlist_for_each_entry_safe(entry, tmp, bucket, hlist) { |
584 | if (ether_addr_equal_64bits(entry->mac, | 583 | if (ether_addr_equal_64bits(entry->mac, |
585 | priv->dev->dev_addr)) { | 584 | priv->dev->dev_addr)) { |
586 | en_dbg(DRV, priv, "Releasing qp: port %d, MAC %pM, qpn %d\n", | 585 | en_dbg(DRV, priv, "Releasing qp: port %d, MAC %pM, qpn %d\n", |
@@ -609,11 +608,11 @@ static int mlx4_en_replace_mac(struct mlx4_en_priv *priv, int qpn, | |||
609 | struct hlist_head *bucket; | 608 | struct hlist_head *bucket; |
610 | unsigned int mac_hash; | 609 | unsigned int mac_hash; |
611 | struct mlx4_mac_entry *entry; | 610 | struct mlx4_mac_entry *entry; |
612 | struct hlist_node *n, *tmp; | 611 | struct hlist_node *tmp; |
613 | u64 prev_mac_u64 = mlx4_en_mac_to_u64(prev_mac); | 612 | u64 prev_mac_u64 = mlx4_en_mac_to_u64(prev_mac); |
614 | 613 | ||
615 | bucket = &priv->mac_hash[prev_mac[MLX4_EN_MAC_HASH_IDX]]; | 614 | bucket = &priv->mac_hash[prev_mac[MLX4_EN_MAC_HASH_IDX]]; |
616 | hlist_for_each_entry_safe(entry, n, tmp, bucket, hlist) { | 615 | hlist_for_each_entry_safe(entry, tmp, bucket, hlist) { |
617 | if (ether_addr_equal_64bits(entry->mac, prev_mac)) { | 616 | if (ether_addr_equal_64bits(entry->mac, prev_mac)) { |
618 | mlx4_en_uc_steer_release(priv, entry->mac, | 617 | mlx4_en_uc_steer_release(priv, entry->mac, |
619 | qpn, entry->reg_id); | 618 | qpn, entry->reg_id); |
@@ -1019,7 +1018,7 @@ static void mlx4_en_do_uc_filter(struct mlx4_en_priv *priv, | |||
1019 | { | 1018 | { |
1020 | struct netdev_hw_addr *ha; | 1019 | struct netdev_hw_addr *ha; |
1021 | struct mlx4_mac_entry *entry; | 1020 | struct mlx4_mac_entry *entry; |
1022 | struct hlist_node *n, *tmp; | 1021 | struct hlist_node *tmp; |
1023 | bool found; | 1022 | bool found; |
1024 | u64 mac; | 1023 | u64 mac; |
1025 | int err = 0; | 1024 | int err = 0; |
@@ -1035,7 +1034,7 @@ static void mlx4_en_do_uc_filter(struct mlx4_en_priv *priv, | |||
1035 | /* find what to remove */ | 1034 | /* find what to remove */ |
1036 | for (i = 0; i < MLX4_EN_MAC_HASH_SIZE; ++i) { | 1035 | for (i = 0; i < MLX4_EN_MAC_HASH_SIZE; ++i) { |
1037 | bucket = &priv->mac_hash[i]; | 1036 | bucket = &priv->mac_hash[i]; |
1038 | hlist_for_each_entry_safe(entry, n, tmp, bucket, hlist) { | 1037 | hlist_for_each_entry_safe(entry, tmp, bucket, hlist) { |
1039 | found = false; | 1038 | found = false; |
1040 | netdev_for_each_uc_addr(ha, dev) { | 1039 | netdev_for_each_uc_addr(ha, dev) { |
1041 | if (ether_addr_equal_64bits(entry->mac, | 1040 | if (ether_addr_equal_64bits(entry->mac, |
@@ -1078,7 +1077,7 @@ static void mlx4_en_do_uc_filter(struct mlx4_en_priv *priv, | |||
1078 | netdev_for_each_uc_addr(ha, dev) { | 1077 | netdev_for_each_uc_addr(ha, dev) { |
1079 | found = false; | 1078 | found = false; |
1080 | bucket = &priv->mac_hash[ha->addr[MLX4_EN_MAC_HASH_IDX]]; | 1079 | bucket = &priv->mac_hash[ha->addr[MLX4_EN_MAC_HASH_IDX]]; |
1081 | hlist_for_each_entry(entry, n, bucket, hlist) { | 1080 | hlist_for_each_entry(entry, bucket, hlist) { |
1082 | if (ether_addr_equal_64bits(entry->mac, ha->addr)) { | 1081 | if (ether_addr_equal_64bits(entry->mac, ha->addr)) { |
1083 | found = true; | 1082 | found = true; |
1084 | break; | 1083 | break; |
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_rx.c b/drivers/net/ethernet/mellanox/mlx4/en_rx.c index ce38654bbdd0..c7f856308e1a 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_rx.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_rx.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <linux/slab.h> | 35 | #include <linux/slab.h> |
36 | #include <linux/mlx4/qp.h> | 36 | #include <linux/mlx4/qp.h> |
37 | #include <linux/skbuff.h> | 37 | #include <linux/skbuff.h> |
38 | #include <linux/rculist.h> | ||
38 | #include <linux/if_ether.h> | 39 | #include <linux/if_ether.h> |
39 | #include <linux/if_vlan.h> | 40 | #include <linux/if_vlan.h> |
40 | #include <linux/vmalloc.h> | 41 | #include <linux/vmalloc.h> |
@@ -617,7 +618,6 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int bud | |||
617 | 618 | ||
618 | if (is_multicast_ether_addr(ethh->h_dest)) { | 619 | if (is_multicast_ether_addr(ethh->h_dest)) { |
619 | struct mlx4_mac_entry *entry; | 620 | struct mlx4_mac_entry *entry; |
620 | struct hlist_node *n; | ||
621 | struct hlist_head *bucket; | 621 | struct hlist_head *bucket; |
622 | unsigned int mac_hash; | 622 | unsigned int mac_hash; |
623 | 623 | ||
@@ -625,7 +625,7 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int bud | |||
625 | mac_hash = ethh->h_source[MLX4_EN_MAC_HASH_IDX]; | 625 | mac_hash = ethh->h_source[MLX4_EN_MAC_HASH_IDX]; |
626 | bucket = &priv->mac_hash[mac_hash]; | 626 | bucket = &priv->mac_hash[mac_hash]; |
627 | rcu_read_lock(); | 627 | rcu_read_lock(); |
628 | hlist_for_each_entry_rcu(entry, n, bucket, hlist) { | 628 | hlist_for_each_entry_rcu(entry, bucket, hlist) { |
629 | if (ether_addr_equal_64bits(entry->mac, | 629 | if (ether_addr_equal_64bits(entry->mac, |
630 | ethh->h_source)) { | 630 | ethh->h_source)) { |
631 | rcu_read_unlock(); | 631 | rcu_read_unlock(); |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c index 325e11e1ce0f..f89cc7a3fe6c 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c | |||
@@ -576,7 +576,7 @@ void qlcnic_free_mac_list(struct qlcnic_adapter *adapter) | |||
576 | void qlcnic_prune_lb_filters(struct qlcnic_adapter *adapter) | 576 | void qlcnic_prune_lb_filters(struct qlcnic_adapter *adapter) |
577 | { | 577 | { |
578 | struct qlcnic_filter *tmp_fil; | 578 | struct qlcnic_filter *tmp_fil; |
579 | struct hlist_node *tmp_hnode, *n; | 579 | struct hlist_node *n; |
580 | struct hlist_head *head; | 580 | struct hlist_head *head; |
581 | int i; | 581 | int i; |
582 | unsigned long time; | 582 | unsigned long time; |
@@ -584,7 +584,7 @@ void qlcnic_prune_lb_filters(struct qlcnic_adapter *adapter) | |||
584 | 584 | ||
585 | for (i = 0; i < adapter->fhash.fbucket_size; i++) { | 585 | for (i = 0; i < adapter->fhash.fbucket_size; i++) { |
586 | head = &(adapter->fhash.fhead[i]); | 586 | head = &(adapter->fhash.fhead[i]); |
587 | hlist_for_each_entry_safe(tmp_fil, tmp_hnode, n, head, fnode) { | 587 | hlist_for_each_entry_safe(tmp_fil, n, head, fnode) { |
588 | cmd = tmp_fil->vlan_id ? QLCNIC_MAC_VLAN_DEL : | 588 | cmd = tmp_fil->vlan_id ? QLCNIC_MAC_VLAN_DEL : |
589 | QLCNIC_MAC_DEL; | 589 | QLCNIC_MAC_DEL; |
590 | time = tmp_fil->ftime; | 590 | time = tmp_fil->ftime; |
@@ -604,7 +604,7 @@ void qlcnic_prune_lb_filters(struct qlcnic_adapter *adapter) | |||
604 | for (i = 0; i < adapter->rx_fhash.fbucket_size; i++) { | 604 | for (i = 0; i < adapter->rx_fhash.fbucket_size; i++) { |
605 | head = &(adapter->rx_fhash.fhead[i]); | 605 | head = &(adapter->rx_fhash.fhead[i]); |
606 | 606 | ||
607 | hlist_for_each_entry_safe(tmp_fil, tmp_hnode, n, head, fnode) | 607 | hlist_for_each_entry_safe(tmp_fil, n, head, fnode) |
608 | { | 608 | { |
609 | time = tmp_fil->ftime; | 609 | time = tmp_fil->ftime; |
610 | if (jiffies > (QLCNIC_FILTER_AGE * HZ + time)) { | 610 | if (jiffies > (QLCNIC_FILTER_AGE * HZ + time)) { |
@@ -621,14 +621,14 @@ void qlcnic_prune_lb_filters(struct qlcnic_adapter *adapter) | |||
621 | void qlcnic_delete_lb_filters(struct qlcnic_adapter *adapter) | 621 | void qlcnic_delete_lb_filters(struct qlcnic_adapter *adapter) |
622 | { | 622 | { |
623 | struct qlcnic_filter *tmp_fil; | 623 | struct qlcnic_filter *tmp_fil; |
624 | struct hlist_node *tmp_hnode, *n; | 624 | struct hlist_node *n; |
625 | struct hlist_head *head; | 625 | struct hlist_head *head; |
626 | int i; | 626 | int i; |
627 | u8 cmd; | 627 | u8 cmd; |
628 | 628 | ||
629 | for (i = 0; i < adapter->fhash.fbucket_size; i++) { | 629 | for (i = 0; i < adapter->fhash.fbucket_size; i++) { |
630 | head = &(adapter->fhash.fhead[i]); | 630 | head = &(adapter->fhash.fhead[i]); |
631 | hlist_for_each_entry_safe(tmp_fil, tmp_hnode, n, head, fnode) { | 631 | hlist_for_each_entry_safe(tmp_fil, n, head, fnode) { |
632 | cmd = tmp_fil->vlan_id ? QLCNIC_MAC_VLAN_DEL : | 632 | cmd = tmp_fil->vlan_id ? QLCNIC_MAC_VLAN_DEL : |
633 | QLCNIC_MAC_DEL; | 633 | QLCNIC_MAC_DEL; |
634 | qlcnic_sre_macaddr_change(adapter, | 634 | qlcnic_sre_macaddr_change(adapter, |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c index 6387e0cc3ea9..0e630061bff3 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c | |||
@@ -162,7 +162,7 @@ void qlcnic_add_lb_filter(struct qlcnic_adapter *adapter, struct sk_buff *skb, | |||
162 | { | 162 | { |
163 | struct ethhdr *phdr = (struct ethhdr *)(skb->data); | 163 | struct ethhdr *phdr = (struct ethhdr *)(skb->data); |
164 | struct qlcnic_filter *fil, *tmp_fil; | 164 | struct qlcnic_filter *fil, *tmp_fil; |
165 | struct hlist_node *tmp_hnode, *n; | 165 | struct hlist_node *n; |
166 | struct hlist_head *head; | 166 | struct hlist_head *head; |
167 | unsigned long time; | 167 | unsigned long time; |
168 | u64 src_addr = 0; | 168 | u64 src_addr = 0; |
@@ -179,7 +179,7 @@ void qlcnic_add_lb_filter(struct qlcnic_adapter *adapter, struct sk_buff *skb, | |||
179 | (adapter->fhash.fbucket_size - 1); | 179 | (adapter->fhash.fbucket_size - 1); |
180 | head = &(adapter->rx_fhash.fhead[hindex]); | 180 | head = &(adapter->rx_fhash.fhead[hindex]); |
181 | 181 | ||
182 | hlist_for_each_entry_safe(tmp_fil, tmp_hnode, n, head, fnode) { | 182 | hlist_for_each_entry_safe(tmp_fil, n, head, fnode) { |
183 | if (!memcmp(tmp_fil->faddr, &src_addr, ETH_ALEN) && | 183 | if (!memcmp(tmp_fil->faddr, &src_addr, ETH_ALEN) && |
184 | tmp_fil->vlan_id == vlan_id) { | 184 | tmp_fil->vlan_id == vlan_id) { |
185 | time = tmp_fil->ftime; | 185 | time = tmp_fil->ftime; |
@@ -205,7 +205,7 @@ void qlcnic_add_lb_filter(struct qlcnic_adapter *adapter, struct sk_buff *skb, | |||
205 | (adapter->fhash.fbucket_size - 1); | 205 | (adapter->fhash.fbucket_size - 1); |
206 | head = &(adapter->rx_fhash.fhead[hindex]); | 206 | head = &(adapter->rx_fhash.fhead[hindex]); |
207 | spin_lock(&adapter->rx_mac_learn_lock); | 207 | spin_lock(&adapter->rx_mac_learn_lock); |
208 | hlist_for_each_entry_safe(tmp_fil, tmp_hnode, n, head, fnode) { | 208 | hlist_for_each_entry_safe(tmp_fil, n, head, fnode) { |
209 | if (!memcmp(tmp_fil->faddr, &src_addr, ETH_ALEN) && | 209 | if (!memcmp(tmp_fil->faddr, &src_addr, ETH_ALEN) && |
210 | tmp_fil->vlan_id == vlan_id) { | 210 | tmp_fil->vlan_id == vlan_id) { |
211 | found = 1; | 211 | found = 1; |
@@ -272,7 +272,7 @@ static void qlcnic_send_filter(struct qlcnic_adapter *adapter, | |||
272 | struct sk_buff *skb) | 272 | struct sk_buff *skb) |
273 | { | 273 | { |
274 | struct qlcnic_filter *fil, *tmp_fil; | 274 | struct qlcnic_filter *fil, *tmp_fil; |
275 | struct hlist_node *tmp_hnode, *n; | 275 | struct hlist_node *n; |
276 | struct hlist_head *head; | 276 | struct hlist_head *head; |
277 | struct net_device *netdev = adapter->netdev; | 277 | struct net_device *netdev = adapter->netdev; |
278 | struct ethhdr *phdr = (struct ethhdr *)(skb->data); | 278 | struct ethhdr *phdr = (struct ethhdr *)(skb->data); |
@@ -294,7 +294,7 @@ static void qlcnic_send_filter(struct qlcnic_adapter *adapter, | |||
294 | hindex = qlcnic_mac_hash(src_addr) & (adapter->fhash.fbucket_size - 1); | 294 | hindex = qlcnic_mac_hash(src_addr) & (adapter->fhash.fbucket_size - 1); |
295 | head = &(adapter->fhash.fhead[hindex]); | 295 | head = &(adapter->fhash.fhead[hindex]); |
296 | 296 | ||
297 | hlist_for_each_entry_safe(tmp_fil, tmp_hnode, n, head, fnode) { | 297 | hlist_for_each_entry_safe(tmp_fil, n, head, fnode) { |
298 | if (!memcmp(tmp_fil->faddr, &src_addr, ETH_ALEN) && | 298 | if (!memcmp(tmp_fil->faddr, &src_addr, ETH_ALEN) && |
299 | tmp_fil->vlan_id == vlan_id) { | 299 | tmp_fil->vlan_id == vlan_id) { |
300 | if (jiffies > (QLCNIC_READD_AGE * HZ + tmp_fil->ftime)) | 300 | if (jiffies > (QLCNIC_READD_AGE * HZ + tmp_fil->ftime)) |
diff --git a/drivers/net/ethernet/sun/sunvnet.c b/drivers/net/ethernet/sun/sunvnet.c index 289b4eefb42f..1df0ff3839e8 100644 --- a/drivers/net/ethernet/sun/sunvnet.c +++ b/drivers/net/ethernet/sun/sunvnet.c | |||
@@ -614,10 +614,9 @@ struct vnet_port *__tx_port_find(struct vnet *vp, struct sk_buff *skb) | |||
614 | { | 614 | { |
615 | unsigned int hash = vnet_hashfn(skb->data); | 615 | unsigned int hash = vnet_hashfn(skb->data); |
616 | struct hlist_head *hp = &vp->port_hash[hash]; | 616 | struct hlist_head *hp = &vp->port_hash[hash]; |
617 | struct hlist_node *n; | ||
618 | struct vnet_port *port; | 617 | struct vnet_port *port; |
619 | 618 | ||
620 | hlist_for_each_entry(port, n, hp, hash) { | 619 | hlist_for_each_entry(port, hp, hash) { |
621 | if (ether_addr_equal(port->raddr, skb->data)) | 620 | if (ether_addr_equal(port->raddr, skb->data)) |
622 | return port; | 621 | return port; |
623 | } | 622 | } |
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c index defcd8a85744..417b2af1aa80 100644 --- a/drivers/net/macvlan.c +++ b/drivers/net/macvlan.c | |||
@@ -55,9 +55,8 @@ static struct macvlan_dev *macvlan_hash_lookup(const struct macvlan_port *port, | |||
55 | const unsigned char *addr) | 55 | const unsigned char *addr) |
56 | { | 56 | { |
57 | struct macvlan_dev *vlan; | 57 | struct macvlan_dev *vlan; |
58 | struct hlist_node *n; | ||
59 | 58 | ||
60 | hlist_for_each_entry_rcu(vlan, n, &port->vlan_hash[addr[5]], hlist) { | 59 | hlist_for_each_entry_rcu(vlan, &port->vlan_hash[addr[5]], hlist) { |
61 | if (ether_addr_equal_64bits(vlan->dev->dev_addr, addr)) | 60 | if (ether_addr_equal_64bits(vlan->dev->dev_addr, addr)) |
62 | return vlan; | 61 | return vlan; |
63 | } | 62 | } |
@@ -149,7 +148,6 @@ static void macvlan_broadcast(struct sk_buff *skb, | |||
149 | { | 148 | { |
150 | const struct ethhdr *eth = eth_hdr(skb); | 149 | const struct ethhdr *eth = eth_hdr(skb); |
151 | const struct macvlan_dev *vlan; | 150 | const struct macvlan_dev *vlan; |
152 | struct hlist_node *n; | ||
153 | struct sk_buff *nskb; | 151 | struct sk_buff *nskb; |
154 | unsigned int i; | 152 | unsigned int i; |
155 | int err; | 153 | int err; |
@@ -159,7 +157,7 @@ static void macvlan_broadcast(struct sk_buff *skb, | |||
159 | return; | 157 | return; |
160 | 158 | ||
161 | for (i = 0; i < MACVLAN_HASH_SIZE; i++) { | 159 | for (i = 0; i < MACVLAN_HASH_SIZE; i++) { |
162 | hlist_for_each_entry_rcu(vlan, n, &port->vlan_hash[i], hlist) { | 160 | hlist_for_each_entry_rcu(vlan, &port->vlan_hash[i], hlist) { |
163 | if (vlan->dev == src || !(vlan->mode & mode)) | 161 | if (vlan->dev == src || !(vlan->mode & mode)) |
164 | continue; | 162 | continue; |
165 | 163 | ||
diff --git a/drivers/net/tun.c b/drivers/net/tun.c index b6f45c5d84d5..2c6a22e278ea 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c | |||
@@ -197,9 +197,8 @@ static inline u32 tun_hashfn(u32 rxhash) | |||
197 | static struct tun_flow_entry *tun_flow_find(struct hlist_head *head, u32 rxhash) | 197 | static struct tun_flow_entry *tun_flow_find(struct hlist_head *head, u32 rxhash) |
198 | { | 198 | { |
199 | struct tun_flow_entry *e; | 199 | struct tun_flow_entry *e; |
200 | struct hlist_node *n; | ||
201 | 200 | ||
202 | hlist_for_each_entry_rcu(e, n, head, hash_link) { | 201 | hlist_for_each_entry_rcu(e, head, hash_link) { |
203 | if (e->rxhash == rxhash) | 202 | if (e->rxhash == rxhash) |
204 | return e; | 203 | return e; |
205 | } | 204 | } |
@@ -241,9 +240,9 @@ static void tun_flow_flush(struct tun_struct *tun) | |||
241 | spin_lock_bh(&tun->lock); | 240 | spin_lock_bh(&tun->lock); |
242 | for (i = 0; i < TUN_NUM_FLOW_ENTRIES; i++) { | 241 | for (i = 0; i < TUN_NUM_FLOW_ENTRIES; i++) { |
243 | struct tun_flow_entry *e; | 242 | struct tun_flow_entry *e; |
244 | struct hlist_node *h, *n; | 243 | struct hlist_node *n; |
245 | 244 | ||
246 | hlist_for_each_entry_safe(e, h, n, &tun->flows[i], hash_link) | 245 | hlist_for_each_entry_safe(e, n, &tun->flows[i], hash_link) |
247 | tun_flow_delete(tun, e); | 246 | tun_flow_delete(tun, e); |
248 | } | 247 | } |
249 | spin_unlock_bh(&tun->lock); | 248 | spin_unlock_bh(&tun->lock); |
@@ -256,9 +255,9 @@ static void tun_flow_delete_by_queue(struct tun_struct *tun, u16 queue_index) | |||
256 | spin_lock_bh(&tun->lock); | 255 | spin_lock_bh(&tun->lock); |
257 | for (i = 0; i < TUN_NUM_FLOW_ENTRIES; i++) { | 256 | for (i = 0; i < TUN_NUM_FLOW_ENTRIES; i++) { |
258 | struct tun_flow_entry *e; | 257 | struct tun_flow_entry *e; |
259 | struct hlist_node *h, *n; | 258 | struct hlist_node *n; |
260 | 259 | ||
261 | hlist_for_each_entry_safe(e, h, n, &tun->flows[i], hash_link) { | 260 | hlist_for_each_entry_safe(e, n, &tun->flows[i], hash_link) { |
262 | if (e->queue_index == queue_index) | 261 | if (e->queue_index == queue_index) |
263 | tun_flow_delete(tun, e); | 262 | tun_flow_delete(tun, e); |
264 | } | 263 | } |
@@ -279,9 +278,9 @@ static void tun_flow_cleanup(unsigned long data) | |||
279 | spin_lock_bh(&tun->lock); | 278 | spin_lock_bh(&tun->lock); |
280 | for (i = 0; i < TUN_NUM_FLOW_ENTRIES; i++) { | 279 | for (i = 0; i < TUN_NUM_FLOW_ENTRIES; i++) { |
281 | struct tun_flow_entry *e; | 280 | struct tun_flow_entry *e; |
282 | struct hlist_node *h, *n; | 281 | struct hlist_node *n; |
283 | 282 | ||
284 | hlist_for_each_entry_safe(e, h, n, &tun->flows[i], hash_link) { | 283 | hlist_for_each_entry_safe(e, n, &tun->flows[i], hash_link) { |
285 | unsigned long this_timer; | 284 | unsigned long this_timer; |
286 | count++; | 285 | count++; |
287 | this_timer = e->updated + delay; | 286 | this_timer = e->updated + delay; |
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index f736823f8437..f10e58ac9c1b 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c | |||
@@ -145,9 +145,8 @@ static inline struct hlist_head *vni_head(struct net *net, u32 id) | |||
145 | static struct vxlan_dev *vxlan_find_vni(struct net *net, u32 id) | 145 | static struct vxlan_dev *vxlan_find_vni(struct net *net, u32 id) |
146 | { | 146 | { |
147 | struct vxlan_dev *vxlan; | 147 | struct vxlan_dev *vxlan; |
148 | struct hlist_node *node; | ||
149 | 148 | ||
150 | hlist_for_each_entry_rcu(vxlan, node, vni_head(net, id), hlist) { | 149 | hlist_for_each_entry_rcu(vxlan, vni_head(net, id), hlist) { |
151 | if (vxlan->vni == id) | 150 | if (vxlan->vni == id) |
152 | return vxlan; | 151 | return vxlan; |
153 | } | 152 | } |
@@ -292,9 +291,8 @@ static struct vxlan_fdb *vxlan_find_mac(struct vxlan_dev *vxlan, | |||
292 | { | 291 | { |
293 | struct hlist_head *head = vxlan_fdb_head(vxlan, mac); | 292 | struct hlist_head *head = vxlan_fdb_head(vxlan, mac); |
294 | struct vxlan_fdb *f; | 293 | struct vxlan_fdb *f; |
295 | struct hlist_node *node; | ||
296 | 294 | ||
297 | hlist_for_each_entry_rcu(f, node, head, hlist) { | 295 | hlist_for_each_entry_rcu(f, head, hlist) { |
298 | if (compare_ether_addr(mac, f->eth_addr) == 0) | 296 | if (compare_ether_addr(mac, f->eth_addr) == 0) |
299 | return f; | 297 | return f; |
300 | } | 298 | } |
@@ -422,10 +420,9 @@ static int vxlan_fdb_dump(struct sk_buff *skb, struct netlink_callback *cb, | |||
422 | 420 | ||
423 | for (h = 0; h < FDB_HASH_SIZE; ++h) { | 421 | for (h = 0; h < FDB_HASH_SIZE; ++h) { |
424 | struct vxlan_fdb *f; | 422 | struct vxlan_fdb *f; |
425 | struct hlist_node *n; | ||
426 | int err; | 423 | int err; |
427 | 424 | ||
428 | hlist_for_each_entry_rcu(f, n, &vxlan->fdb_head[h], hlist) { | 425 | hlist_for_each_entry_rcu(f, &vxlan->fdb_head[h], hlist) { |
429 | if (idx < cb->args[0]) | 426 | if (idx < cb->args[0]) |
430 | goto skip; | 427 | goto skip; |
431 | 428 | ||
@@ -483,11 +480,10 @@ static bool vxlan_group_used(struct vxlan_net *vn, | |||
483 | const struct vxlan_dev *this) | 480 | const struct vxlan_dev *this) |
484 | { | 481 | { |
485 | const struct vxlan_dev *vxlan; | 482 | const struct vxlan_dev *vxlan; |
486 | struct hlist_node *node; | ||
487 | unsigned h; | 483 | unsigned h; |
488 | 484 | ||
489 | for (h = 0; h < VNI_HASH_SIZE; ++h) | 485 | for (h = 0; h < VNI_HASH_SIZE; ++h) |
490 | hlist_for_each_entry(vxlan, node, &vn->vni_list[h], hlist) { | 486 | hlist_for_each_entry(vxlan, &vn->vni_list[h], hlist) { |
491 | if (vxlan == this) | 487 | if (vxlan == this) |
492 | continue; | 488 | continue; |
493 | 489 | ||
diff --git a/drivers/net/wireless/zd1201.c b/drivers/net/wireless/zd1201.c index 48273dd05b63..4941f201d6c8 100644 --- a/drivers/net/wireless/zd1201.c +++ b/drivers/net/wireless/zd1201.c | |||
@@ -309,7 +309,6 @@ static void zd1201_usbrx(struct urb *urb) | |||
309 | if (data[urb->actual_length-1] == ZD1201_PACKET_RXDATA) { | 309 | if (data[urb->actual_length-1] == ZD1201_PACKET_RXDATA) { |
310 | int datalen = urb->actual_length-1; | 310 | int datalen = urb->actual_length-1; |
311 | unsigned short len, fc, seq; | 311 | unsigned short len, fc, seq; |
312 | struct hlist_node *node; | ||
313 | 312 | ||
314 | len = ntohs(*(__be16 *)&data[datalen-2]); | 313 | len = ntohs(*(__be16 *)&data[datalen-2]); |
315 | if (len>datalen) | 314 | if (len>datalen) |
@@ -362,7 +361,7 @@ static void zd1201_usbrx(struct urb *urb) | |||
362 | hlist_add_head(&frag->fnode, &zd->fraglist); | 361 | hlist_add_head(&frag->fnode, &zd->fraglist); |
363 | goto resubmit; | 362 | goto resubmit; |
364 | } | 363 | } |
365 | hlist_for_each_entry(frag, node, &zd->fraglist, fnode) | 364 | hlist_for_each_entry(frag, &zd->fraglist, fnode) |
366 | if (frag->seq == (seq&IEEE80211_SCTL_SEQ)) | 365 | if (frag->seq == (seq&IEEE80211_SCTL_SEQ)) |
367 | break; | 366 | break; |
368 | if (!frag) | 367 | if (!frag) |
@@ -1831,14 +1830,14 @@ err_zd: | |||
1831 | static void zd1201_disconnect(struct usb_interface *interface) | 1830 | static void zd1201_disconnect(struct usb_interface *interface) |
1832 | { | 1831 | { |
1833 | struct zd1201 *zd = usb_get_intfdata(interface); | 1832 | struct zd1201 *zd = usb_get_intfdata(interface); |
1834 | struct hlist_node *node, *node2; | 1833 | struct hlist_node *node2; |
1835 | struct zd1201_frag *frag; | 1834 | struct zd1201_frag *frag; |
1836 | 1835 | ||
1837 | if (!zd) | 1836 | if (!zd) |
1838 | return; | 1837 | return; |
1839 | usb_set_intfdata(interface, NULL); | 1838 | usb_set_intfdata(interface, NULL); |
1840 | 1839 | ||
1841 | hlist_for_each_entry_safe(frag, node, node2, &zd->fraglist, fnode) { | 1840 | hlist_for_each_entry_safe(frag, node2, &zd->fraglist, fnode) { |
1842 | hlist_del_init(&frag->fnode); | 1841 | hlist_del_init(&frag->fnode); |
1843 | kfree_skb(frag->skb); | 1842 | kfree_skb(frag->skb); |
1844 | kfree(frag); | 1843 | kfree(frag); |
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 924e4665bd57..b099e0025d2b 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -842,9 +842,8 @@ static struct pci_cap_saved_state *pci_find_saved_cap( | |||
842 | struct pci_dev *pci_dev, char cap) | 842 | struct pci_dev *pci_dev, char cap) |
843 | { | 843 | { |
844 | struct pci_cap_saved_state *tmp; | 844 | struct pci_cap_saved_state *tmp; |
845 | struct hlist_node *pos; | ||
846 | 845 | ||
847 | hlist_for_each_entry(tmp, pos, &pci_dev->saved_cap_space, next) { | 846 | hlist_for_each_entry(tmp, &pci_dev->saved_cap_space, next) { |
848 | if (tmp->cap.cap_nr == cap) | 847 | if (tmp->cap.cap_nr == cap) |
849 | return tmp; | 848 | return tmp; |
850 | } | 849 | } |
@@ -1041,7 +1040,6 @@ struct pci_saved_state *pci_store_saved_state(struct pci_dev *dev) | |||
1041 | struct pci_saved_state *state; | 1040 | struct pci_saved_state *state; |
1042 | struct pci_cap_saved_state *tmp; | 1041 | struct pci_cap_saved_state *tmp; |
1043 | struct pci_cap_saved_data *cap; | 1042 | struct pci_cap_saved_data *cap; |
1044 | struct hlist_node *pos; | ||
1045 | size_t size; | 1043 | size_t size; |
1046 | 1044 | ||
1047 | if (!dev->state_saved) | 1045 | if (!dev->state_saved) |
@@ -1049,7 +1047,7 @@ struct pci_saved_state *pci_store_saved_state(struct pci_dev *dev) | |||
1049 | 1047 | ||
1050 | size = sizeof(*state) + sizeof(struct pci_cap_saved_data); | 1048 | size = sizeof(*state) + sizeof(struct pci_cap_saved_data); |
1051 | 1049 | ||
1052 | hlist_for_each_entry(tmp, pos, &dev->saved_cap_space, next) | 1050 | hlist_for_each_entry(tmp, &dev->saved_cap_space, next) |
1053 | size += sizeof(struct pci_cap_saved_data) + tmp->cap.size; | 1051 | size += sizeof(struct pci_cap_saved_data) + tmp->cap.size; |
1054 | 1052 | ||
1055 | state = kzalloc(size, GFP_KERNEL); | 1053 | state = kzalloc(size, GFP_KERNEL); |
@@ -1060,7 +1058,7 @@ struct pci_saved_state *pci_store_saved_state(struct pci_dev *dev) | |||
1060 | sizeof(state->config_space)); | 1058 | sizeof(state->config_space)); |
1061 | 1059 | ||
1062 | cap = state->cap; | 1060 | cap = state->cap; |
1063 | hlist_for_each_entry(tmp, pos, &dev->saved_cap_space, next) { | 1061 | hlist_for_each_entry(tmp, &dev->saved_cap_space, next) { |
1064 | size_t len = sizeof(struct pci_cap_saved_data) + tmp->cap.size; | 1062 | size_t len = sizeof(struct pci_cap_saved_data) + tmp->cap.size; |
1065 | memcpy(cap, &tmp->cap, len); | 1063 | memcpy(cap, &tmp->cap, len); |
1066 | cap = (struct pci_cap_saved_data *)((u8 *)cap + len); | 1064 | cap = (struct pci_cap_saved_data *)((u8 *)cap + len); |
@@ -2038,9 +2036,9 @@ void pci_allocate_cap_save_buffers(struct pci_dev *dev) | |||
2038 | void pci_free_cap_save_buffers(struct pci_dev *dev) | 2036 | void pci_free_cap_save_buffers(struct pci_dev *dev) |
2039 | { | 2037 | { |
2040 | struct pci_cap_saved_state *tmp; | 2038 | struct pci_cap_saved_state *tmp; |
2041 | struct hlist_node *pos, *n; | 2039 | struct hlist_node *n; |
2042 | 2040 | ||
2043 | hlist_for_each_entry_safe(tmp, pos, n, &dev->saved_cap_space, next) | 2041 | hlist_for_each_entry_safe(tmp, n, &dev->saved_cap_space, next) |
2044 | kfree(tmp); | 2042 | kfree(tmp); |
2045 | } | 2043 | } |
2046 | 2044 | ||
diff --git a/drivers/staging/android/binder.c b/drivers/staging/android/binder.c index 538ebe213129..24456a0de6b2 100644 --- a/drivers/staging/android/binder.c +++ b/drivers/staging/android/binder.c | |||
@@ -2880,7 +2880,6 @@ static int binder_release(struct inode *nodp, struct file *filp) | |||
2880 | 2880 | ||
2881 | static void binder_deferred_release(struct binder_proc *proc) | 2881 | static void binder_deferred_release(struct binder_proc *proc) |
2882 | { | 2882 | { |
2883 | struct hlist_node *pos; | ||
2884 | struct binder_transaction *t; | 2883 | struct binder_transaction *t; |
2885 | struct rb_node *n; | 2884 | struct rb_node *n; |
2886 | int threads, nodes, incoming_refs, outgoing_refs, buffers, active_transactions, page_count; | 2885 | int threads, nodes, incoming_refs, outgoing_refs, buffers, active_transactions, page_count; |
@@ -2924,7 +2923,7 @@ static void binder_deferred_release(struct binder_proc *proc) | |||
2924 | node->local_weak_refs = 0; | 2923 | node->local_weak_refs = 0; |
2925 | hlist_add_head(&node->dead_node, &binder_dead_nodes); | 2924 | hlist_add_head(&node->dead_node, &binder_dead_nodes); |
2926 | 2925 | ||
2927 | hlist_for_each_entry(ref, pos, &node->refs, node_entry) { | 2926 | hlist_for_each_entry(ref, &node->refs, node_entry) { |
2928 | incoming_refs++; | 2927 | incoming_refs++; |
2929 | if (ref->death) { | 2928 | if (ref->death) { |
2930 | death++; | 2929 | death++; |
@@ -3156,12 +3155,11 @@ static void print_binder_thread(struct seq_file *m, | |||
3156 | static void print_binder_node(struct seq_file *m, struct binder_node *node) | 3155 | static void print_binder_node(struct seq_file *m, struct binder_node *node) |
3157 | { | 3156 | { |
3158 | struct binder_ref *ref; | 3157 | struct binder_ref *ref; |
3159 | struct hlist_node *pos; | ||
3160 | struct binder_work *w; | 3158 | struct binder_work *w; |
3161 | int count; | 3159 | int count; |
3162 | 3160 | ||
3163 | count = 0; | 3161 | count = 0; |
3164 | hlist_for_each_entry(ref, pos, &node->refs, node_entry) | 3162 | hlist_for_each_entry(ref, &node->refs, node_entry) |
3165 | count++; | 3163 | count++; |
3166 | 3164 | ||
3167 | seq_printf(m, " node %d: u%p c%p hs %d hw %d ls %d lw %d is %d iw %d", | 3165 | seq_printf(m, " node %d: u%p c%p hs %d hw %d ls %d lw %d is %d iw %d", |
@@ -3171,7 +3169,7 @@ static void print_binder_node(struct seq_file *m, struct binder_node *node) | |||
3171 | node->internal_strong_refs, count); | 3169 | node->internal_strong_refs, count); |
3172 | if (count) { | 3170 | if (count) { |
3173 | seq_puts(m, " proc"); | 3171 | seq_puts(m, " proc"); |
3174 | hlist_for_each_entry(ref, pos, &node->refs, node_entry) | 3172 | hlist_for_each_entry(ref, &node->refs, node_entry) |
3175 | seq_printf(m, " %d", ref->proc->pid); | 3173 | seq_printf(m, " %d", ref->proc->pid); |
3176 | } | 3174 | } |
3177 | seq_puts(m, "\n"); | 3175 | seq_puts(m, "\n"); |
@@ -3369,7 +3367,6 @@ static void print_binder_proc_stats(struct seq_file *m, | |||
3369 | static int binder_state_show(struct seq_file *m, void *unused) | 3367 | static int binder_state_show(struct seq_file *m, void *unused) |
3370 | { | 3368 | { |
3371 | struct binder_proc *proc; | 3369 | struct binder_proc *proc; |
3372 | struct hlist_node *pos; | ||
3373 | struct binder_node *node; | 3370 | struct binder_node *node; |
3374 | int do_lock = !binder_debug_no_lock; | 3371 | int do_lock = !binder_debug_no_lock; |
3375 | 3372 | ||
@@ -3380,10 +3377,10 @@ static int binder_state_show(struct seq_file *m, void *unused) | |||
3380 | 3377 | ||
3381 | if (!hlist_empty(&binder_dead_nodes)) | 3378 | if (!hlist_empty(&binder_dead_nodes)) |
3382 | seq_puts(m, "dead nodes:\n"); | 3379 | seq_puts(m, "dead nodes:\n"); |
3383 | hlist_for_each_entry(node, pos, &binder_dead_nodes, dead_node) | 3380 | hlist_for_each_entry(node, &binder_dead_nodes, dead_node) |
3384 | print_binder_node(m, node); | 3381 | print_binder_node(m, node); |
3385 | 3382 | ||
3386 | hlist_for_each_entry(proc, pos, &binder_procs, proc_node) | 3383 | hlist_for_each_entry(proc, &binder_procs, proc_node) |
3387 | print_binder_proc(m, proc, 1); | 3384 | print_binder_proc(m, proc, 1); |
3388 | if (do_lock) | 3385 | if (do_lock) |
3389 | binder_unlock(__func__); | 3386 | binder_unlock(__func__); |
@@ -3393,7 +3390,6 @@ static int binder_state_show(struct seq_file *m, void *unused) | |||
3393 | static int binder_stats_show(struct seq_file *m, void *unused) | 3390 | static int binder_stats_show(struct seq_file *m, void *unused) |
3394 | { | 3391 | { |
3395 | struct binder_proc *proc; | 3392 | struct binder_proc *proc; |
3396 | struct hlist_node *pos; | ||
3397 | int do_lock = !binder_debug_no_lock; | 3393 | int do_lock = !binder_debug_no_lock; |
3398 | 3394 | ||
3399 | if (do_lock) | 3395 | if (do_lock) |
@@ -3403,7 +3399,7 @@ static int binder_stats_show(struct seq_file *m, void *unused) | |||
3403 | 3399 | ||
3404 | print_binder_stats(m, "", &binder_stats); | 3400 | print_binder_stats(m, "", &binder_stats); |
3405 | 3401 | ||
3406 | hlist_for_each_entry(proc, pos, &binder_procs, proc_node) | 3402 | hlist_for_each_entry(proc, &binder_procs, proc_node) |
3407 | print_binder_proc_stats(m, proc); | 3403 | print_binder_proc_stats(m, proc); |
3408 | if (do_lock) | 3404 | if (do_lock) |
3409 | binder_unlock(__func__); | 3405 | binder_unlock(__func__); |
@@ -3413,14 +3409,13 @@ static int binder_stats_show(struct seq_file *m, void *unused) | |||
3413 | static int binder_transactions_show(struct seq_file *m, void *unused) | 3409 | static int binder_transactions_show(struct seq_file *m, void *unused) |
3414 | { | 3410 | { |
3415 | struct binder_proc *proc; | 3411 | struct binder_proc *proc; |
3416 | struct hlist_node *pos; | ||
3417 | int do_lock = !binder_debug_no_lock; | 3412 | int do_lock = !binder_debug_no_lock; |
3418 | 3413 | ||
3419 | if (do_lock) | 3414 | if (do_lock) |
3420 | binder_lock(__func__); | 3415 | binder_lock(__func__); |
3421 | 3416 | ||
3422 | seq_puts(m, "binder transactions:\n"); | 3417 | seq_puts(m, "binder transactions:\n"); |
3423 | hlist_for_each_entry(proc, pos, &binder_procs, proc_node) | 3418 | hlist_for_each_entry(proc, &binder_procs, proc_node) |
3424 | print_binder_proc(m, proc, 0); | 3419 | print_binder_proc(m, proc, 0); |
3425 | if (do_lock) | 3420 | if (do_lock) |
3426 | binder_unlock(__func__); | 3421 | binder_unlock(__func__); |
diff --git a/drivers/target/tcm_fc/tfc_sess.c b/drivers/target/tcm_fc/tfc_sess.c index 6659dd36e806..113f33598b9f 100644 --- a/drivers/target/tcm_fc/tfc_sess.c +++ b/drivers/target/tcm_fc/tfc_sess.c | |||
@@ -169,7 +169,6 @@ static struct ft_sess *ft_sess_get(struct fc_lport *lport, u32 port_id) | |||
169 | { | 169 | { |
170 | struct ft_tport *tport; | 170 | struct ft_tport *tport; |
171 | struct hlist_head *head; | 171 | struct hlist_head *head; |
172 | struct hlist_node *pos; | ||
173 | struct ft_sess *sess; | 172 | struct ft_sess *sess; |
174 | 173 | ||
175 | rcu_read_lock(); | 174 | rcu_read_lock(); |
@@ -178,7 +177,7 @@ static struct ft_sess *ft_sess_get(struct fc_lport *lport, u32 port_id) | |||
178 | goto out; | 177 | goto out; |
179 | 178 | ||
180 | head = &tport->hash[ft_sess_hash(port_id)]; | 179 | head = &tport->hash[ft_sess_hash(port_id)]; |
181 | hlist_for_each_entry_rcu(sess, pos, head, hash) { | 180 | hlist_for_each_entry_rcu(sess, head, hash) { |
182 | if (sess->port_id == port_id) { | 181 | if (sess->port_id == port_id) { |
183 | kref_get(&sess->kref); | 182 | kref_get(&sess->kref); |
184 | rcu_read_unlock(); | 183 | rcu_read_unlock(); |
@@ -201,10 +200,9 @@ static struct ft_sess *ft_sess_create(struct ft_tport *tport, u32 port_id, | |||
201 | { | 200 | { |
202 | struct ft_sess *sess; | 201 | struct ft_sess *sess; |
203 | struct hlist_head *head; | 202 | struct hlist_head *head; |
204 | struct hlist_node *pos; | ||
205 | 203 | ||
206 | head = &tport->hash[ft_sess_hash(port_id)]; | 204 | head = &tport->hash[ft_sess_hash(port_id)]; |
207 | hlist_for_each_entry_rcu(sess, pos, head, hash) | 205 | hlist_for_each_entry_rcu(sess, head, hash) |
208 | if (sess->port_id == port_id) | 206 | if (sess->port_id == port_id) |
209 | return sess; | 207 | return sess; |
210 | 208 | ||
@@ -253,11 +251,10 @@ static void ft_sess_unhash(struct ft_sess *sess) | |||
253 | static struct ft_sess *ft_sess_delete(struct ft_tport *tport, u32 port_id) | 251 | static struct ft_sess *ft_sess_delete(struct ft_tport *tport, u32 port_id) |
254 | { | 252 | { |
255 | struct hlist_head *head; | 253 | struct hlist_head *head; |
256 | struct hlist_node *pos; | ||
257 | struct ft_sess *sess; | 254 | struct ft_sess *sess; |
258 | 255 | ||
259 | head = &tport->hash[ft_sess_hash(port_id)]; | 256 | head = &tport->hash[ft_sess_hash(port_id)]; |
260 | hlist_for_each_entry_rcu(sess, pos, head, hash) { | 257 | hlist_for_each_entry_rcu(sess, head, hash) { |
261 | if (sess->port_id == port_id) { | 258 | if (sess->port_id == port_id) { |
262 | ft_sess_unhash(sess); | 259 | ft_sess_unhash(sess); |
263 | return sess; | 260 | return sess; |
@@ -273,12 +270,11 @@ static struct ft_sess *ft_sess_delete(struct ft_tport *tport, u32 port_id) | |||
273 | static void ft_sess_delete_all(struct ft_tport *tport) | 270 | static void ft_sess_delete_all(struct ft_tport *tport) |
274 | { | 271 | { |
275 | struct hlist_head *head; | 272 | struct hlist_head *head; |
276 | struct hlist_node *pos; | ||
277 | struct ft_sess *sess; | 273 | struct ft_sess *sess; |
278 | 274 | ||
279 | for (head = tport->hash; | 275 | for (head = tport->hash; |
280 | head < &tport->hash[FT_SESS_HASH_SIZE]; head++) { | 276 | head < &tport->hash[FT_SESS_HASH_SIZE]; head++) { |
281 | hlist_for_each_entry_rcu(sess, pos, head, hash) { | 277 | hlist_for_each_entry_rcu(sess, head, hash) { |
282 | ft_sess_unhash(sess); | 278 | ft_sess_unhash(sess); |
283 | transport_deregister_session_configfs(sess->se_sess); | 279 | transport_deregister_session_configfs(sess->se_sess); |
284 | ft_sess_put(sess); /* release from table */ | 280 | ft_sess_put(sess); /* release from table */ |