summaryrefslogtreecommitdiffstats
path: root/drivers/net/tokenring/tmspci.c
diff options
context:
space:
mode:
authorYoann Padioleau <padator@wanadoo.fr>2007-07-23 15:18:21 +0200
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 16:50:19 -0700
commiteda105317fece79fa7e8478214ff7450f5a3f9dd (patch)
tree4d781702bd664c58629bd649a929d78874de400c /drivers/net/tokenring/tmspci.c
parentaf096046f63a065b692018cd4b8f5e7525c3e56a (diff)
downloadlinux-eda105317fece79fa7e8478214ff7450f5a3f9dd.tar.gz
linux-eda105317fece79fa7e8478214ff7450f5a3f9dd.tar.bz2
linux-eda105317fece79fa7e8478214ff7450f5a3f9dd.zip
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>
Diffstat (limited to 'drivers/net/tokenring/tmspci.c')
-rw-r--r--drivers/net/tokenring/tmspci.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/net/tokenring/tmspci.c b/drivers/net/tokenring/tmspci.c
index 3b2f00b9b7bd..aec75c930c21 100644
--- a/drivers/net/tokenring/tmspci.c
+++ b/drivers/net/tokenring/tmspci.c
@@ -149,7 +149,7 @@ static int __devinit tms_pci_attach(struct pci_dev *pdev, const struct pci_devic
goto err_out_irq;
}
- tp = dev->priv;
+ tp = netdev_priv(dev);
tp->setnselout = tms_pci_setnselout_pins;
tp->sifreadb = tms_pci_sifreadb;
@@ -210,7 +210,7 @@ static void tms_pci_read_eeprom(struct net_device *dev)
static unsigned short tms_pci_setnselout_pins(struct net_device *dev)
{
unsigned short val = 0;
- struct net_local *tp = dev->priv;
+ struct net_local *tp = netdev_priv(dev);
struct card_info *cardinfo = tp->tmspriv;
if(tp->DataRate == SPEED_4)