Patchwork [next] infiniband: Kill directly reference of netdev->priv

login
register
mail settings
Submitter Wang Chen
Date Nov. 24, 2008, 9:31 a.m.
Message ID <492A748F.9040308@cn.fujitsu.com>
Download mbox | patch
Permalink /patch/10372/
State Accepted
Delegated to: David Miller
Headers show

Comments

Wang Chen - Nov. 24, 2008, 9:31 a.m.
This use of netdev->priv is wrong.
The right way is:
alloc_netdev() with no memory for private data.
make netdev->ml_priv to point to c2_dev.

I am doing this kind of work for net-next tree.
So I send this patch to Dave, although infiniband's maintainer is
not him.

Signed-off-by: Wang Chen <wangchen@cn.fujitsu.com>
---
 drivers/infiniband/hw/amso1100/c2_provider.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
Roland Dreier - Nov. 24, 2008, 5:01 p.m.
Looks fine to me.

Acked-by: Roland Dreier <rolandd@cisco.com>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller - Nov. 24, 2008, 11:34 p.m.
From: Roland Dreier <rdreier@cisco.com>
Date: Mon, 24 Nov 2008 09:01:28 -0800

> Looks fine to me.
> 
> Acked-by: Roland Dreier <rolandd@cisco.com>

Applied, thanks everyone.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/infiniband/hw/amso1100/c2_provider.c b/drivers/infiniband/hw/amso1100/c2_provider.c
index 69580e2..5119d65 100644
--- a/drivers/infiniband/hw/amso1100/c2_provider.c
+++ b/drivers/infiniband/hw/amso1100/c2_provider.c
@@ -653,7 +653,7 @@  static int c2_service_destroy(struct iw_cm_id *cm_id)
 static int c2_pseudo_up(struct net_device *netdev)
 {
 	struct in_device *ind;
-	struct c2_dev *c2dev = netdev->priv;
+	struct c2_dev *c2dev = netdev->ml_priv;
 
 	ind = in_dev_get(netdev);
 	if (!ind)
@@ -678,7 +678,7 @@  static int c2_pseudo_up(struct net_device *netdev)
 static int c2_pseudo_down(struct net_device *netdev)
 {
 	struct in_device *ind;
-	struct c2_dev *c2dev = netdev->priv;
+	struct c2_dev *c2dev = netdev->ml_priv;
 
 	ind = in_dev_get(netdev);
 	if (!ind)
@@ -746,14 +746,14 @@  static struct net_device *c2_pseudo_netdev_init(struct c2_dev *c2dev)
 	/* change ethxxx to iwxxx */
 	strcpy(name, "iw");
 	strcat(name, &c2dev->netdev->name[3]);
-	netdev = alloc_netdev(sizeof(*netdev), name, setup);
+	netdev = alloc_netdev(0, name, setup);
 	if (!netdev) {
 		printk(KERN_ERR PFX "%s -  etherdev alloc failed",
 			__func__);
 		return NULL;
 	}
 
-	netdev->priv = c2dev;
+	netdev->ml_priv = c2dev;
 
 	SET_NETDEV_DEV(netdev, &c2dev->pcidev->dev);