kernel_optimize_test/drivers/net/tokenring
Yoann Padioleau eda105317f dev->priv to netdev_priv(dev), drivers/net/tokenring/
Replacing accesses to dev->priv to netdev_priv(dev). The replacment
is safe when netdev_priv is used to access a private structure that is
right next to the net_device structure in memory.
Cf http://groups.google.com/group/comp.os.linux.development.system/browse_thread/thread/de19321bcd94dbb8/0d74a4adcd6177bd
This is the case when the net_device structure was allocated with
a call to alloc_netdev or one of its derivative.

Here is an excerpt of the semantic patch that performs the transformation

@ rule1 @
type T;
struct net_device *dev;
@@

 dev =
(
        alloc_netdev
|
        alloc_etherdev
|
        alloc_trdev
)
   (sizeof(T), ...)

@ rule1bis @
struct net_device *dev;
expression E;
@@
 dev->priv = E

@ rule2 depends on rule1 && !rule1bis  @
struct net_device *dev;
type rule1.T;
@@

- (T*) dev->priv
+ netdev_priv(dev)

PS: I have performed the same transformation on the whole kernel
and it affects around 70 files, most of them in drivers/net/.
Should I split my patch for each subnet directories ? (wireless/, wan/, etc)

Thanks to Thomas Surrel for helping me refining my semantic patch.

Signed-off-by: Yoann Padioleau <padator@wanadoo.fr>

 3c359.c       |   58 +++++++++++++++++++++++++++++-----------------------------
 ibmtr.c       |   38 +++++++++++++++++++-------------------
 lanstreamer.c |   32 ++++++++++++++++----------------
 madgemc.c     |    4 ++--
 olympic.c     |   36 ++++++++++++++++++------------------
 tmspci.c      |    4 ++--
 6 files changed, 86 insertions(+), 86 deletions(-)
Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-10-10 16:50:19 -07:00
..
3c359_microcode.h
3c359.c dev->priv to netdev_priv(dev), drivers/net/tokenring/ 2007-10-10 16:50:19 -07:00
3c359.h
abyss.c [PATCH] irq-flags: drivers/net: Use the new IRQF_ constants 2006-07-02 13:58:51 -07:00
abyss.h
ibmtr.c dev->priv to netdev_priv(dev), drivers/net/tokenring/ 2007-10-10 16:50:19 -07:00
Kconfig [TR]: Use menuconfig objects. 2007-05-24 16:36:52 -07:00
lanstreamer.c dev->priv to netdev_priv(dev), drivers/net/tokenring/ 2007-10-10 16:50:19 -07:00
lanstreamer.h [PATCH] drivers/net/tokenring/lanstreamer.h Removal of old code 2006-09-25 20:01:19 -04:00
madgemc.c dev->priv to netdev_priv(dev), drivers/net/tokenring/ 2007-10-10 16:50:19 -07:00
madgemc.h
Makefile
olympic.c dev->priv to netdev_priv(dev), drivers/net/tokenring/ 2007-10-10 16:50:19 -07:00
olympic.h
proteon.c [PATCH] tokenring: fix module_init error handling 2006-10-31 20:22:05 -05:00
skisa.c [PATCH] tokenring: fix module_init error handling 2006-10-31 20:22:05 -05:00
smctr_firmware.h Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
smctr.c drivers/*: mark variables with uninitialized_var() 2007-07-17 16:23:19 -04:00
smctr.h [PATCH] smctr warning fix 2006-02-17 16:16:21 -05:00
tms380tr.c [SK_BUFF]: Introduce skb_copy_to_linear_data{_offset} 2007-04-25 22:28:29 -07:00
tms380tr.h IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
tmspci.c dev->priv to netdev_priv(dev), drivers/net/tokenring/ 2007-10-10 16:50:19 -07:00