linux/drivers/net
Sasha Levin b67bfe0d42 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>
2013-02-27 19:10:24 -08:00
..
appletalk
arcnet ARCNET: remove __dev* attributes 2012-12-03 11:16:10 -08:00
bonding bonding: set sysfs device_type to 'bond' 2013-02-19 00:51:09 -05:00
caif tty/serial patches for 3.9-rc1 2013-02-21 13:41:04 -08:00
can tty/serial patches for 3.9-rc1 2013-02-21 13:41:04 -08:00
cris ethtool: fix drvinfo strings set in drivers 2013-01-06 21:06:31 -08:00
dsa DSA: Convert spaces to tabs where appropriate 2013-01-10 00:04:34 -08:00
ethernet hlist: drop the node parameter from iterators 2013-02-27 19:10:24 -08:00
fddi drivers/net: fix up function prototypes after __dev* removals 2012-12-07 14:22:22 -05:00
hamradio tty/serial patches for 3.9-rc1 2013-02-21 13:41:04 -08:00
hippi drivers/net/hippi: remove depends on CONFIG_EXPERIMENTAL 2013-01-22 12:01:34 -08:00
hyperv Char/Misc driver patches for 3.9-rc1 2013-02-21 13:57:13 -08:00
ieee802154 ieee802154: at86rf230: Remove empty suspend/resume callbacks 2013-02-15 15:35:34 -05:00
irda Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2013-02-21 17:40:58 -08:00
phy Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux 2013-02-21 17:54:03 -08:00
plip
ppp ppp: convert to idr_alloc() 2013-02-27 19:10:18 -08:00
slip tty: Added a CONFIG_TTY option to allow removal of TTY 2013-01-18 16:15:27 -08:00
team Driver core patches for 3.9-rc1 2013-02-21 12:05:51 -08:00
usb Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2013-02-26 11:44:11 -08:00
vmxnet3 vmxnet3: fix ethtool ring buffer size setting 2013-02-24 20:18:55 -05:00
wan Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2013-02-26 20:16:07 -08:00
wimax Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2013-02-20 18:58:50 -08:00
wireless hlist: drop the node parameter from iterators 2013-02-27 19:10:24 -08:00
xen-netback Revert "xen: netback: remove redundant xenvif_put" 2013-02-19 13:04:34 -05:00
Kconfig Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2013-02-26 11:44:11 -08:00
LICENSE.SRC
Makefile net: Add support for NTB virtual ethernet device 2013-01-17 19:11:14 -08:00
Space.c drivers/net: delete old x86 variant of the seeq8005 driver 2013-01-22 10:39:56 -05:00
dummy.c dummy: implement carrier change 2012-12-28 15:24:19 -08:00
eql.c
ifb.c ifb: dont hard code inet_net use 2013-01-14 15:13:39 -05:00
loopback.c net: loopback: fix a dst refcounting issue 2013-01-27 01:30:35 -05:00
macvlan.c hlist: drop the node parameter from iterators 2013-02-27 19:10:24 -08:00
macvtap.c macvtap: convert to idr_alloc() 2013-02-27 19:10:18 -08:00
mdio.c
mii.c
netconsole.c netpoll: add IPv6 support 2013-01-08 17:56:10 -08:00
ntb_netdev.c ntb_netdev: Update Version 2013-01-20 15:48:14 -08:00
rionet.c ethtool: fix drvinfo strings set in drivers 2013-01-06 21:06:31 -08:00
sb1000.c
sungem_phy.c Fix misspellings of "whether" in comments. 2012-11-19 14:31:35 +01:00
tun.c hlist: drop the node parameter from iterators 2013-02-27 19:10:24 -08:00
veth.c veth: fix NULL dereference in veth_dellink() 2013-02-10 20:41:43 -05:00
virtio_net.c All trivial, thanks to the stuff which didn't quite make it time. 2013-02-26 14:49:12 -08:00
vxlan.c hlist: drop the node parameter from iterators 2013-02-27 19:10:24 -08:00
xen-netfront.c xen/netfront: improve truesize tracking 2013-01-07 19:51:19 -08:00