aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/linux/hashtable.h40
-rw-r--r--include/linux/if_team.h6
-rw-r--r--include/linux/list.h49
-rw-r--r--include/linux/pid.h3
-rw-r--r--include/linux/rculist.h56
-rw-r--r--include/net/ax25.h8
-rw-r--r--include/net/inet_hashtables.h4
-rw-r--r--include/net/inet_timewait_sock.h8
-rw-r--r--include/net/netrom.h16
-rw-r--r--include/net/sch_generic.h3
-rw-r--r--include/net/sctp/sctp.h4
-rw-r--r--include/net/sock.h21
12 files changed, 103 insertions, 115 deletions
diff --git a/include/linux/hashtable.h b/include/linux/hashtable.h
index 227c62424f3c..a9df51f5d54c 100644
--- a/include/linux/hashtable.h
+++ b/include/linux/hashtable.h
@@ -115,51 +115,50 @@ static inline void hash_del_rcu(struct hlist_node *node)
115 * hash_for_each - iterate over a hashtable 115 * hash_for_each - iterate over a hashtable
116 * @name: hashtable to iterate 116 * @name: hashtable to iterate
117 * @bkt: integer to use as bucket loop cursor 117 * @bkt: integer to use as bucket loop cursor
118 * @node: the &struct list_head to use as a loop cursor for each entry
119 * @obj: the type * to use as a loop cursor for each entry 118 * @obj: the type * to use as a loop cursor for each entry
120 * @member: the name of the hlist_node within the struct 119 * @member: the name of the hlist_node within the struct
121 */ 120 */
122#define hash_for_each(name, bkt, node, obj, member) \ 121#define hash_for_each(name, bkt, obj, member) \
123 for ((bkt) = 0, node = NULL; node == NULL && (bkt) < HASH_SIZE(name); (bkt)++)\ 122 for ((bkt) = 0, obj = NULL; obj == NULL && (bkt) < HASH_SIZE(name);\
124 hlist_for_each_entry(obj, node, &name[bkt], member) 123 (bkt)++)\
124 hlist_for_each_entry(obj, &name[bkt], member)
125 125
126/** 126/**
127 * hash_for_each_rcu - iterate over a rcu enabled hashtable 127 * hash_for_each_rcu - iterate over a rcu enabled hashtable
128 * @name: hashtable to iterate 128 * @name: hashtable to iterate
129 * @bkt: integer to use as bucket loop cursor 129 * @bkt: integer to use as bucket loop cursor
130 * @node: the &struct list_head to use as a loop cursor for each entry
131 * @obj: the type * to use as a loop cursor for each entry 130 * @obj: the type * to use as a loop cursor for each entry
132 * @member: the name of the hlist_node within the struct 131 * @member: the name of the hlist_node within the struct
133 */ 132 */
134#define hash_for_each_rcu(name, bkt, node, obj, member) \ 133#define hash_for_each_rcu(name, bkt, obj, member) \
135 for ((bkt) = 0, node = NULL; node == NULL && (bkt) < HASH_SIZE(name); (bkt)++)\ 134 for ((bkt) = 0, obj = NULL; obj == NULL && (bkt) < HASH_SIZE(name);\
136 hlist_for_each_entry_rcu(obj, node, &name[bkt], member) 135 (bkt)++)\
136 hlist_for_each_entry_rcu(obj, &name[bkt], member)
137 137
138/** 138/**
139 * hash_for_each_safe - iterate over a hashtable safe against removal of 139 * hash_for_each_safe - iterate over a hashtable safe against removal of
140 * hash entry 140 * hash entry
141 * @name: hashtable to iterate 141 * @name: hashtable to iterate
142 * @bkt: integer to use as bucket loop cursor 142 * @bkt: integer to use as bucket loop cursor
143 * @node: the &struct list_head to use as a loop cursor for each entry
144 * @tmp: a &struct used for temporary storage 143 * @tmp: a &struct used for temporary storage
145 * @obj: the type * to use as a loop cursor for each entry 144 * @obj: the type * to use as a loop cursor for each entry
146 * @member: the name of the hlist_node within the struct 145 * @member: the name of the hlist_node within the struct
147 */ 146 */
148#define hash_for_each_safe(name, bkt, node, tmp, obj, member) \ 147#define hash_for_each_safe(name, bkt, tmp, obj, member) \
149 for ((bkt) = 0, node = NULL; node == NULL && (bkt) < HASH_SIZE(name); (bkt)++)\ 148 for ((bkt) = 0, obj = NULL; obj == NULL && (bkt) < HASH_SIZE(name);\
150 hlist_for_each_entry_safe(obj, node, tmp, &name[bkt], member) 149 (bkt)++)\
150 hlist_for_each_entry_safe(obj, tmp, &name[bkt], member)
151 151
152/** 152/**
153 * hash_for_each_possible - iterate over all possible objects hashing to the 153 * hash_for_each_possible - iterate over all possible objects hashing to the
154 * same bucket 154 * same bucket
155 * @name: hashtable to iterate 155 * @name: hashtable to iterate
156 * @obj: the type * to use as a loop cursor for each entry 156 * @obj: the type * to use as a loop cursor for each entry
157 * @node: the &struct list_head to use as a loop cursor for each entry
158 * @member: the name of the hlist_node within the struct 157 * @member: the name of the hlist_node within the struct
159 * @key: the key of the objects to iterate over 158 * @key: the key of the objects to iterate over
160 */ 159 */
161#define hash_for_each_possible(name, obj, node, member, key) \ 160#define hash_for_each_possible(name, obj, member, key) \
162 hlist_for_each_entry(obj, node, &name[hash_min(key, HASH_BITS(name))], member) 161 hlist_for_each_entry(obj, &name[hash_min(key, HASH_BITS(name))], member)
163 162
164/** 163/**
165 * hash_for_each_possible_rcu - iterate over all possible objects hashing to the 164 * hash_for_each_possible_rcu - iterate over all possible objects hashing to the
@@ -167,25 +166,24 @@ static inline void hash_del_rcu(struct hlist_node *node)
167 * in a rcu enabled hashtable 166 * in a rcu enabled hashtable
168 * @name: hashtable to iterate 167 * @name: hashtable to iterate
169 * @obj: the type * to use as a loop cursor for each entry 168 * @obj: the type * to use as a loop cursor for each entry
170 * @node: the &struct list_head to use as a loop cursor for each entry
171 * @member: the name of the hlist_node within the struct 169 * @member: the name of the hlist_node within the struct
172 * @key: the key of the objects to iterate over 170 * @key: the key of the objects to iterate over
173 */ 171 */
174#define hash_for_each_possible_rcu(name, obj, node, member, key) \ 172#define hash_for_each_possible_rcu(name, obj, member, key) \
175 hlist_for_each_entry_rcu(obj, node, &name[hash_min(key, HASH_BITS(name))], member) 173 hlist_for_each_entry_rcu(obj, &name[hash_min(key, HASH_BITS(name))],\
174 member)
176 175
177/** 176/**
178 * hash_for_each_possible_safe - iterate over all possible objects hashing to the 177 * hash_for_each_possible_safe - iterate over all possible objects hashing to the
179 * same bucket safe against removals 178 * same bucket safe against removals
180 * @name: hashtable to iterate 179 * @name: hashtable to iterate
181 * @obj: the type * to use as a loop cursor for each entry 180 * @obj: the type * to use as a loop cursor for each entry
182 * @node: the &struct list_head to use as a loop cursor for each entry
183 * @tmp: a &struct used for temporary storage 181 * @tmp: a &struct used for temporary storage
184 * @member: the name of the hlist_node within the struct 182 * @member: the name of the hlist_node within the struct
185 * @key: the key of the objects to iterate over 183 * @key: the key of the objects to iterate over
186 */ 184 */
187#define hash_for_each_possible_safe(name, obj, node, tmp, member, key) \ 185#define hash_for_each_possible_safe(name, obj, tmp, member, key) \
188 hlist_for_each_entry_safe(obj, node, tmp, \ 186 hlist_for_each_entry_safe(obj, tmp,\
189 &name[hash_min(key, HASH_BITS(name))], member) 187 &name[hash_min(key, HASH_BITS(name))], member)
190 188
191 189
diff --git a/include/linux/if_team.h b/include/linux/if_team.h
index 4648d8021244..cfd21e3d5506 100644
--- a/include/linux/if_team.h
+++ b/include/linux/if_team.h
@@ -216,11 +216,10 @@ static inline struct hlist_head *team_port_index_hash(struct team *team,
216static inline struct team_port *team_get_port_by_index(struct team *team, 216static inline struct team_port *team_get_port_by_index(struct team *team,
217 int port_index) 217 int port_index)
218{ 218{
219 struct hlist_node *p;
220 struct team_port *port; 219 struct team_port *port;
221 struct hlist_head *head = team_port_index_hash(team, port_index); 220 struct hlist_head *head = team_port_index_hash(team, port_index);
222 221
223 hlist_for_each_entry(port, p, head, hlist) 222 hlist_for_each_entry(port, head, hlist)
224 if (port->index == port_index) 223 if (port->index == port_index)
225 return port; 224 return port;
226 return NULL; 225 return NULL;
@@ -228,11 +227,10 @@ static inline struct team_port *team_get_port_by_index(struct team *team,
228static inline struct team_port *team_get_port_by_index_rcu(struct team *team, 227static inline struct team_port *team_get_port_by_index_rcu(struct team *team,
229 int port_index) 228 int port_index)
230{ 229{
231 struct hlist_node *p;
232 struct team_port *port; 230 struct team_port *port;
233 struct hlist_head *head = team_port_index_hash(team, port_index); 231 struct hlist_head *head = team_port_index_hash(team, port_index);
234 232
235 hlist_for_each_entry_rcu(port, p, head, hlist) 233 hlist_for_each_entry_rcu(port, head, hlist)
236 if (port->index == port_index) 234 if (port->index == port_index)
237 return port; 235 return port;
238 return NULL; 236 return NULL;
diff --git a/include/linux/list.h b/include/linux/list.h
index cc6d2aa6b415..d991cc147c98 100644
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -666,54 +666,49 @@ static inline void hlist_move_list(struct hlist_head *old,
666 for (pos = (head)->first; pos && ({ n = pos->next; 1; }); \ 666 for (pos = (head)->first; pos && ({ n = pos->next; 1; }); \
667 pos = n) 667 pos = n)
668 668
669#define hlist_entry_safe(ptr, type, member) \
670 (ptr) ? hlist_entry(ptr, type, member) : NULL
671
669/** 672/**
670 * hlist_for_each_entry - iterate over list of given type 673 * hlist_for_each_entry - iterate over list of given type
671 * @tpos: the type * to use as a loop cursor. 674 * @pos: the type * to use as a loop cursor.
672 * @pos: the &struct hlist_node to use as a loop cursor.
673 * @head: the head for your list. 675 * @head: the head for your list.
674 * @member: the name of the hlist_node within the struct. 676 * @member: the name of the hlist_node within the struct.
675 */ 677 */
676#define hlist_for_each_entry(tpos, pos, head, member) \ 678#define hlist_for_each_entry(pos, head, member) \
677 for (pos = (head)->first; \ 679 for (pos = hlist_entry_safe((head)->first, typeof(*(pos)), member);\
678 pos && \ 680 pos; \
679 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ 681 pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member))
680 pos = pos->next)
681 682
682/** 683/**
683 * hlist_for_each_entry_continue - iterate over a hlist continuing after current point 684 * hlist_for_each_entry_continue - iterate over a hlist continuing after current point
684 * @tpos: the type * to use as a loop cursor. 685 * @pos: the type * to use as a loop cursor.
685 * @pos: the &struct hlist_node to use as a loop cursor.
686 * @member: the name of the hlist_node within the struct. 686 * @member: the name of the hlist_node within the struct.
687 */ 687 */
688#define hlist_for_each_entry_continue(tpos, pos, member) \ 688#define hlist_for_each_entry_continue(pos, member) \
689 for (pos = (pos)->next; \ 689 for (pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member);\
690 pos && \ 690 pos; \
691 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ 691 pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member))
692 pos = pos->next)
693 692
694/** 693/**
695 * hlist_for_each_entry_from - iterate over a hlist continuing from current point 694 * hlist_for_each_entry_from - iterate over a hlist continuing from current point
696 * @tpos: the type * to use as a loop cursor. 695 * @pos: the type * to use as a loop cursor.
697 * @pos: the &struct hlist_node to use as a loop cursor.
698 * @member: the name of the hlist_node within the struct. 696 * @member: the name of the hlist_node within the struct.
699 */ 697 */
700#define hlist_for_each_entry_from(tpos, pos, member) \ 698#define hlist_for_each_entry_from(pos, member) \
701 for (; pos && \ 699 for (; pos; \
702 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ 700 pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member))
703 pos = pos->next)
704 701
705/** 702/**
706 * hlist_for_each_entry_safe - iterate over list of given type safe against removal of list entry 703 * hlist_for_each_entry_safe - iterate over list of given type safe against removal of list entry
707 * @tpos: the type * to use as a loop cursor. 704 * @pos: the type * to use as a loop cursor.
708 * @pos: the &struct hlist_node to use as a loop cursor.
709 * @n: another &struct hlist_node to use as temporary storage 705 * @n: another &struct hlist_node to use as temporary storage
710 * @head: the head for your list. 706 * @head: the head for your list.
711 * @member: the name of the hlist_node within the struct. 707 * @member: the name of the hlist_node within the struct.
712 */ 708 */
713#define hlist_for_each_entry_safe(tpos, pos, n, head, member) \ 709#define hlist_for_each_entry_safe(pos, n, head, member) \
714 for (pos = (head)->first; \ 710 for (pos = hlist_entry_safe((head)->first, typeof(*pos), member);\
715 pos && ({ n = pos->next; 1; }) && \ 711 pos && ({ n = pos->member.next; 1; }); \
716 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ 712 pos = hlist_entry_safe(n, typeof(*pos), member))
717 pos = n)
718 713
719#endif 714#endif
diff --git a/include/linux/pid.h b/include/linux/pid.h
index 2381c973d897..a089a3c447fc 100644
--- a/include/linux/pid.h
+++ b/include/linux/pid.h
@@ -176,9 +176,8 @@ pid_t pid_vnr(struct pid *pid);
176 176
177#define do_each_pid_task(pid, type, task) \ 177#define do_each_pid_task(pid, type, task) \
178 do { \ 178 do { \
179 struct hlist_node *pos___; \
180 if ((pid) != NULL) \ 179 if ((pid) != NULL) \
181 hlist_for_each_entry_rcu((task), pos___, \ 180 hlist_for_each_entry_rcu((task), \
182 &(pid)->tasks[type], pids[type].node) { 181 &(pid)->tasks[type], pids[type].node) {
183 182
184 /* 183 /*
diff --git a/include/linux/rculist.h b/include/linux/rculist.h
index c92dd28eaa6c..8089e35d47ac 100644
--- a/include/linux/rculist.h
+++ b/include/linux/rculist.h
@@ -445,8 +445,7 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev,
445 445
446/** 446/**
447 * hlist_for_each_entry_rcu - iterate over rcu list of given type 447 * hlist_for_each_entry_rcu - iterate over rcu list of given type
448 * @tpos: the type * to use as a loop cursor. 448 * @pos: the type * to use as a loop cursor.
449 * @pos: the &struct hlist_node to use as a loop cursor.
450 * @head: the head for your list. 449 * @head: the head for your list.
451 * @member: the name of the hlist_node within the struct. 450 * @member: the name of the hlist_node within the struct.
452 * 451 *
@@ -454,16 +453,16 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev,
454 * the _rcu list-mutation primitives such as hlist_add_head_rcu() 453 * the _rcu list-mutation primitives such as hlist_add_head_rcu()
455 * as long as the traversal is guarded by rcu_read_lock(). 454 * as long as the traversal is guarded by rcu_read_lock().
456 */ 455 */
457#define hlist_for_each_entry_rcu(tpos, pos, head, member) \ 456#define hlist_for_each_entry_rcu(pos, head, member) \
458 for (pos = rcu_dereference_raw(hlist_first_rcu(head)); \ 457 for (pos = hlist_entry_safe (rcu_dereference_raw(hlist_first_rcu(head)),\
459 pos && \ 458 typeof(*(pos)), member); \
460 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1; }); \ 459 pos; \
461 pos = rcu_dereference_raw(hlist_next_rcu(pos))) 460 pos = hlist_entry_safe(rcu_dereference_raw(hlist_next_rcu(\
461 &(pos)->member)), typeof(*(pos)), member))
462 462
463/** 463/**
464 * hlist_for_each_entry_rcu_bh - iterate over rcu list of given type 464 * hlist_for_each_entry_rcu_bh - iterate over rcu list of given type
465 * @tpos: the type * to use as a loop cursor. 465 * @pos: the type * to use as a loop cursor.
466 * @pos: the &struct hlist_node to use as a loop cursor.
467 * @head: the head for your list. 466 * @head: the head for your list.
468 * @member: the name of the hlist_node within the struct. 467 * @member: the name of the hlist_node within the struct.
469 * 468 *
@@ -471,35 +470,36 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev,
471 * the _rcu list-mutation primitives such as hlist_add_head_rcu() 470 * the _rcu list-mutation primitives such as hlist_add_head_rcu()
472 * as long as the traversal is guarded by rcu_read_lock(). 471 * as long as the traversal is guarded by rcu_read_lock().
473 */ 472 */
474#define hlist_for_each_entry_rcu_bh(tpos, pos, head, member) \ 473#define hlist_for_each_entry_rcu_bh(pos, head, member) \
475 for (pos = rcu_dereference_bh((head)->first); \ 474 for (pos = hlist_entry_safe(rcu_dereference_bh(hlist_first_rcu(head)),\
476 pos && \ 475 typeof(*(pos)), member); \
477 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1; }); \ 476 pos; \
478 pos = rcu_dereference_bh(pos->next)) 477 pos = hlist_entry_safe(rcu_dereference_bh(hlist_next_rcu(\
478 &(pos)->member)), typeof(*(pos)), member))
479 479
480/** 480/**
481 * hlist_for_each_entry_continue_rcu - iterate over a hlist continuing after current point 481 * hlist_for_each_entry_continue_rcu - iterate over a hlist continuing after current point
482 * @tpos: the type * to use as a loop cursor. 482 * @pos: the type * to use as a loop cursor.
483 * @pos: the &struct hlist_node to use as a loop cursor.
484 * @member: the name of the hlist_node within the struct. 483 * @member: the name of the hlist_node within the struct.
485 */ 484 */
486#define hlist_for_each_entry_continue_rcu(tpos, pos, member) \ 485#define hlist_for_each_entry_continue_rcu(pos, member) \
487 for (pos = rcu_dereference((pos)->next); \ 486 for (pos = hlist_entry_safe(rcu_dereference((pos)->member.next),\
488 pos && \ 487 typeof(*(pos)), member); \
489 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1; }); \ 488 pos; \
490 pos = rcu_dereference(pos->next)) 489 pos = hlist_entry_safe(rcu_dereference((pos)->member.next),\
490 typeof(*(pos)), member))
491 491
492/** 492/**
493 * hlist_for_each_entry_continue_rcu_bh - iterate over a hlist continuing after current point 493 * hlist_for_each_entry_continue_rcu_bh - iterate over a hlist continuing after current point
494 * @tpos: the type * to use as a loop cursor. 494 * @pos: the type * to use as a loop cursor.
495 * @pos: the &struct hlist_node to use as a loop cursor.
496 * @member: the name of the hlist_node within the struct. 495 * @member: the name of the hlist_node within the struct.
497 */ 496 */
498#define hlist_for_each_entry_continue_rcu_bh(tpos, pos, member) \ 497#define hlist_for_each_entry_continue_rcu_bh(pos, member) \
499 for (pos = rcu_dereference_bh((pos)->next); \ 498 for (pos = hlist_entry_safe(rcu_dereference_bh((pos)->member.next),\
500 pos && \ 499 typeof(*(pos)), member); \
501 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1; }); \ 500 pos; \
502 pos = rcu_dereference_bh(pos->next)) 501 pos = hlist_entry_safe(rcu_dereference_bh((pos)->member.next),\
502 typeof(*(pos)), member))
503 503
504 504
505#endif /* __KERNEL__ */ 505#endif /* __KERNEL__ */
diff --git a/include/net/ax25.h b/include/net/ax25.h
index 53539acbd81a..89ed9ac5701f 100644
--- a/include/net/ax25.h
+++ b/include/net/ax25.h
@@ -161,8 +161,8 @@ typedef struct ax25_uid_assoc {
161 ax25_address call; 161 ax25_address call;
162} ax25_uid_assoc; 162} ax25_uid_assoc;
163 163
164#define ax25_uid_for_each(__ax25, node, list) \ 164#define ax25_uid_for_each(__ax25, list) \
165 hlist_for_each_entry(__ax25, node, list, uid_node) 165 hlist_for_each_entry(__ax25, list, uid_node)
166 166
167#define ax25_uid_hold(ax25) \ 167#define ax25_uid_hold(ax25) \
168 atomic_inc(&((ax25)->refcount)) 168 atomic_inc(&((ax25)->refcount))
@@ -247,8 +247,8 @@ typedef struct ax25_cb {
247 247
248#define ax25_sk(__sk) ((ax25_cb *)(__sk)->sk_protinfo) 248#define ax25_sk(__sk) ((ax25_cb *)(__sk)->sk_protinfo)
249 249
250#define ax25_for_each(__ax25, node, list) \ 250#define ax25_for_each(__ax25, list) \
251 hlist_for_each_entry(__ax25, node, list, ax25_node) 251 hlist_for_each_entry(__ax25, list, ax25_node)
252 252
253#define ax25_cb_hold(__ax25) \ 253#define ax25_cb_hold(__ax25) \
254 atomic_inc(&((__ax25)->refcount)) 254 atomic_inc(&((__ax25)->refcount))
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h
index 7b2ae9d37076..ef83d9e844b5 100644
--- a/include/net/inet_hashtables.h
+++ b/include/net/inet_hashtables.h
@@ -94,8 +94,8 @@ static inline struct net *ib_net(struct inet_bind_bucket *ib)
94 return read_pnet(&ib->ib_net); 94 return read_pnet(&ib->ib_net);
95} 95}
96 96
97#define inet_bind_bucket_for_each(tb, pos, head) \ 97#define inet_bind_bucket_for_each(tb, head) \
98 hlist_for_each_entry(tb, pos, head, node) 98 hlist_for_each_entry(tb, head, node)
99 99
100struct inet_bind_hashbucket { 100struct inet_bind_hashbucket {
101 spinlock_t lock; 101 spinlock_t lock;
diff --git a/include/net/inet_timewait_sock.h b/include/net/inet_timewait_sock.h
index 7d658d577368..f908dfc06505 100644
--- a/include/net/inet_timewait_sock.h
+++ b/include/net/inet_timewait_sock.h
@@ -178,11 +178,11 @@ static inline int inet_twsk_del_dead_node(struct inet_timewait_sock *tw)
178#define inet_twsk_for_each(tw, node, head) \ 178#define inet_twsk_for_each(tw, node, head) \
179 hlist_nulls_for_each_entry(tw, node, head, tw_node) 179 hlist_nulls_for_each_entry(tw, node, head, tw_node)
180 180
181#define inet_twsk_for_each_inmate(tw, node, jail) \ 181#define inet_twsk_for_each_inmate(tw, jail) \
182 hlist_for_each_entry(tw, node, jail, tw_death_node) 182 hlist_for_each_entry(tw, jail, tw_death_node)
183 183
184#define inet_twsk_for_each_inmate_safe(tw, node, safe, jail) \ 184#define inet_twsk_for_each_inmate_safe(tw, safe, jail) \
185 hlist_for_each_entry_safe(tw, node, safe, jail, tw_death_node) 185 hlist_for_each_entry_safe(tw, safe, jail, tw_death_node)
186 186
187static inline struct inet_timewait_sock *inet_twsk(const struct sock *sk) 187static inline struct inet_timewait_sock *inet_twsk(const struct sock *sk)
188{ 188{
diff --git a/include/net/netrom.h b/include/net/netrom.h
index f0793c1cb5f8..121dcf854db5 100644
--- a/include/net/netrom.h
+++ b/include/net/netrom.h
@@ -154,17 +154,17 @@ static __inline__ void nr_node_unlock(struct nr_node *nr_node)
154 nr_node_put(nr_node); 154 nr_node_put(nr_node);
155} 155}
156 156
157#define nr_neigh_for_each(__nr_neigh, node, list) \ 157#define nr_neigh_for_each(__nr_neigh, list) \
158 hlist_for_each_entry(__nr_neigh, node, list, neigh_node) 158 hlist_for_each_entry(__nr_neigh, list, neigh_node)
159 159
160#define nr_neigh_for_each_safe(__nr_neigh, node, node2, list) \ 160#define nr_neigh_for_each_safe(__nr_neigh, node2, list) \
161 hlist_for_each_entry_safe(__nr_neigh, node, node2, list, neigh_node) 161 hlist_for_each_entry_safe(__nr_neigh, node2, list, neigh_node)
162 162
163#define nr_node_for_each(__nr_node, node, list) \ 163#define nr_node_for_each(__nr_node, list) \
164 hlist_for_each_entry(__nr_node, node, list, node_node) 164 hlist_for_each_entry(__nr_node, list, node_node)
165 165
166#define nr_node_for_each_safe(__nr_node, node, node2, list) \ 166#define nr_node_for_each_safe(__nr_node, node2, list) \
167 hlist_for_each_entry_safe(__nr_node, node, node2, list, node_node) 167 hlist_for_each_entry_safe(__nr_node, node2, list, node_node)
168 168
169 169
170/*********************************************************************/ 170/*********************************************************************/
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index 2761c905504e..f10818fc8804 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -339,11 +339,10 @@ static inline struct Qdisc_class_common *
339qdisc_class_find(const struct Qdisc_class_hash *hash, u32 id) 339qdisc_class_find(const struct Qdisc_class_hash *hash, u32 id)
340{ 340{
341 struct Qdisc_class_common *cl; 341 struct Qdisc_class_common *cl;
342 struct hlist_node *n;
343 unsigned int h; 342 unsigned int h;
344 343
345 h = qdisc_class_hash(id, hash->hashmask); 344 h = qdisc_class_hash(id, hash->hashmask);
346 hlist_for_each_entry(cl, n, &hash->hash[h], hnode) { 345 hlist_for_each_entry(cl, &hash->hash[h], hnode) {
347 if (cl->classid == id) 346 if (cl->classid == id)
348 return cl; 347 return cl;
349 } 348 }
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index 7fdf298a47ef..df85a0c0f2d5 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -675,8 +675,8 @@ static inline int sctp_vtag_hashfn(__u16 lport, __u16 rport, __u32 vtag)
675 return h & (sctp_assoc_hashsize - 1); 675 return h & (sctp_assoc_hashsize - 1);
676} 676}
677 677
678#define sctp_for_each_hentry(epb, node, head) \ 678#define sctp_for_each_hentry(epb, head) \
679 hlist_for_each_entry(epb, node, head, node) 679 hlist_for_each_entry(epb, head, node)
680 680
681/* Is a socket of this style? */ 681/* Is a socket of this style? */
682#define sctp_style(sk, style) __sctp_style((sk), (SCTP_SOCKET_##style)) 682#define sctp_style(sk, style) __sctp_style((sk), (SCTP_SOCKET_##style))
diff --git a/include/net/sock.h b/include/net/sock.h
index a66caa223d18..14f6e9d19dc7 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -606,24 +606,23 @@ static inline void sk_add_bind_node(struct sock *sk,
606 hlist_add_head(&sk->sk_bind_node, list); 606 hlist_add_head(&sk->sk_bind_node, list);
607} 607}
608 608
609#define sk_for_each(__sk, node, list) \ 609#define sk_for_each(__sk, list) \
610 hlist_for_each_entry(__sk, node, list, sk_node) 610 hlist_for_each_entry(__sk, list, sk_node)
611#define sk_for_each_rcu(__sk, node, list) \ 611#define sk_for_each_rcu(__sk, list) \
612 hlist_for_each_entry_rcu(__sk, node, list, sk_node) 612 hlist_for_each_entry_rcu(__sk, list, sk_node)
613#define sk_nulls_for_each(__sk, node, list) \ 613#define sk_nulls_for_each(__sk, node, list) \
614 hlist_nulls_for_each_entry(__sk, node, list, sk_nulls_node) 614 hlist_nulls_for_each_entry(__sk, node, list, sk_nulls_node)
615#define sk_nulls_for_each_rcu(__sk, node, list) \ 615#define sk_nulls_for_each_rcu(__sk, node, list) \
616 hlist_nulls_for_each_entry_rcu(__sk, node, list, sk_nulls_node) 616 hlist_nulls_for_each_entry_rcu(__sk, node, list, sk_nulls_node)
617#define sk_for_each_from(__sk, node) \ 617#define sk_for_each_from(__sk) \
618 if (__sk && ({ node = &(__sk)->sk_node; 1; })) \ 618 hlist_for_each_entry_from(__sk, sk_node)
619 hlist_for_each_entry_from(__sk, node, sk_node)
620#define sk_nulls_for_each_from(__sk, node) \ 619#define sk_nulls_for_each_from(__sk, node) \
621 if (__sk && ({ node = &(__sk)->sk_nulls_node; 1; })) \ 620 if (__sk && ({ node = &(__sk)->sk_nulls_node; 1; })) \
622 hlist_nulls_for_each_entry_from(__sk, node, sk_nulls_node) 621 hlist_nulls_for_each_entry_from(__sk, node, sk_nulls_node)
623#define sk_for_each_safe(__sk, node, tmp, list) \ 622#define sk_for_each_safe(__sk, tmp, list) \
624 hlist_for_each_entry_safe(__sk, node, tmp, list, sk_node) 623 hlist_for_each_entry_safe(__sk, tmp, list, sk_node)
625#define sk_for_each_bound(__sk, node, list) \ 624#define sk_for_each_bound(__sk, list) \
626 hlist_for_each_entry(__sk, node, list, sk_bind_node) 625 hlist_for_each_entry(__sk, list, sk_bind_node)
627 626
628static inline struct user_namespace *sk_user_ns(struct sock *sk) 627static inline struct user_namespace *sk_user_ns(struct sock *sk)
629{ 628{