alistair23-linux/drivers/staging
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
..
android hlist: drop the node parameter from iterators 2013-02-27 19:10:24 -08:00
asus_oled staging: Remove unnecessary OOM messages 2013-02-11 10:10:33 -08:00
bcm Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2013-02-26 20:16:07 -08:00
ccg Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2013-02-26 20:16:07 -08:00
ced1401 staging: Remove unnecessary OOM messages 2013-02-11 10:10:33 -08:00
comedi staging: comedi: vmk80xx: wait for URBs to complete 2013-02-18 10:53:50 -08:00
cptm1217 staging: Remove unnecessary OOM messages 2013-02-11 10:10:33 -08:00
crystalhd staging: crystalhd: remove use of __devexit 2012-11-21 15:05:12 -08:00
csr Staging tree update for 3.9-rc1 2013-02-21 12:11:44 -08:00
cxt1e1 staging: cxt1e1: buffer overflow in do_del_chan() 2013-01-25 11:21:26 -08:00
dgrp Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2013-02-26 20:16:07 -08:00
echo staging: echo.c: fix memory leakage 2013-01-07 14:03:32 -08:00
et131x Staging tree update for 3.9-rc1 2013-02-21 12:11:44 -08:00
frontier staging: Remove unnecessary OOM messages 2013-02-11 10:10:33 -08:00
ft1000 Staging tree update for 3.9-rc1 2013-02-21 12:11:44 -08:00
fwserial tty/serial patches for 3.9-rc1 2013-02-21 13:41:04 -08:00
gdm72xx staging: Remove unnecessary OOM messages 2013-02-11 10:10:33 -08:00
goldfish staging/goldfish: Add MTD dependency to KCONFIG 2013-02-07 17:16:07 -08:00
iio Staging tree update for 3.9-rc1 2013-02-21 12:11:44 -08:00
imx-drm staging: ipu-di: Change DI address info to dev_dbg 2013-01-17 13:52:37 -08:00
keucr staging: Remove unnecessary OOM messages 2013-02-11 10:10:33 -08:00
line6 staging: Remove unnecessary OOM messages 2013-02-11 10:10:33 -08:00
media [media] staging: media: Remove unnecessary OOM messages 2013-02-13 17:32:46 -02:00
net staging: net: remove use of __devexit 2012-11-21 15:05:02 -08:00
nvec arm-soc: soc-specific updates 2013-02-21 15:27:22 -08:00
octeon Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2013-02-21 17:40:58 -08:00
olpc_dcon staging: olpc_dcon: remove use of __devexit_p 2012-11-21 15:05:00 -08:00
omap-thermal Staging tree update for 3.9-rc1 2013-02-21 12:11:44 -08:00
ozwpan staging/ozwpan: Mark read only parameters and structs as const 2013-02-15 15:14:30 -08:00
panel staging/panel: Mark local functions/structs static and add const if applicable (fix sparse warnings) 2013-02-15 10:20:14 -08:00
phison
quickstart ACPI: Remove useless type argument of driver .remove() operation 2013-01-26 00:37:24 +01:00
rtl8187se staging/rtl8187se: Mark functions as static to silence sparse 2013-02-15 10:28:37 -08:00
rtl8192e Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2013-01-15 15:05:59 -05:00
rtl8192u staging/rtl8192u/ieee80211: Fix buffer overflow in ieee80211_softmac_wx.c 2013-02-14 09:26:23 -08:00
rtl8712 rtl8712: remove unused definitions from ethernet.h 2013-01-11 16:39:12 -08:00
rts5139
sb105x tty/serial patches for 3.9-rc1 2013-02-21 13:41:04 -08:00
sbe-2t3e3 staging: Remove unnecessary OOM messages 2013-02-11 10:10:33 -08:00
sep staging: Remove unnecessary OOM messages 2013-02-11 10:10:33 -08:00
serqt_usb2 TTY: switch tty_schedule_flip 2013-01-15 22:43:15 -08:00
silicom
slicoss staging: slicoss: Fix space-related checkpatch.pl warnings 2013-01-17 13:53:06 -08:00
sm7xxfb staging: sm7xxfb: remove use of __devexit 2012-11-21 15:05:12 -08:00
speakup tty/serial patches for 3.9-rc1 2013-02-21 13:41:04 -08:00
ste_rmi4 staging: Remove unnecessary OOM messages 2013-02-11 10:10:33 -08:00
tidspbridge arm-soc: multiplatform support 2013-02-21 15:20:41 -08:00
usbip Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2013-02-26 20:16:07 -08:00
vme Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2013-02-26 20:16:07 -08:00
vt6655 staging: vt6655: no braces needed for single statement if , for blocks 2013-01-17 13:17:03 -08:00
vt6656 staging: vt6656: replaced custom TRUE definition with true 2013-02-15 10:48:24 -08:00
winbond staging: Add angle bracket before and after the URL 2013-01-07 14:56:04 -08:00
wlags49_h2 Staging tree update for 3.9-rc1 2013-02-21 12:11:44 -08:00
wlags49_h25
wlan-ng Staging tree update for 3.9-rc1 2013-02-21 12:11:44 -08:00
xgifb staging/xgifb: Remove duplicated code in loops. 2013-02-15 15:12:40 -08:00
zcache mm: rename page struct field helpers 2013-02-23 17:50:18 -08:00
zram staging: Remove unnecessary OOM messages 2013-02-11 10:10:33 -08:00
zsmalloc mm: rename page struct field helpers 2013-02-23 17:50:18 -08:00
Kconfig Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linux 2013-02-25 16:46:44 -08:00
Makefile Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linux 2013-02-25 16:46:44 -08:00
staging.c