aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWang Chen <wangchen@cn.fujitsu.com>2008-12-08 04:14:16 -0500
committerDavid S. Miller <davem@davemloft.net>2008-12-08 04:14:16 -0500
commitb74ca3a896b9ab5f952bc440154758e708c48884 (patch)
treecc67fc67ddd6ac20e25b1060ab633a4d5c4e6ee8
parent5a001a070e032bea1be563b13ebf9819cd5e54d4 (diff)
netdevice: Kill netdev->priv
This is the last shoot of this series. After I removing all directly reference of netdev->priv, I am killing "priv" of "struct net_device" and fixing relative comments/docs. Anyone will not be allowed to reference netdev->priv directly. If you want to reference the memory of private data, use netdev_priv() instead. If the private data is not allocted when alloc_netdev(), use netdev->ml_priv to point that memory after you creating that private data. Signed-off-by: Wang Chen <wangchen@cn.fujitsu.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--Documentation/networking/driver.txt2
-rw-r--r--Documentation/networking/netdevices.txt2
-rw-r--r--drivers/net/3c501.h2
-rw-r--r--drivers/net/atp.c2
-rw-r--r--drivers/net/eexpress.c2
-rw-r--r--drivers/net/forcedeth.c4
-rw-r--r--drivers/net/lance.c2
-rw-r--r--drivers/net/myri_sbus.c2
-rw-r--r--drivers/net/pci-skeleton.c2
-rw-r--r--drivers/net/sun3_82586.c2
-rw-r--r--drivers/net/sunbmac.c2
-rw-r--r--drivers/net/tokenring/3c359.c5
-rw-r--r--drivers/net/via-rhine.c9
-rw-r--r--drivers/net/wireless/strip.c2
-rw-r--r--include/linux/hdlc.h2
-rw-r--r--include/linux/netdevice.h1
-rw-r--r--net/atm/mpc.c4
-rw-r--r--net/core/dev.c6
18 files changed, 24 insertions, 29 deletions
diff --git a/Documentation/networking/driver.txt b/Documentation/networking/driver.txt
index ea72d2e66ca8..03283daa64fe 100644
--- a/Documentation/networking/driver.txt
+++ b/Documentation/networking/driver.txt
@@ -13,7 +13,7 @@ Transmit path guidelines:
13 static int drv_hard_start_xmit(struct sk_buff *skb, 13 static int drv_hard_start_xmit(struct sk_buff *skb,
14 struct net_device *dev) 14 struct net_device *dev)
15 { 15 {
16 struct drv *dp = dev->priv; 16 struct drv *dp = netdev_priv(dev);
17 17
18 lock_tx(dp); 18 lock_tx(dp);
19 ... 19 ...
diff --git a/Documentation/networking/netdevices.txt b/Documentation/networking/netdevices.txt
index d0f71fc7f782..a2ab6a0b116d 100644
--- a/Documentation/networking/netdevices.txt
+++ b/Documentation/networking/netdevices.txt
@@ -18,7 +18,7 @@ There are routines in net_init.c to handle the common cases of
18alloc_etherdev, alloc_netdev. These reserve extra space for driver 18alloc_etherdev, alloc_netdev. These reserve extra space for driver
19private data which gets freed when the network device is freed. If 19private data which gets freed when the network device is freed. If
20separately allocated data is attached to the network device 20separately allocated data is attached to the network device
21(dev->priv) then it is up to the module exit handler to free that. 21(netdev_priv(dev)) then it is up to the module exit handler to free that.
22 22
23MTU 23MTU
24=== 24===
diff --git a/drivers/net/3c501.h b/drivers/net/3c501.h
index cfec64efff78..f40b0493337a 100644
--- a/drivers/net/3c501.h
+++ b/drivers/net/3c501.h
@@ -23,7 +23,7 @@ static const struct ethtool_ops netdev_ethtool_ops;
23static int el_debug = EL_DEBUG; 23static int el_debug = EL_DEBUG;
24 24
25/* 25/*
26 * Board-specific info in dev->priv. 26 * Board-specific info in netdev_priv(dev).
27 */ 27 */
28 28
29struct net_local 29struct net_local
diff --git a/drivers/net/atp.c b/drivers/net/atp.c
index 7028b276dfd3..1d6b74c5d6c9 100644
--- a/drivers/net/atp.c
+++ b/drivers/net/atp.c
@@ -420,7 +420,7 @@ static unsigned short __init eeprom_op(long ioaddr, u32 cmd)
420 registers that "should" only need to be set once at boot, so that 420 registers that "should" only need to be set once at boot, so that
421 there is non-reboot way to recover if something goes wrong. 421 there is non-reboot way to recover if something goes wrong.
422 422
423 This is an attachable device: if there is no dev->priv entry then it wasn't 423 This is an attachable device: if there is no private entry then it wasn't
424 probed for at boot-time, and we need to probe for it again. 424 probed for at boot-time, and we need to probe for it again.
425 */ 425 */
426static int net_open(struct net_device *dev) 426static int net_open(struct net_device *dev)
diff --git a/drivers/net/eexpress.c b/drivers/net/eexpress.c
index a125e41240f5..9ff3f2f5e382 100644
--- a/drivers/net/eexpress.c
+++ b/drivers/net/eexpress.c
@@ -1046,7 +1046,7 @@ static void eexp_hw_tx_pio(struct net_device *dev, unsigned short *buf,
1046/* 1046/*
1047 * Sanity check the suspected EtherExpress card 1047 * Sanity check the suspected EtherExpress card
1048 * Read hardware address, reset card, size memory and initialize buffer 1048 * Read hardware address, reset card, size memory and initialize buffer
1049 * memory pointers. These are held in dev->priv, in case someone has more 1049 * memory pointers. These are held in netdev_priv(), in case someone has more
1050 * than one card in a machine. 1050 * than one card in a machine.
1051 */ 1051 */
1052 1052
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
index 12384df8cb2b..1f2b24743ee9 100644
--- a/drivers/net/forcedeth.c
+++ b/drivers/net/forcedeth.c
@@ -712,12 +712,12 @@ struct nv_skb_map {
712 712
713/* 713/*
714 * SMP locking: 714 * SMP locking:
715 * All hardware access under dev->priv->lock, except the performance 715 * All hardware access under netdev_priv(dev)->lock, except the performance
716 * critical parts: 716 * critical parts:
717 * - rx is (pseudo-) lockless: it relies on the single-threading provided 717 * - rx is (pseudo-) lockless: it relies on the single-threading provided
718 * by the arch code for interrupts. 718 * by the arch code for interrupts.
719 * - tx setup is lockless: it relies on netif_tx_lock. Actual submission 719 * - tx setup is lockless: it relies on netif_tx_lock. Actual submission
720 * needs dev->priv->lock :-( 720 * needs netdev_priv(dev)->lock :-(
721 * - set_multicast_list: preparation lockless, relies on netif_tx_lock. 721 * - set_multicast_list: preparation lockless, relies on netif_tx_lock.
722 */ 722 */
723 723
diff --git a/drivers/net/lance.c b/drivers/net/lance.c
index e81b6113ed94..d7afb938ea62 100644
--- a/drivers/net/lance.c
+++ b/drivers/net/lance.c
@@ -519,7 +519,7 @@ static int __init lance_probe1(struct net_device *dev, int ioaddr, int irq, int
519 } 519 }
520 } 520 }
521 521
522 /* We can't allocate dev->priv from alloc_etherdev() because it must 522 /* We can't allocate private data from alloc_etherdev() because it must
523 a ISA DMA-able region. */ 523 a ISA DMA-able region. */
524 chipname = chip_table[lance_version].name; 524 chipname = chip_table[lance_version].name;
525 printk("%s: %s at %#3x, ", dev->name, chipname, ioaddr); 525 printk("%s: %s at %#3x, ", dev->name, chipname, ioaddr);
diff --git a/drivers/net/myri_sbus.c b/drivers/net/myri_sbus.c
index 6833f65f8aec..899ed065a147 100644
--- a/drivers/net/myri_sbus.c
+++ b/drivers/net/myri_sbus.c
@@ -1091,7 +1091,7 @@ static int __devinit myri_sbus_probe(struct of_device *op, const struct of_devic
1091err_free_irq: 1091err_free_irq:
1092 free_irq(dev->irq, dev); 1092 free_irq(dev->irq, dev);
1093err: 1093err:
1094 /* This will also free the co-allocated 'dev->priv' */ 1094 /* This will also free the co-allocated private data*/
1095 free_netdev(dev); 1095 free_netdev(dev);
1096 return -ENODEV; 1096 return -ENODEV;
1097} 1097}
diff --git a/drivers/net/pci-skeleton.c b/drivers/net/pci-skeleton.c
index b23b5c397b1d..c95fd72c3bb9 100644
--- a/drivers/net/pci-skeleton.c
+++ b/drivers/net/pci-skeleton.c
@@ -781,7 +781,7 @@ static int __devinit netdrv_init_one (struct pci_dev *pdev,
781 dev->irq = pdev->irq; 781 dev->irq = pdev->irq;
782 dev->base_addr = (unsigned long) ioaddr; 782 dev->base_addr = (unsigned long) ioaddr;
783 783
784 /* dev->priv/tp zeroed and aligned in alloc_etherdev */ 784 /* netdev_priv()/tp zeroed and aligned in alloc_etherdev */
785 tp = netdev_priv(dev); 785 tp = netdev_priv(dev);
786 786
787 /* note: tp->chipset set in netdrv_init_board */ 787 /* note: tp->chipset set in netdrv_init_board */
diff --git a/drivers/net/sun3_82586.c b/drivers/net/sun3_82586.c
index e8f97d5c9c23..e0d84772771c 100644
--- a/drivers/net/sun3_82586.c
+++ b/drivers/net/sun3_82586.c
@@ -209,7 +209,7 @@ static int sun3_82586_open(struct net_device *dev)
209static int check586(struct net_device *dev,char *where,unsigned size) 209static int check586(struct net_device *dev,char *where,unsigned size)
210{ 210{
211 struct priv pb; 211 struct priv pb;
212 struct priv *p = /* (struct priv *) dev->priv*/ &pb; 212 struct priv *p = &pb;
213 char *iscp_addr; 213 char *iscp_addr;
214 int i; 214 int i;
215 215
diff --git a/drivers/net/sunbmac.c b/drivers/net/sunbmac.c
index 977b3e08bbfc..7f69c7f176c4 100644
--- a/drivers/net/sunbmac.c
+++ b/drivers/net/sunbmac.c
@@ -1233,7 +1233,7 @@ fail_and_cleanup:
1233 bp->bmac_block, 1233 bp->bmac_block,
1234 bp->bblock_dvma); 1234 bp->bblock_dvma);
1235 1235
1236 /* This also frees the co-located 'dev->priv' */ 1236 /* This also frees the co-located private data */
1237 free_netdev(dev); 1237 free_netdev(dev);
1238 return -ENODEV; 1238 return -ENODEV;
1239} 1239}
diff --git a/drivers/net/tokenring/3c359.c b/drivers/net/tokenring/3c359.c
index e7a944657cf8..43853e3b210e 100644
--- a/drivers/net/tokenring/3c359.c
+++ b/drivers/net/tokenring/3c359.c
@@ -296,8 +296,9 @@ static int __devinit xl_probe(struct pci_dev *pdev,
296 } ; 296 } ;
297 297
298 /* 298 /*
299 * Allowing init_trdev to allocate the dev->priv structure will align xl_private 299 * Allowing init_trdev to allocate the private data will align
300 * on a 32 bytes boundary which we need for the rx/tx descriptors 300 * xl_private on a 32 bytes boundary which we need for the rx/tx
301 * descriptors
301 */ 302 */
302 303
303 dev = alloc_trdev(sizeof(struct xl_private)) ; 304 dev = alloc_trdev(sizeof(struct xl_private)) ;
diff --git a/drivers/net/via-rhine.c b/drivers/net/via-rhine.c
index 93b74b7b7077..8d405c83df8b 100644
--- a/drivers/net/via-rhine.c
+++ b/drivers/net/via-rhine.c
@@ -191,12 +191,13 @@ IIId. Synchronization
191 191
192The driver runs as two independent, single-threaded flows of control. One 192The driver runs as two independent, single-threaded flows of control. One
193is the send-packet routine, which enforces single-threaded use by the 193is the send-packet routine, which enforces single-threaded use by the
194dev->priv->lock spinlock. The other thread is the interrupt handler, which 194netdev_priv(dev)->lock spinlock. The other thread is the interrupt handler,
195is single threaded by the hardware and interrupt handling software. 195which is single threaded by the hardware and interrupt handling software.
196 196
197The send packet thread has partial control over the Tx ring. It locks the 197The send packet thread has partial control over the Tx ring. It locks the
198dev->priv->lock whenever it's queuing a Tx packet. If the next slot in the ring 198netdev_priv(dev)->lock whenever it's queuing a Tx packet. If the next slot in
199is not available it stops the transmit queue by calling netif_stop_queue. 199the ring is not available it stops the transmit queue by
200calling netif_stop_queue.
200 201
201The interrupt handler has exclusive control over the Rx ring and records stats 202The interrupt handler has exclusive control over the Rx ring and records stats
202from the Tx ring. After reaping the stats, it marks the Tx queue entry as 203from the Tx ring. After reaping the stats, it marks the Tx queue entry as
diff --git a/drivers/net/wireless/strip.c b/drivers/net/wireless/strip.c
index 692e6c5e009a..dd0de3a9ed4e 100644
--- a/drivers/net/wireless/strip.c
+++ b/drivers/net/wireless/strip.c
@@ -2494,7 +2494,7 @@ static void strip_dev_setup(struct net_device *dev)
2494 dev->type = ARPHRD_METRICOM; /* dtang */ 2494 dev->type = ARPHRD_METRICOM; /* dtang */
2495 dev->hard_header_len = sizeof(STRIP_Header); 2495 dev->hard_header_len = sizeof(STRIP_Header);
2496 /* 2496 /*
2497 * dev->priv Already holds a pointer to our struct strip 2497 * netdev_priv(dev) Already holds a pointer to our struct strip
2498 */ 2498 */
2499 2499
2500 *(MetricomAddress *) & dev->broadcast = broadcast_address; 2500 *(MetricomAddress *) & dev->broadcast = broadcast_address;
diff --git a/include/linux/hdlc.h b/include/linux/hdlc.h
index e960faac609d..fd47a151665e 100644
--- a/include/linux/hdlc.h
+++ b/include/linux/hdlc.h
@@ -43,7 +43,7 @@ struct hdlc_proto {
43}; 43};
44 44
45 45
46/* Pointed to by dev->priv */ 46/* Pointed to by netdev_priv(dev) */
47typedef struct hdlc_device { 47typedef struct hdlc_device {
48 /* used by HDLC layer to take control over HDLC device from hw driver*/ 48 /* used by HDLC layer to take control over HDLC device from hw driver*/
49 int (*attach)(struct net_device *dev, 49 int (*attach)(struct net_device *dev,
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 0df0db068ac3..47e731528315 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -785,7 +785,6 @@ struct net_device
785/* 785/*
786 * One part is mostly used on xmit path (device) 786 * One part is mostly used on xmit path (device)
787 */ 787 */
788 void *priv; /* pointer to private data */
789 /* These may be needed for future network-power-down code. */ 788 /* These may be needed for future network-power-down code. */
790 unsigned long trans_start; /* Time (in jiffies) of last Tx */ 789 unsigned long trans_start; /* Time (in jiffies) of last Tx */
791 790
diff --git a/net/atm/mpc.c b/net/atm/mpc.c
index 12e9ea371db1..039d5cc72c3d 100644
--- a/net/atm/mpc.c
+++ b/net/atm/mpc.c
@@ -341,8 +341,8 @@ static const char *mpoa_device_type_string(char type)
341} 341}
342 342
343/* 343/*
344 * lec device calls this via its dev->priv->lane2_ops->associate_indicator() 344 * lec device calls this via its netdev_priv(dev)->lane2_ops
345 * when it sees a TLV in LE_ARP packet. 345 * ->associate_indicator() when it sees a TLV in LE_ARP packet.
346 * We fill in the pointer above when we see a LANE2 lec initializing 346 * We fill in the pointer above when we see a LANE2 lec initializing
347 * See LANE2 spec 3.1.5 347 * See LANE2 spec 3.1.5
348 * 348 *
diff --git a/net/core/dev.c b/net/core/dev.c
index 4615e9a443aa..f54cac76438a 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -4378,12 +4378,6 @@ struct net_device *alloc_netdev_mq(int sizeof_priv, const char *name,
4378 dev->num_tx_queues = queue_count; 4378 dev->num_tx_queues = queue_count;
4379 dev->real_num_tx_queues = queue_count; 4379 dev->real_num_tx_queues = queue_count;
4380 4380
4381 if (sizeof_priv) {
4382 dev->priv = ((char *)dev +
4383 ((sizeof(struct net_device) + NETDEV_ALIGN_CONST)
4384 & ~NETDEV_ALIGN_CONST));
4385 }
4386
4387 dev->gso_max_size = GSO_MAX_SIZE; 4381 dev->gso_max_size = GSO_MAX_SIZE;
4388 4382
4389 netdev_init_queues(dev); 4383 netdev_init_queues(dev);