Permalink
Browse files

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>
  • Loading branch information...
1 parent 1e142b2 commit b67bfe0d42cac56c512dd5da4b1b347a23f4b70a @sashalevin sashalevin committed with Feb 28, 2013
Showing with 987 additions and 1,494 deletions.
  1. +3 −3 arch/arm/kernel/kprobes.c
  2. +4 −4 arch/ia64/kernel/kprobes.c
  3. +3 −3 arch/mips/kernel/kprobes.c
  4. +3 −3 arch/powerpc/kernel/kprobes.c
  5. +6 −12 arch/powerpc/kvm/book3s_mmu_hpte.c
  6. +4 −4 arch/s390/kernel/kprobes.c
  7. +1 −2 arch/s390/pci/pci_msi.c
  8. +3 −3 arch/sh/kernel/kprobes.c
  9. +3 −3 arch/sparc/kernel/kprobes.c
  10. +1 −2 arch/sparc/kernel/ldc.c
  11. +4 −4 arch/x86/kernel/kprobes/core.c
  12. +10 −16 arch/x86/kvm/mmu.c
  13. +2 −4 block/blk-cgroup.c
  14. +1 −2 block/blk-ioc.c
  15. +1 −2 block/bsg.c
  16. +1 −2 block/cfq-iosched.c
  17. +2 −2 block/elevator.c
  18. +3 −3 crypto/algapi.c
  19. +2 −4 drivers/atm/atmtcp.c
  20. +1 −2 drivers/atm/eni.c
  21. +1 −2 drivers/atm/he.c
  22. +1 −2 drivers/atm/solos-pci.c
  23. +22 −37 drivers/clk/clk.c
  24. +8 −11 drivers/gpu/drm/drm_hashtab.c
  25. +1 −2 drivers/infiniband/core/cma.c
  26. +1 −2 drivers/infiniband/core/fmr_pool.c
  27. +1 −2 drivers/isdn/mISDN/socket.c
  28. +1 −2 drivers/isdn/mISDN/stack.c
  29. +1 −2 drivers/md/dm-bio-prison.c
  30. +1 −2 drivers/md/dm-bufio.c
  31. +1 −2 drivers/md/dm-snap.c
  32. +3 −4 drivers/md/persistent-data/dm-transaction-manager.c
  33. +1 −2 drivers/md/raid5.c
  34. +1 −2 drivers/misc/sgi-gru/grutlbpurge.c
  35. +2 −5 drivers/misc/vmw_vmci/vmci_doorbell.c
  36. +2 −4 drivers/misc/vmw_vmci/vmci_resource.c
  37. +9 −9 drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
  38. +4 −4 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
  39. +8 −9 drivers/net/ethernet/mellanox/mlx4/en_netdev.c
  40. +2 −2 drivers/net/ethernet/mellanox/mlx4/en_rx.c
  41. +5 −5 drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c
  42. +5 −5 drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c
  43. +1 −2 drivers/net/ethernet/sun/sunvnet.c
  44. +2 −4 drivers/net/macvlan.c
  45. +7 −8 drivers/net/tun.c
  46. +4 −8 drivers/net/vxlan.c
  47. +3 −4 drivers/net/wireless/zd1201.c
  48. +5 −7 drivers/pci/pci.c
  49. +7 −12 drivers/staging/android/binder.c
  50. +4 −8 drivers/target/tcm_fc/tfc_sess.c
  51. +1 −2 fs/affs/amigaffs.c
  52. +1 −2 fs/aio.c
  53. +1 −2 fs/cifs/inode.c
  54. +3 −6 fs/dcache.c
  55. +4 −7 fs/dlm/lowcomms.c
  56. +2 −4 fs/ecryptfs/messaging.c
  57. +1 −2 fs/exportfs/expfs.c
  58. +1 −2 fs/fat/inode.c
  59. +1 −2 fs/fat/nfs.c
  60. +4 −7 fs/fscache/cookie.c
  61. +7 −12 fs/inode.c
  62. +12 −17 fs/lockd/host.c
  63. +3 −4 fs/lockd/svcsubs.c
  64. +3 −6 fs/nfs/pnfs_dev.c
  65. +1 −2 fs/nfsd/nfscache.c
  66. +1 −2 fs/notify/fsnotify.c
  67. +8 −11 fs/notify/inode_mark.c
  68. +8 −11 fs/notify/vfsmount_mark.c
  69. +1 −2 fs/ocfs2/dcache.c
  70. +2 −4 fs/ocfs2/dlm/dlmrecovery.c
  71. +2 −4 fs/super.c
  72. +1 −2 fs/sysfs/bin.c
  73. +1 −2 fs/xfs/xfs_log_recover.c
  74. +19 −21 include/linux/hashtable.h
  75. +2 −4 include/linux/if_team.h
  76. +22 −27 include/linux/list.h
  77. +1 −2 include/linux/pid.h
  78. +28 −28 include/linux/rculist.h
  79. +4 −4 include/net/ax25.h
  80. +2 −2 include/net/inet_hashtables.h
  81. +4 −4 include/net/inet_timewait_sock.h
  82. +8 −8 include/net/netrom.h
  83. +1 −2 include/net/sch_generic.h
  84. +2 −2 include/net/sctp/sctp.h
  85. +10 −11 include/net/sock.h
  86. +5 −7 kernel/cgroup.c
  87. +2 −4 kernel/events/core.c
  88. +14 −21 kernel/kprobes.c
  89. +1 −2 kernel/pid.c
  90. +2 −4 kernel/sched/core.c
  91. +1 −1 kernel/smpboot.c
  92. +10 −14 kernel/trace/ftrace.c
  93. +1 −2 kernel/trace/trace_output.c
  94. +2 −4 kernel/tracepoint.c
  95. +2 −2 kernel/user-return-notifier.c
  96. +1 −2 kernel/user.c
  97. +5 −8 kernel/workqueue.c
  98. +10 −11 lib/debugobjects.c
  99. +1 −2 lib/lru_cache.c
  100. +1 −2 mm/huge_memory.c
  101. +4 −5 mm/kmemleak.c
  102. +5 −10 mm/ksm.c
  103. +6 −12 mm/mmu_notifier.c
  104. +1 −3 net/9p/error.c
  105. +1 −1 net/9p/trans_virtio.c
  106. +3 −6 net/appletalk/ddp.c
  107. +3 −4 net/atm/common.c
  108. +31 −35 net/atm/lec.c
  109. +1 −2 net/atm/signaling.c
  110. +5 −10 net/ax25/af_ax25.c
  111. +2 −4 net/ax25/ax25_ds_subr.c
  112. +1 −2 net/ax25/ax25_ds_timer.c
  113. +1 −2 net/ax25/ax25_iface.c
  114. +4 −7 net/ax25/ax25_uid.c
  115. +4 −8 net/batman-adv/bat_iv_ogm.c
  116. +15 −24 net/batman-adv/bridge_loop_avoidance.c
  117. +6 −9 net/batman-adv/distributed-arp-table.c
  118. +5 −8 net/batman-adv/gateway_client.c
  119. +2 −4 net/batman-adv/main.c
  120. +14 −17 net/batman-adv/originator.c
  121. +1 −2 net/batman-adv/originator.h
  122. +2 −4 net/batman-adv/routing.c
  123. +3 −3 net/batman-adv/send.c
  124. +35 −47 net/batman-adv/translation-table.c
  125. +15 −23 net/batman-adv/vis.c
  126. +5 −10 net/bluetooth/hci_sock.c
  127. +5 −8 net/bluetooth/rfcomm/sock.c
  128. +5 −9 net/bluetooth/sco.c
  129. +9 −14 net/bridge/br_fdb.c
  130. +2 −4 net/bridge/br_mdb.c
  131. +11 −14 net/bridge/br_multicast.c
  132. +8 −10 net/can/af_can.c
  133. +7 −8 net/can/gw.c
  134. +1 −2 net/can/proc.c
  135. +4 −8 net/core/dev.c
  136. +5 −6 net/core/flow.c
  137. +1 −2 net/core/net-procfs.c
  138. +1 −2 net/core/rtnetlink.c
  139. +3 −6 net/decnet/af_decnet.c
  140. +5 −8 net/decnet/dn_table.c
  141. +1 −2 net/ieee802154/dgram.c
  142. +1 −2 net/ieee802154/raw.c
  143. +3 −7 net/ipv4/devinet.c
  144. +6 −9 net/ipv4/fib_frontend.c
  145. +9 −14 net/ipv4/fib_semantics.c
  146. +12 −21 net/ipv4/fib_trie.c
  147. +4 −6 net/ipv4/inet_connection_sock.c
  148. +4 −6 net/ipv4/inet_fragment.c
  149. +3 −5 net/ipv4/inet_hashtables.c
  150. +3 −4 net/ipv4/inet_timewait_sock.c
  151. +2 −6 net/ipv4/raw.c
  152. +3 −4 net/ipv4/tcp_ipv4.c
  153. +11 −21 net/ipv6/addrconf.c
  154. +8 −10 net/ipv6/addrlabel.c
  155. +2 −3 net/ipv6/inet6_connection_sock.c
  156. +4 −8 net/ipv6/ip6_fib.c
  157. +1 −2 net/ipv6/raw.c
  158. +4 −6 net/ipv6/xfrm6_tunnel.c
  159. +6 −10 net/ipx/af_ipx.c
  160. +2 −3 net/ipx/ipx_proc.c
  161. +7 −14 net/iucv/af_iucv.c
  162. +1 −2 net/key/af_key.c
  163. +4 −8 net/l2tp/l2tp_core.c
  164. +1 −2 net/l2tp/l2tp_ip.c
  165. +1 −2 net/l2tp/l2tp_ip6.c
  166. +1 −2 net/llc/llc_sap.c
  167. +17 −28 net/mac80211/mesh_pathtbl.c
  168. +9 −17 net/netfilter/ipvs/ip_vs_conn.c
  169. +7 −10 net/netfilter/nf_conntrack_expect.c
  170. +5 −8 net/netfilter/nf_conntrack_helper.c
  171. +4 −5 net/netfilter/nf_conntrack_netlink.c
  172. +4 −4 net/netfilter/nf_conntrack_sip.c
  173. +1 −2 net/netfilter/nf_nat_core.c
  174. +7 −10 net/netfilter/nfnetlink_cthelper.c
  175. +3 −4 net/netfilter/nfnetlink_log.c
  176. +4 −6 net/netfilter/nfnetlink_queue_core.c
  177. +1 −2 net/netfilter/xt_RATEEST.c
  178. +4 −4 net/netfilter/xt_connlimit.c
  179. +6 −10 net/netfilter/xt_hashlimit.c
  180. +11 −19 net/netlink/af_netlink.c
  181. +4 −8 net/netrom/af_netrom.c
  182. +13 −17 net/netrom/nr_route.c
  183. +6 −10 net/nfc/llcp/llcp.c
  184. +4 −6 net/openvswitch/datapath.c
  185. +5 −8 net/openvswitch/flow.c
  186. +1 −2 net/openvswitch/vport.c
  187. +1 −2 net/packet/af_packet.c
  188. +1 −2 net/packet/diag.c
  189. +1 −2 net/phonet/pep.c
  190. +3 −6 net/phonet/socket.c
  191. +1 −2 net/rds/bind.c
  192. +3 −6 net/rds/connection.c
  193. +5 −9 net/rose/af_rose.c
  194. +2 −2 net/sched/sch_api.c
  195. +7 −11 net/sched/sch_cbq.c
  196. +4 −6 net/sched/sch_drr.c
  197. +6 −9 net/sched/sch_hfsc.c
  198. +5 −7 net/sched/sch_htb.c
  199. +6 −10 net/sched/sch_qfq.c
  200. +1 −2 net/sctp/endpointola.c
  201. +2 −4 net/sctp/input.c
  202. +3 −6 net/sctp/proc.c
  203. +4 −5 net/sctp/socket.c
  204. +2 −3 net/sunrpc/auth.c
  205. +2 −2 net/sunrpc/cache.c
  206. +1 −2 net/sunrpc/svcauth.c
  207. +3 −5 net/tipc/name_table.c
  208. +1 −2 net/tipc/node.c
  209. +2 −4 net/unix/af_unix.c
  210. +2 −5 net/unix/diag.c
  211. +4 −8 net/x25/af_x25.c
  212. +20 −27 net/xfrm/xfrm_policy.c
  213. +16 −26 net/xfrm/xfrm_state.c
  214. +1 −2 security/integrity/ima/ima_queue.c
  215. +6 −13 security/selinux/avc.c
  216. +1 −2 tools/perf/util/evlist.c
  217. +1 −2 virt/kvm/eventfd.c
  218. +6 −12 virt/kvm/irq_comm.c
@@ -395,7 +395,7 @@ static __used __kprobes void *trampoline_handler(struct pt_regs *regs)
{
struct kretprobe_instance *ri = NULL;
struct hlist_head *head, empty_rp;
- struct hlist_node *node, *tmp;
+ struct hlist_node *tmp;
unsigned long flags, orig_ret_address = 0;
unsigned long trampoline_address = (unsigned long)&kretprobe_trampoline;
@@ -415,7 +415,7 @@ static __used __kprobes void *trampoline_handler(struct pt_regs *regs)
* real return address, and all the rest will point to
* kretprobe_trampoline
*/
- hlist_for_each_entry_safe(ri, node, tmp, head, hlist) {
+ hlist_for_each_entry_safe(ri, tmp, head, hlist) {
if (ri->task != current)
/* another task is sharing our hash bucket */
continue;
@@ -442,7 +442,7 @@ static __used __kprobes void *trampoline_handler(struct pt_regs *regs)
kretprobe_assert(ri, orig_ret_address, trampoline_address);
kretprobe_hash_unlock(current, &flags);
- hlist_for_each_entry_safe(ri, node, tmp, &empty_rp, hlist) {
+ hlist_for_each_entry_safe(ri, tmp, &empty_rp, hlist) {
hlist_del(&ri->hlist);
kfree(ri);
}
@@ -423,7 +423,7 @@ int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs)
{
struct kretprobe_instance *ri = NULL;
struct hlist_head *head, empty_rp;
- struct hlist_node *node, *tmp;
+ struct hlist_node *tmp;
unsigned long flags, orig_ret_address = 0;
unsigned long trampoline_address =
((struct fnptr *)kretprobe_trampoline)->ip;
@@ -444,7 +444,7 @@ int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs)
* real return address, and all the rest will point to
* kretprobe_trampoline
*/
- hlist_for_each_entry_safe(ri, node, tmp, head, hlist) {
+ hlist_for_each_entry_safe(ri, tmp, head, hlist) {
if (ri->task != current)
/* another task is sharing our hash bucket */
continue;
@@ -461,7 +461,7 @@ int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs)
regs->cr_iip = orig_ret_address;
- hlist_for_each_entry_safe(ri, node, tmp, head, hlist) {
+ hlist_for_each_entry_safe(ri, tmp, head, hlist) {
if (ri->task != current)
/* another task is sharing our hash bucket */
continue;
@@ -487,7 +487,7 @@ int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs)
kretprobe_hash_unlock(current, &flags);
preempt_enable_no_resched();
- hlist_for_each_entry_safe(ri, node, tmp, &empty_rp, hlist) {
+ hlist_for_each_entry_safe(ri, tmp, &empty_rp, hlist) {
hlist_del(&ri->hlist);
kfree(ri);
}
@@ -598,7 +598,7 @@ static int __kprobes trampoline_probe_handler(struct kprobe *p,
{
struct kretprobe_instance *ri = NULL;
struct hlist_head *head, empty_rp;
- struct hlist_node *node, *tmp;
+ struct hlist_node *tmp;
unsigned long flags, orig_ret_address = 0;
unsigned long trampoline_address = (unsigned long)kretprobe_trampoline;
@@ -618,7 +618,7 @@ static int __kprobes trampoline_probe_handler(struct kprobe *p,
* real return address, and all the rest will point to
* kretprobe_trampoline
*/
- hlist_for_each_entry_safe(ri, node, tmp, head, hlist) {
+ hlist_for_each_entry_safe(ri, tmp, head, hlist) {
if (ri->task != current)
/* another task is sharing our hash bucket */
continue;
@@ -645,7 +645,7 @@ static int __kprobes trampoline_probe_handler(struct kprobe *p,
kretprobe_hash_unlock(current, &flags);
preempt_enable_no_resched();
- hlist_for_each_entry_safe(ri, node, tmp, &empty_rp, hlist) {
+ hlist_for_each_entry_safe(ri, tmp, &empty_rp, hlist) {
hlist_del(&ri->hlist);
kfree(ri);
}
@@ -310,7 +310,7 @@ static int __kprobes trampoline_probe_handler(struct kprobe *p,
{
struct kretprobe_instance *ri = NULL;
struct hlist_head *head, empty_rp;
- struct hlist_node *node, *tmp;
+ struct hlist_node *tmp;
unsigned long flags, orig_ret_address = 0;
unsigned long trampoline_address =(unsigned long)&kretprobe_trampoline;
@@ -330,7 +330,7 @@ static int __kprobes trampoline_probe_handler(struct kprobe *p,
* real return address, and all the rest will point to
* kretprobe_trampoline
*/
- hlist_for_each_entry_safe(ri, node, tmp, head, hlist) {
+ hlist_for_each_entry_safe(ri, tmp, head, hlist) {
if (ri->task != current)
/* another task is sharing our hash bucket */
continue;
@@ -357,7 +357,7 @@ static int __kprobes trampoline_probe_handler(struct kprobe *p,
kretprobe_hash_unlock(current, &flags);
preempt_enable_no_resched();
- hlist_for_each_entry_safe(ri, node, tmp, &empty_rp, hlist) {
+ hlist_for_each_entry_safe(ri, tmp, &empty_rp, hlist) {
hlist_del(&ri->hlist);
kfree(ri);
}
@@ -124,15 +124,14 @@ static void kvmppc_mmu_pte_flush_all(struct kvm_vcpu *vcpu)
{
struct kvmppc_vcpu_book3s *vcpu3s = to_book3s(vcpu);
struct hpte_cache *pte;
- struct hlist_node *node;
int i;
rcu_read_lock();
for (i = 0; i < HPTEG_HASH_NUM_VPTE_LONG; i++) {
struct hlist_head *list = &vcpu3s->hpte_hash_vpte_long[i];
- hlist_for_each_entry_rcu(pte, node, list, list_vpte_long)
+ hlist_for_each_entry_rcu(pte, list, list_vpte_long)
invalidate_pte(vcpu, pte);
}
@@ -143,7 +142,6 @@ static void kvmppc_mmu_pte_flush_page(struct kvm_vcpu *vcpu, ulong guest_ea)
{
struct kvmppc_vcpu_book3s *vcpu3s = to_book3s(vcpu);
struct hlist_head *list;
- struct hlist_node *node;
struct hpte_cache *pte;
/* Find the list of entries in the map */
@@ -152,7 +150,7 @@ static void kvmppc_mmu_pte_flush_page(struct kvm_vcpu *vcpu, ulong guest_ea)
rcu_read_lock();
/* Check the list for matching entries and invalidate */
- hlist_for_each_entry_rcu(pte, node, list, list_pte)
+ hlist_for_each_entry_rcu(pte, list, list_pte)
if ((pte->pte.eaddr & ~0xfffUL) == guest_ea)
invalidate_pte(vcpu, pte);
@@ -163,7 +161,6 @@ static void kvmppc_mmu_pte_flush_long(struct kvm_vcpu *vcpu, ulong guest_ea)
{
struct kvmppc_vcpu_book3s *vcpu3s = to_book3s(vcpu);
struct hlist_head *list;
- struct hlist_node *node;
struct hpte_cache *pte;
/* Find the list of entries in the map */
@@ -173,7 +170,7 @@ static void kvmppc_mmu_pte_flush_long(struct kvm_vcpu *vcpu, ulong guest_ea)
rcu_read_lock();
/* Check the list for matching entries and invalidate */
- hlist_for_each_entry_rcu(pte, node, list, list_pte_long)
+ hlist_for_each_entry_rcu(pte, list, list_pte_long)
if ((pte->pte.eaddr & 0x0ffff000UL) == guest_ea)
invalidate_pte(vcpu, pte);
@@ -207,7 +204,6 @@ static void kvmppc_mmu_pte_vflush_short(struct kvm_vcpu *vcpu, u64 guest_vp)
{
struct kvmppc_vcpu_book3s *vcpu3s = to_book3s(vcpu);
struct hlist_head *list;
- struct hlist_node *node;
struct hpte_cache *pte;
u64 vp_mask = 0xfffffffffULL;
@@ -216,7 +212,7 @@ static void kvmppc_mmu_pte_vflush_short(struct kvm_vcpu *vcpu, u64 guest_vp)
rcu_read_lock();
/* Check the list for matching entries and invalidate */
- hlist_for_each_entry_rcu(pte, node, list, list_vpte)
+ hlist_for_each_entry_rcu(pte, list, list_vpte)
if ((pte->pte.vpage & vp_mask) == guest_vp)
invalidate_pte(vcpu, pte);
@@ -228,7 +224,6 @@ static void kvmppc_mmu_pte_vflush_long(struct kvm_vcpu *vcpu, u64 guest_vp)
{
struct kvmppc_vcpu_book3s *vcpu3s = to_book3s(vcpu);
struct hlist_head *list;
- struct hlist_node *node;
struct hpte_cache *pte;
u64 vp_mask = 0xffffff000ULL;
@@ -238,7 +233,7 @@ static void kvmppc_mmu_pte_vflush_long(struct kvm_vcpu *vcpu, u64 guest_vp)
rcu_read_lock();
/* Check the list for matching entries and invalidate */
- hlist_for_each_entry_rcu(pte, node, list, list_vpte_long)
+ hlist_for_each_entry_rcu(pte, list, list_vpte_long)
if ((pte->pte.vpage & vp_mask) == guest_vp)
invalidate_pte(vcpu, pte);
@@ -266,7 +261,6 @@ void kvmppc_mmu_pte_vflush(struct kvm_vcpu *vcpu, u64 guest_vp, u64 vp_mask)
void kvmppc_mmu_pte_pflush(struct kvm_vcpu *vcpu, ulong pa_start, ulong pa_end)
{
struct kvmppc_vcpu_book3s *vcpu3s = to_book3s(vcpu);
- struct hlist_node *node;
struct hpte_cache *pte;
int i;
@@ -277,7 +271,7 @@ void kvmppc_mmu_pte_pflush(struct kvm_vcpu *vcpu, ulong pa_start, ulong pa_end)
for (i = 0; i < HPTEG_HASH_NUM_VPTE_LONG; i++) {
struct hlist_head *list = &vcpu3s->hpte_hash_vpte_long[i];
- hlist_for_each_entry_rcu(pte, node, list, list_vpte_long)
+ hlist_for_each_entry_rcu(pte, list, list_vpte_long)
if ((pte->pte.raddr >= pa_start) &&
(pte->pte.raddr < pa_end))
invalidate_pte(vcpu, pte);
@@ -354,7 +354,7 @@ static int __kprobes trampoline_probe_handler(struct kprobe *p,
{
struct kretprobe_instance *ri;
struct hlist_head *head, empty_rp;
- struct hlist_node *node, *tmp;
+ struct hlist_node *tmp;
unsigned long flags, orig_ret_address;
unsigned long trampoline_address;
kprobe_opcode_t *correct_ret_addr;
@@ -379,7 +379,7 @@ static int __kprobes trampoline_probe_handler(struct kprobe *p,
orig_ret_address = 0;
correct_ret_addr = NULL;
trampoline_address = (unsigned long) &kretprobe_trampoline;
- hlist_for_each_entry_safe(ri, node, tmp, head, hlist) {
+ hlist_for_each_entry_safe(ri, tmp, head, hlist) {
if (ri->task != current)
/* another task is sharing our hash bucket */
continue;
@@ -398,7 +398,7 @@ static int __kprobes trampoline_probe_handler(struct kprobe *p,
kretprobe_assert(ri, orig_ret_address, trampoline_address);
correct_ret_addr = ri->ret_addr;
- hlist_for_each_entry_safe(ri, node, tmp, head, hlist) {
+ hlist_for_each_entry_safe(ri, tmp, head, hlist) {
if (ri->task != current)
/* another task is sharing our hash bucket */
continue;
@@ -427,7 +427,7 @@ static int __kprobes trampoline_probe_handler(struct kprobe *p,
kretprobe_hash_unlock(current, &flags);
preempt_enable_no_resched();
- hlist_for_each_entry_safe(ri, node, tmp, &empty_rp, hlist) {
+ hlist_for_each_entry_safe(ri, tmp, &empty_rp, hlist) {
hlist_del(&ri->hlist);
kfree(ri);
}
View
@@ -25,10 +25,9 @@ static DEFINE_SPINLOCK(msi_map_lock);
struct msi_desc *__irq_get_msi_desc(unsigned int irq)
{
- struct hlist_node *entry;
struct msi_map *map;
- hlist_for_each_entry_rcu(map, entry,
+ hlist_for_each_entry_rcu(map,
&msi_hash[msi_hashfn(irq)], msi_chain)
if (map->irq == irq)
return map->msi;
View
@@ -310,7 +310,7 @@ int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs)
{
struct kretprobe_instance *ri = NULL;
struct hlist_head *head, empty_rp;
- struct hlist_node *node, *tmp;
+ struct hlist_node *tmp;
unsigned long flags, orig_ret_address = 0;
unsigned long trampoline_address = (unsigned long)&kretprobe_trampoline;
@@ -330,7 +330,7 @@ int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs)
* real return address, and all the rest will point to
* kretprobe_trampoline
*/
- hlist_for_each_entry_safe(ri, node, tmp, head, hlist) {
+ hlist_for_each_entry_safe(ri, tmp, head, hlist) {
if (ri->task != current)
/* another task is sharing our hash bucket */
continue;
@@ -360,7 +360,7 @@ int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs)
preempt_enable_no_resched();
- hlist_for_each_entry_safe(ri, node, tmp, &empty_rp, hlist) {
+ hlist_for_each_entry_safe(ri, tmp, &empty_rp, hlist) {
hlist_del(&ri->hlist);
kfree(ri);
}
@@ -511,7 +511,7 @@ int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs)
{
struct kretprobe_instance *ri = NULL;
struct hlist_head *head, empty_rp;
- struct hlist_node *node, *tmp;
+ struct hlist_node *tmp;
unsigned long flags, orig_ret_address = 0;
unsigned long trampoline_address =(unsigned long)&kretprobe_trampoline;
@@ -531,7 +531,7 @@ int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs)
* real return address, and all the rest will point to
* kretprobe_trampoline
*/
- hlist_for_each_entry_safe(ri, node, tmp, head, hlist) {
+ hlist_for_each_entry_safe(ri, tmp, head, hlist) {
if (ri->task != current)
/* another task is sharing our hash bucket */
continue;
@@ -559,7 +559,7 @@ int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs)
kretprobe_hash_unlock(current, &flags);
preempt_enable_no_resched();
- hlist_for_each_entry_safe(ri, node, tmp, &empty_rp, hlist) {
+ hlist_for_each_entry_safe(ri, tmp, &empty_rp, hlist) {
hlist_del(&ri->hlist);
kfree(ri);
}
View
@@ -953,9 +953,8 @@ static HLIST_HEAD(ldc_channel_list);
static int __ldc_channel_exists(unsigned long id)
{
struct ldc_channel *lp;
- struct hlist_node *n;
- hlist_for_each_entry(lp, n, &ldc_channel_list, list) {
+ hlist_for_each_entry(lp, &ldc_channel_list, list) {
if (lp->id == id)
return 1;
}
@@ -652,7 +652,7 @@ static __used __kprobes void *trampoline_handler(struct pt_regs *regs)
{
struct kretprobe_instance *ri = NULL;
struct hlist_head *head, empty_rp;
- struct hlist_node *node, *tmp;
+ struct hlist_node *tmp;
unsigned long flags, orig_ret_address = 0;
unsigned long trampoline_address = (unsigned long)&kretprobe_trampoline;
kprobe_opcode_t *correct_ret_addr = NULL;
@@ -682,7 +682,7 @@ static __used __kprobes void *trampoline_handler(struct pt_regs *regs)
* will be the real return address, and all the rest will
* point to kretprobe_trampoline.
*/
- hlist_for_each_entry_safe(ri, node, tmp, head, hlist) {
+ hlist_for_each_entry_safe(ri, tmp, head, hlist) {
if (ri->task != current)
/* another task is sharing our hash bucket */
continue;
@@ -701,7 +701,7 @@ static __used __kprobes void *trampoline_handler(struct pt_regs *regs)
kretprobe_assert(ri, orig_ret_address, trampoline_address);
correct_ret_addr = ri->ret_addr;
- hlist_for_each_entry_safe(ri, node, tmp, head, hlist) {
+ hlist_for_each_entry_safe(ri, tmp, head, hlist) {
if (ri->task != current)
/* another task is sharing our hash bucket */
continue;
@@ -728,7 +728,7 @@ static __used __kprobes void *trampoline_handler(struct pt_regs *regs)
kretprobe_hash_unlock(current, &flags);
- hlist_for_each_entry_safe(ri, node, tmp, &empty_rp, hlist) {
+ hlist_for_each_entry_safe(ri, tmp, &empty_rp, hlist) {
hlist_del(&ri->hlist);
kfree(ri);
}
Oops, something went wrong.

0 comments on commit b67bfe0

Please sign in to comment.