]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
netdevice: Kill netdev->priv
authorWang Chen <wangchen@cn.fujitsu.com>
Mon, 8 Dec 2008 09:14:16 +0000 (01:14 -0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 8 Dec 2008 09:14:16 +0000 (01:14 -0800)
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>
18 files changed:
Documentation/networking/driver.txt
Documentation/networking/netdevices.txt
drivers/net/3c501.h
drivers/net/atp.c
drivers/net/eexpress.c
drivers/net/forcedeth.c
drivers/net/lance.c
drivers/net/myri_sbus.c
drivers/net/pci-skeleton.c
drivers/net/sun3_82586.c
drivers/net/sunbmac.c
drivers/net/tokenring/3c359.c
drivers/net/via-rhine.c
drivers/net/wireless/strip.c
include/linux/hdlc.h
include/linux/netdevice.h
net/atm/mpc.c
net/core/dev.c

index ea72d2e66ca81a62fa493b695ed0e5cf94fc92a4..03283daa64fef72360667fb979a256aa10a3bb91 100644 (file)
@@ -13,7 +13,7 @@ Transmit path guidelines:
        static int drv_hard_start_xmit(struct sk_buff *skb,
                                       struct net_device *dev)
        {
-               struct drv *dp = dev->priv;
+               struct drv *dp = netdev_priv(dev);
 
                lock_tx(dp);
                ...
index d0f71fc7f7829b1dfb9dfc689afe0978bec53c76..a2ab6a0b116d96ff8e6198154d5f455cac2fec5e 100644 (file)
@@ -18,7 +18,7 @@ There are routines in net_init.c to handle the common cases of
 alloc_etherdev, alloc_netdev.  These reserve extra space for driver
 private data which gets freed when the network device is freed. If
 separately allocated data is attached to the network device
-(dev->priv) then it is up to the module exit handler to free that.
+(netdev_priv(dev)) then it is up to the module exit handler to free that.
 
 MTU
 ===
index cfec64efff78017b5db4ee3dd6d24ac42a983e32..f40b0493337a05162b2e522c09c5d7b867dbd52a 100644 (file)
@@ -23,7 +23,7 @@ static const struct ethtool_ops netdev_ethtool_ops;
 static int el_debug = EL_DEBUG;
 
 /*
- *     Board-specific info in dev->priv.
+ *     Board-specific info in netdev_priv(dev).
  */
 
 struct net_local
index 7028b276dfd3c7d2f9db1d19e429f67f432dd371..1d6b74c5d6c942a5479c36ffca6a6eaaa317ef19 100644 (file)
@@ -420,7 +420,7 @@ static unsigned short __init eeprom_op(long ioaddr, u32 cmd)
    registers that "should" only need to be set once at boot, so that
    there is non-reboot way to recover if something goes wrong.
 
-   This is an attachable device: if there is no dev->priv entry then it wasn't
+   This is an attachable device: if there is no private entry then it wasn't
    probed for at boot-time, and we need to probe for it again.
    */
 static int net_open(struct net_device *dev)
index a125e41240f52315def85ef2b242426f817a0ce0..9ff3f2f5e3829a431b1bb6f010fa172ff005374d 100644 (file)
@@ -1046,7 +1046,7 @@ static void eexp_hw_tx_pio(struct net_device *dev, unsigned short *buf,
 /*
  * Sanity check the suspected EtherExpress card
  * Read hardware address, reset card, size memory and initialize buffer
- * memory pointers. These are held in dev->priv, in case someone has more
+ * memory pointers. These are held in netdev_priv(), in case someone has more
  * than one card in a machine.
  */
 
index 12384df8cb2be641d95988982e996610d8b2add1..1f2b24743ee9ec0fc1a76c893e7bfa023940f218 100644 (file)
@@ -712,12 +712,12 @@ struct nv_skb_map {
 
 /*
  * SMP locking:
- * All hardware access under dev->priv->lock, except the performance
+ * All hardware access under netdev_priv(dev)->lock, except the performance
  * critical parts:
  * - rx is (pseudo-) lockless: it relies on the single-threading provided
  *     by the arch code for interrupts.
  * - tx setup is lockless: it relies on netif_tx_lock. Actual submission
- *     needs dev->priv->lock :-(
+ *     needs netdev_priv(dev)->lock :-(
  * - set_multicast_list: preparation lockless, relies on netif_tx_lock.
  */
 
index e81b6113ed94173cee9d39f00eb905e41b715b4c..d7afb938ea626ae3bdf2c3c005dfacab258f2696 100644 (file)
@@ -519,7 +519,7 @@ static int __init lance_probe1(struct net_device *dev, int ioaddr, int irq, int
                }
        }
 
-       /* We can't allocate dev->priv from alloc_etherdev() because it must
+       /* We can't allocate private data from alloc_etherdev() because it must
           a ISA DMA-able region. */
        chipname = chip_table[lance_version].name;
        printk("%s: %s at %#3x, ", dev->name, chipname, ioaddr);
index 6833f65f8aeca2edbb67223f0ed88bf8e8e64aa4..899ed065a1478dc7ef4303b445285954776eb282 100644 (file)
@@ -1091,7 +1091,7 @@ static int __devinit myri_sbus_probe(struct of_device *op, const struct of_devic
 err_free_irq:
        free_irq(dev->irq, dev);
 err:
-       /* This will also free the co-allocated 'dev->priv' */
+       /* This will also free the co-allocated private data*/
        free_netdev(dev);
        return -ENODEV;
 }
index b23b5c397b1d27410d3fc94576502504a7c1d5f0..c95fd72c3bb96886a9862d27533ef20d650e32be 100644 (file)
@@ -781,7 +781,7 @@ static int __devinit netdrv_init_one (struct pci_dev *pdev,
        dev->irq = pdev->irq;
        dev->base_addr = (unsigned long) ioaddr;
 
-       /* dev->priv/tp zeroed and aligned in alloc_etherdev */
+       /* netdev_priv()/tp zeroed and aligned in alloc_etherdev */
        tp = netdev_priv(dev);
 
        /* note: tp->chipset set in netdrv_init_board */
index e8f97d5c9c239f14598aece1e865e469a1e5eb6f..e0d84772771ca6bf61a32f9019104b500680114b 100644 (file)
@@ -209,7 +209,7 @@ static int sun3_82586_open(struct net_device *dev)
 static int check586(struct net_device *dev,char *where,unsigned size)
 {
        struct priv pb;
-       struct priv *p = /* (struct priv *) dev->priv*/ &pb;
+       struct priv *p = &pb;
        char *iscp_addr;
        int i;
 
index 977b3e08bbfc5eb706f29534d2d2c818d5b79cc7..7f69c7f176c457f7d6d46f58fda37ab7363c4b3a 100644 (file)
@@ -1233,7 +1233,7 @@ fail_and_cleanup:
                                  bp->bmac_block,
                                  bp->bblock_dvma);
 
-       /* This also frees the co-located 'dev->priv' */
+       /* This also frees the co-located private data */
        free_netdev(dev);
        return -ENODEV;
 }
index e7a944657cf8bc966c76d9a0dcb46bac0a9ea3d8..43853e3b210e42977100f1c1b3828a3dfa9fe623 100644 (file)
@@ -296,8 +296,9 @@ static int __devinit xl_probe(struct pci_dev *pdev,
        } ; 
 
        /* 
-        * Allowing init_trdev to allocate the dev->priv structure will align xl_private
-        * on a 32 bytes boundary which we need for the rx/tx descriptors
+        * Allowing init_trdev to allocate the private data will align
+        * xl_private on a 32 bytes boundary which we need for the rx/tx
+        * descriptors
         */
 
        dev = alloc_trdev(sizeof(struct xl_private)) ; 
index 93b74b7b7077281935d488a23a401bd527ed6ea6..8d405c83df8b8b882e2df8294e3567d8083269ca 100644 (file)
@@ -191,12 +191,13 @@ IIId. Synchronization
 
 The driver runs as two independent, single-threaded flows of control. One
 is the send-packet routine, which enforces single-threaded use by the
-dev->priv->lock spinlock. The other thread is the interrupt handler, which
-is single threaded by the hardware and interrupt handling software.
+netdev_priv(dev)->lock spinlock. The other thread is the interrupt handler,
+which is single threaded by the hardware and interrupt handling software.
 
 The send packet thread has partial control over the Tx ring. It locks the
-dev->priv->lock whenever it's queuing a Tx packet. If the next slot in the ring
-is not available it stops the transmit queue by calling netif_stop_queue.
+netdev_priv(dev)->lock whenever it's queuing a Tx packet. If the next slot in
+the ring is not available it stops the transmit queue by
+calling netif_stop_queue.
 
 The interrupt handler has exclusive control over the Rx ring and records stats
 from the Tx ring. After reaping the stats, it marks the Tx queue entry as
index 692e6c5e009a8877628ecf4351f1f54fbbe9ca24..dd0de3a9ed4eef2f479b5a36aead3d580ba50d81 100644 (file)
@@ -2494,7 +2494,7 @@ static void strip_dev_setup(struct net_device *dev)
        dev->type = ARPHRD_METRICOM;    /* dtang */
        dev->hard_header_len = sizeof(STRIP_Header);
        /*
-        *  dev->priv             Already holds a pointer to our struct strip
+        *  netdev_priv(dev) Already holds a pointer to our struct strip
         */
 
        *(MetricomAddress *) & dev->broadcast = broadcast_address;
index e960faac609d60ca0c502da49ec6f2ca9760c4c1..fd47a151665e363a5d9cdb63f33810ccd55f9a1d 100644 (file)
@@ -43,7 +43,7 @@ struct hdlc_proto {
 };
 
 
-/* Pointed to by dev->priv */
+/* Pointed to by netdev_priv(dev) */
 typedef struct hdlc_device {
        /* used by HDLC layer to take control over HDLC device from hw driver*/
        int (*attach)(struct net_device *dev,
index 0df0db068ac3f301d89fbbe9f734c7347ccd3d90..47e7315283156c72186ae31648d527c7831e6ddd 100644 (file)
@@ -785,7 +785,6 @@ struct net_device
 /*
  * One part is mostly used on xmit path (device)
  */
-       void                    *priv;  /* pointer to private data      */
        /* These may be needed for future network-power-down code. */
        unsigned long           trans_start;    /* Time (in jiffies) of last Tx */
 
index 12e9ea371db1818e604516f8920f0b81d24c4f39..039d5cc72c3df648d1b413ed042a296b7071a65f 100644 (file)
@@ -341,8 +341,8 @@ static const char *mpoa_device_type_string(char type)
 }
 
 /*
- * lec device calls this via its dev->priv->lane2_ops->associate_indicator()
- * when it sees a TLV in LE_ARP packet.
+ * lec device calls this via its netdev_priv(dev)->lane2_ops
+ * ->associate_indicator() when it sees a TLV in LE_ARP packet.
  * We fill in the pointer above when we see a LANE2 lec initializing
  * See LANE2 spec 3.1.5
  *
index 4615e9a443aa6314a23112816485bc4885c5853d..f54cac76438a144d78ae50d63b2ef4f6e11ae048 100644 (file)
@@ -4378,12 +4378,6 @@ struct net_device *alloc_netdev_mq(int sizeof_priv, const char *name,
        dev->num_tx_queues = queue_count;
        dev->real_num_tx_queues = queue_count;
 
-       if (sizeof_priv) {
-               dev->priv = ((char *)dev +
-                            ((sizeof(struct net_device) + NETDEV_ALIGN_CONST)
-                             & ~NETDEV_ALIGN_CONST));
-       }
-
        dev->gso_max_size = GSO_MAX_SIZE;
 
        netdev_init_queues(dev);