All of lore.kernel.org
 help / color / mirror / Atom feed
* netdev_priv()
@ 2007-07-18 22:24 Thomas Surrel
  2007-07-19  7:25 ` netdev_priv() pradeep singh
                   ` (17 more replies)
  0 siblings, 18 replies; 19+ messages in thread
From: Thomas Surrel @ 2007-07-18 22:24 UTC (permalink / raw)
  To: kernel-janitors

Hi,

I'm starting to work on the change to netdev_priv() call to access the
priv field of the net_device structure. Is anybody already working on
this ?

Also, what is the best way to organize my patches: one per subsystem
(wireless, token ring, ...) or even more detailed which would imply a
lot more patches ?

Regards,

Thomas

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: netdev_priv()
  2007-07-18 22:24 netdev_priv() Thomas Surrel
@ 2007-07-19  7:25 ` pradeep singh
  2007-07-19  7:51 ` netdev_priv() Yoann Padioleau
                   ` (16 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: pradeep singh @ 2007-07-19  7:25 UTC (permalink / raw)
  To: kernel-janitors

On 7/19/07, Thomas Surrel <thomas.surrel@gmail.com> wrote:
> Hi,
>
> I'm starting to work on the change to netdev_priv() call to access the
> priv field of the net_device structure. Is anybody already working on
> this ?

I am a little slow. Can you please help me in understanding why is a
change required in netdev_priv()?
Is something wrong in it?

thanks
--pradeep
>
> Also, what is the best way to organize my patches: one per subsystem
> (wireless, token ring, ...) or even more detailed which would imply a
> lot more patches ?
>
> Regards,
>
> Thomas
> -
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>


-- 
Pradeep

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: netdev_priv()
  2007-07-18 22:24 netdev_priv() Thomas Surrel
  2007-07-19  7:25 ` netdev_priv() pradeep singh
@ 2007-07-19  7:51 ` Yoann Padioleau
  2007-07-19  8:18 ` netdev_priv() Yoann Padioleau
                   ` (15 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: Yoann Padioleau @ 2007-07-19  7:51 UTC (permalink / raw)
  To: kernel-janitors

"Thomas Surrel" <thomas.surrel@gmail.com> writes:

> Hi,
>
> I'm starting to work on the change to netdev_priv() call to access the
> priv field of the net_device structure. Is anybody already working on
> this ?

Yes, I am working a little on it. I already have written 
a semantic patch that does the transformation: 

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

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


The end of this mail contains an excerpt of the patch generated
by my automatic program transformation tool given the semantic patch 
for drivers/net/arcnet/

>
> Also, what is the best way to organize my patches: one per subsystem
> (wireless, token ring, ...) or even more detailed which would imply a
> lot more patches ?

From what I understand Morton prefers patch per subsystem.
Maybe I can submit the patch generated automatically by my tool
and later you can try to find the remaining case that my tool
does not handle ? 

>
> Regards,
>
> Thomas
> -
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


diff --git a/drivers/net/arcnet/arcnet.c b/drivers/net/arcnet/arcnet.c
index 681e20b..d595f4f 100644
--- a/drivers/net/arcnet/arcnet.c
+++ b/drivers/net/arcnet/arcnet.c
@@ -353,7 +353,7 @@ struct net_device *alloc_arcdev(char *na
 	dev = alloc_netdev(sizeof(struct arcnet_local),
 			   name && *name ? name : "arc%d", arcdev_setup);
 	if(dev) {
-		struct arcnet_local *lp = (struct arcnet_local *) dev->priv;
+		struct arcnet_local *lp = netdev_priv(dev);
 		spin_lock_init(&lp->lock);
 	}
 
diff --git a/drivers/net/arcnet/capmode.c b/drivers/net/arcnet/capmode.c
index cc4610d..bd04be9 100644
--- a/drivers/net/arcnet/capmode.c
+++ b/drivers/net/arcnet/capmode.c
@@ -101,7 +101,7 @@ #endif				/* MODULE */
 static void rx(struct net_device *dev, int bufnum,
 	       struct archdr *pkthdr, int length)
 {
-	struct arcnet_local *lp = (struct arcnet_local *) dev->priv;
+	struct arcnet_local *lp = netdev_priv(dev);
 	struct sk_buff *skb;
 	struct archdr *pkt = pkthdr;
 	char *pktbuf, *pkthdrbuf;
@@ -196,7 +196,7 @@ static int build_header(struct sk_buff *
 static int prepare_tx(struct net_device *dev, struct archdr *pkt, int length,
 		      int bufnum)
 {
-	struct arcnet_local *lp = (struct arcnet_local *) dev->priv;
+	struct arcnet_local *lp = netdev_priv(dev);
 	struct arc_hardware *hard = &pkt->hard;
 	int ofs;
 
@@ -248,7 +248,7 @@ static int prepare_tx(struct net_device 
 
 static int ack_tx(struct net_device *dev, int acked)
 {
-  struct arcnet_local *lp = (struct arcnet_local *) dev->priv;
+  struct arcnet_local *lp = netdev_priv(dev);
   struct sk_buff *ackskb;
   struct archdr *ackpkt;
   int length=sizeof(struct arc_cap);


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* Re: netdev_priv()
  2007-07-18 22:24 netdev_priv() Thomas Surrel
  2007-07-19  7:25 ` netdev_priv() pradeep singh
  2007-07-19  7:51 ` netdev_priv() Yoann Padioleau
@ 2007-07-19  8:18 ` Yoann Padioleau
  2007-07-19  8:57 ` netdev_priv() Thomas Surrel
                   ` (14 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: Yoann Padioleau @ 2007-07-19  8:18 UTC (permalink / raw)
  To: kernel-janitors

Yoann Padioleau <padator@wanadoo.fr> writes:

> "Thomas Surrel" <thomas.surrel@gmail.com> writes:
>
>> Hi,
>>
>> I'm starting to work on the change to netdev_priv() call to access the
>> priv field of the net_device structure. Is anybody already working on
>> this ?
>
> Yes, I am working a little on it. I already have written 
> a semantic patch that does the transformation: 
>
> @@
> struct net_device *dev;
> type T;
> @@
>
> - (T) dev->priv
> + netdev_priv(dev)
>
>
> The end of this mail contains an excerpt of the patch generated
> by my automatic program transformation tool given the semantic patch 
> for drivers/net/arcnet/

Sorry, I forgot to use the isomorphism feature of my tool so the patch
was incomplete. Here is what my tool generates just on drivers/net/arcnet/ 
I can launch it on the whole kernel but the patch gets really big
so I will split it.



diff --git a/drivers/net/arcnet/arc-rawmode.c b/drivers/net/arcnet/arc-rawmode.c
index e0a18e7..909ba77 100644
--- a/drivers/net/arcnet/arc-rawmode.c
+++ b/drivers/net/arcnet/arc-rawmode.c
@@ -87,7 +87,7 @@ MODULE_LICENSE("GPL");
 static void rx(struct net_device *dev, int bufnum,
 	       struct archdr *pkthdr, int length)
 {
-	struct arcnet_local *lp = dev->priv;
+	struct arcnet_local *lp = netdev_priv(dev);
 	struct sk_buff *skb;
 	struct archdr *pkt = pkthdr;
 	int ofs;
@@ -168,7 +168,7 @@ static int build_header(struct sk_buff *
 static int prepare_tx(struct net_device *dev, struct archdr *pkt, int length,
 		      int bufnum)
 {
-	struct arcnet_local *lp = dev->priv;
+	struct arcnet_local *lp = netdev_priv(dev);
 	struct arc_hardware *hard = &pkt->hard;
 	int ofs;
 
diff --git a/drivers/net/arcnet/arc-rimi.c b/drivers/net/arcnet/arc-rimi.c
index 8c8d6c4..e3082a9 100644
--- a/drivers/net/arcnet/arc-rimi.c
+++ b/drivers/net/arcnet/arc-rimi.c
@@ -194,7 +194,7 @@ static int __init arcrimi_found(struct n
 
 	/* initialize the rest of the device structure. */
 
-	lp = dev->priv;
+	lp = netdev_priv(dev);
 	lp->card_name = "RIM I";
 	lp->hw.command = arcrimi_command;
 	lp->hw.status = arcrimi_status;
@@ -260,7 +260,7 @@ err_free_irq:
  */
 static int arcrimi_reset(struct net_device *dev, int really_reset)
 {
-	struct arcnet_local *lp = dev->priv;
+	struct arcnet_local *lp = netdev_priv(dev);
 	void __iomem *ioaddr = lp->mem_start + 0x800;
 
 	BUGMSG(D_INIT, "Resetting %s (status=%02Xh)\n", dev->name, ASTATUS());
@@ -281,7 +281,7 @@ static int arcrimi_reset(struct net_devi
 
 static void arcrimi_setmask(struct net_device *dev, int mask)
 {
-	struct arcnet_local *lp = dev->priv;
+	struct arcnet_local *lp = netdev_priv(dev);
 	void __iomem *ioaddr = lp->mem_start + 0x800;
 
 	AINTMASK(mask);
@@ -289,7 +289,7 @@ static void arcrimi_setmask(struct net_d
 
 static int arcrimi_status(struct net_device *dev)
 {
-	struct arcnet_local *lp = dev->priv;
+	struct arcnet_local *lp = netdev_priv(dev);
 	void __iomem *ioaddr = lp->mem_start + 0x800;
 
 	return ASTATUS();
@@ -297,7 +297,7 @@ static int arcrimi_status(struct net_dev
 
 static void arcrimi_command(struct net_device *dev, int cmd)
 {
-	struct arcnet_local *lp = dev->priv;
+	struct arcnet_local *lp = netdev_priv(dev);
 	void __iomem *ioaddr = lp->mem_start + 0x800;
 
 	ACOMMAND(cmd);
@@ -306,7 +306,7 @@ static void arcrimi_command(struct net_d
 static void arcrimi_copy_to_card(struct net_device *dev, int bufnum, int offset,
 				 void *buf, int count)
 {
-	struct arcnet_local *lp = dev->priv;
+	struct arcnet_local *lp = netdev_priv(dev);
 	void __iomem *memaddr = lp->mem_start + 0x800 + bufnum * 512 + offset;
 	TIME("memcpy_toio", count, memcpy_toio(memaddr, buf, count));
 }
@@ -315,7 +315,7 @@ static void arcrimi_copy_to_card(struct 
 static void arcrimi_copy_from_card(struct net_device *dev, int bufnum, int offset,
 				   void *buf, int count)
 {
-	struct arcnet_local *lp = dev->priv;
+	struct arcnet_local *lp = netdev_priv(dev);
 	void __iomem *memaddr = lp->mem_start + 0x800 + bufnum * 512 + offset;
 	TIME("memcpy_fromio", count, memcpy_fromio(buf, memaddr, count));
 }
@@ -361,7 +361,7 @@ static int __init arc_rimi_init(void)
 static void __exit arc_rimi_exit(void)
 {
 	struct net_device *dev = my_dev;
-	struct arcnet_local *lp = dev->priv;
+	struct arcnet_local *lp = netdev_priv(dev);
 
 	unregister_netdev(dev);
 	iounmap(lp->mem_start);
diff --git a/drivers/net/arcnet/arcnet.c b/drivers/net/arcnet/arcnet.c
index 681e20b..230b545 100644
--- a/drivers/net/arcnet/arcnet.c
+++ b/drivers/net/arcnet/arcnet.c
@@ -181,7 +181,7 @@ #if (ARCNET_DEBUG_MAX & (D_RX | D_TX))
 static void arcnet_dump_packet(struct net_device *dev, int bufnum,
 			       char *desc, int take_arcnet_lock)
 {
-	struct arcnet_local *lp = dev->priv;
+	struct arcnet_local *lp = netdev_priv(dev);
 	int i, length;
 	unsigned long flags = 0;
 	static uint8_t buf[512];
@@ -247,7 +247,7 @@ void arcnet_unregister_proto(struct ArcP
  */
 static void release_arcbuf(struct net_device *dev, int bufnum)
 {
-	struct arcnet_local *lp = dev->priv;
+	struct arcnet_local *lp = netdev_priv(dev);
 	int i;
 
 	lp->buf_queue[lp->first_free_buf++] = bufnum;
@@ -269,7 +269,7 @@ static void release_arcbuf(struct net_de
  */
 static int get_arcbuf(struct net_device *dev)
 {
-	struct arcnet_local *lp = dev->priv;
+	struct arcnet_local *lp = netdev_priv(dev);
 	int buf = -1, i;
 
 	if (!atomic_dec_and_test(&lp->buf_lock)) {
@@ -353,7 +353,7 @@ struct net_device *alloc_arcdev(char *na
 	dev = alloc_netdev(sizeof(struct arcnet_local),
 			   name && *name ? name : "arc%d", arcdev_setup);
 	if(dev) {
-		struct arcnet_local *lp = (struct arcnet_local *) dev->priv;
+		struct arcnet_local *lp = netdev_priv(dev);
 		spin_lock_init(&lp->lock);
 	}
 
@@ -370,7 +370,7 @@ struct net_device *alloc_arcdev(char *na
  */
 static int arcnet_open(struct net_device *dev)
 {
-	struct arcnet_local *lp = dev->priv;
+	struct arcnet_local *lp = netdev_priv(dev);
 	int count, newmtu, error;
 
 	BUGMSG(D_INIT,"opened.");
@@ -470,7 +470,7 @@ static int arcnet_open(struct net_device
 /* The inverse routine to arcnet_open - shuts down the card. */
 static int arcnet_close(struct net_device *dev)
 {
-	struct arcnet_local *lp = dev->priv;
+	struct arcnet_local *lp = netdev_priv(dev);
 
 	netif_stop_queue(dev);
 
@@ -491,7 +491,7 @@ static int arcnet_header(struct sk_buff 
 			 unsigned short type, void *daddr, void *saddr,
 			 unsigned len)
 {
-	struct arcnet_local *lp = dev->priv;
+	struct arcnet_local *lp = netdev_priv(dev);
 	uint8_t _daddr, proto_num;
 	struct ArcProto *proto;
 
@@ -552,7 +552,7 @@ static int arcnet_header(struct sk_buff 
 static int arcnet_rebuild_header(struct sk_buff *skb)
 {
 	struct net_device *dev = skb->dev;
-	struct arcnet_local *lp = dev->priv;
+	struct arcnet_local *lp = netdev_priv(dev);
 	int status = 0;		/* default is failure */
 	unsigned short type;
 	uint8_t daddr=0;
@@ -599,7 +599,7 @@ #endif
 /* Called by the kernel in order to transmit a packet. */
 static int arcnet_send_packet(struct sk_buff *skb, struct net_device *dev)
 {
-	struct arcnet_local *lp = dev->priv;
+	struct arcnet_local *lp = netdev_priv(dev);
 	struct archdr *pkt;
 	struct arc_rfc1201 *soft;
 	struct ArcProto *proto;
@@ -689,7 +689,7 @@ static int arcnet_send_packet(struct sk_
  */
 static int go_tx(struct net_device *dev)
 {
-	struct arcnet_local *lp = dev->priv;
+	struct arcnet_local *lp = netdev_priv(dev);
 
 	BUGMSG(D_DURING, "go_tx: status=%Xh, intmask=%Xh, next_tx=%d, cur_tx=%d\n",
 	       ASTATUS(), lp->intmask, lp->next_tx, lp->cur_tx);
@@ -719,7 +719,7 @@ static int go_tx(struct net_device *dev)
 static void arcnet_timeout(struct net_device *dev)
 {
 	unsigned long flags;
-	struct arcnet_local *lp = dev->priv;
+	struct arcnet_local *lp = netdev_priv(dev);
 	int status = ASTATUS();
 	char *msg;
 
@@ -768,7 +768,7 @@ irqreturn_t arcnet_interrupt(int irq, vo
 
 	BUGMSG(D_DURING, "in arcnet_interrupt\n");
 	
-	lp = dev->priv;
+	lp = netdev_priv(dev);
 	BUG_ON(!lp);
 		
 	spin_lock(&lp->lock);
@@ -1005,7 +1005,7 @@ irqreturn_t arcnet_interrupt(int irq, vo
  */
 static void arcnet_rx(struct net_device *dev, int bufnum)
 {
-	struct arcnet_local *lp = dev->priv;
+	struct arcnet_local *lp = netdev_priv(dev);
 	struct archdr pkt;
 	struct arc_rfc1201 *soft;
 	int length, ofs;
@@ -1069,7 +1069,7 @@ static void arcnet_rx(struct net_device 
  */
 static struct net_device_stats *arcnet_get_stats(struct net_device *dev)
 {
-	struct arcnet_local *lp = dev->priv;
+	struct arcnet_local *lp = netdev_priv(dev);
 	return &lp->stats;
 }
 
@@ -1086,7 +1086,7 @@ static void null_rx(struct net_device *d
 static int null_build_header(struct sk_buff *skb, struct net_device *dev,
 			     unsigned short type, uint8_t daddr)
 {
-	struct arcnet_local *lp = dev->priv;
+	struct arcnet_local *lp = netdev_priv(dev);
 
 	BUGMSG(D_PROTO,
 	       "tx: can't build header for encap %02Xh; load a protocol driver.\n",
@@ -1101,7 +1101,7 @@ static int null_build_header(struct sk_b
 static int null_prepare_tx(struct net_device *dev, struct archdr *pkt,
 			   int length, int bufnum)
 {
-	struct arcnet_local *lp = dev->priv;
+	struct arcnet_local *lp = netdev_priv(dev);
 	struct arc_hardware newpkt;
 
 	BUGMSG(D_PROTO, "tx: no encap for this host; load a protocol driver.\n");
diff --git a/drivers/net/arcnet/capmode.c b/drivers/net/arcnet/capmode.c
index cc4610d..bd04be9 100644
--- a/drivers/net/arcnet/capmode.c
+++ b/drivers/net/arcnet/capmode.c
@@ -101,7 +101,7 @@ #endif				/* MODULE */
 static void rx(struct net_device *dev, int bufnum,
 	       struct archdr *pkthdr, int length)
 {
-	struct arcnet_local *lp = (struct arcnet_local *) dev->priv;
+	struct arcnet_local *lp = netdev_priv(dev);
 	struct sk_buff *skb;
 	struct archdr *pkt = pkthdr;
 	char *pktbuf, *pkthdrbuf;
@@ -196,7 +196,7 @@ static int build_header(struct sk_buff *
 static int prepare_tx(struct net_device *dev, struct archdr *pkt, int length,
 		      int bufnum)
 {
-	struct arcnet_local *lp = (struct arcnet_local *) dev->priv;
+	struct arcnet_local *lp = netdev_priv(dev);
 	struct arc_hardware *hard = &pkt->hard;
 	int ofs;
 
@@ -248,7 +248,7 @@ static int prepare_tx(struct net_device 
 
 static int ack_tx(struct net_device *dev, int acked)
 {
-  struct arcnet_local *lp = (struct arcnet_local *) dev->priv;
+  struct arcnet_local *lp = netdev_priv(dev);
   struct sk_buff *ackskb;
   struct archdr *ackpkt;
   int length=sizeof(struct arc_cap);
diff --git a/drivers/net/arcnet/com20020-isa.c b/drivers/net/arcnet/com20020-isa.c
index 9289e61..ea53a94 100644
--- a/drivers/net/arcnet/com20020-isa.c
+++ b/drivers/net/arcnet/com20020-isa.c
@@ -52,7 +52,7 @@ static int __init com20020isa_probe(stru
 {
 	int ioaddr;
 	unsigned long airqmask;
-	struct arcnet_local *lp = dev->priv;
+	struct arcnet_local *lp = netdev_priv(dev);
 	int err;
 
 	BUGLVL(D_NORMAL) printk(VERSION);
@@ -151,7 +151,7 @@ static int __init com20020_init(void)
 	if (node && node != 0xff)
 		dev->dev_addr[0] = node;
 
-	lp = dev->priv;
+	lp = netdev_priv(dev);
 	lp->backplane = backplane;
 	lp->clockp = clockp & 7;
 	lp->clockm = clockm & 3;
diff --git a/drivers/net/arcnet/com20020-pci.c b/drivers/net/arcnet/com20020-pci.c
index b8c0fa6..8b51f63 100644
--- a/drivers/net/arcnet/com20020-pci.c
+++ b/drivers/net/arcnet/com20020-pci.c
@@ -72,7 +72,7 @@ static int __devinit com20020pci_probe(s
 	dev = alloc_arcdev(device);
 	if (!dev)
 		return -ENOMEM;
-	lp = dev->priv;
+	lp = netdev_priv(dev);
 
 	pci_set_drvdata(pdev, dev);
 
diff --git a/drivers/net/arcnet/com20020.c b/drivers/net/arcnet/com20020.c
index 7cf0a25..dd02463 100644
--- a/drivers/net/arcnet/com20020.c
+++ b/drivers/net/arcnet/com20020.c
@@ -89,7 +89,7 @@ static void com20020_copy_to_card(struct
 int com20020_check(struct net_device *dev)
 {
 	int ioaddr = dev->base_addr, status;
-	struct arcnet_local *lp = dev->priv;
+	struct arcnet_local *lp = netdev_priv(dev);
 
 	ARCRESET0;
 	mdelay(RESETtime);
@@ -159,7 +159,7 @@ int com20020_found(struct net_device *de
 
 	/* Initialize the rest of the device structure. */
 
-	lp = dev->priv;
+	lp = netdev_priv(dev);
 
 	lp->hw.owner = THIS_MODULE;
 	lp->hw.command = com20020_command;
@@ -233,7 +233,7 @@ int com20020_found(struct net_device *de
  */
 static int com20020_reset(struct net_device *dev, int really_reset)
 {
-	struct arcnet_local *lp = dev->priv;
+	struct arcnet_local *lp = netdev_priv(dev);
 	u_int ioaddr = dev->base_addr;
 	u_char inbyte;
 
@@ -300,7 +300,7 @@ static int com20020_status(struct net_de
 
 static void com20020_close(struct net_device *dev)
 {
-	struct arcnet_local *lp = dev->priv;
+	struct arcnet_local *lp = netdev_priv(dev);
 	int ioaddr = dev->base_addr;
 
 	/* disable transmitter */
@@ -317,7 +317,7 @@ static void com20020_close(struct net_de
  */
 static void com20020_set_mc_list(struct net_device *dev)
 {
-	struct arcnet_local *lp = dev->priv;
+	struct arcnet_local *lp = netdev_priv(dev);
 	int ioaddr = dev->base_addr;
 
 	if ((dev->flags & IFF_PROMISC) && (dev->flags & IFF_UP)) {	/* Enable promiscuous mode */
diff --git a/drivers/net/arcnet/com90io.c b/drivers/net/arcnet/com90io.c
index 1f03027..c6e373a 100644
--- a/drivers/net/arcnet/com90io.c
+++ b/drivers/net/arcnet/com90io.c
@@ -248,7 +248,7 @@ static int __init com90io_found(struct n
 		return -EBUSY;
 	}
 
-	lp = dev->priv;
+	lp = netdev_priv(dev);
 	lp->card_name = "COM90xx I/O";
 	lp->hw.command = com90io_command;
 	lp->hw.status = com90io_status;
@@ -290,7 +290,7 @@ static int __init com90io_found(struct n
  */
 static int com90io_reset(struct net_device *dev, int really_reset)
 {
-	struct arcnet_local *lp = dev->priv;
+	struct arcnet_local *lp = netdev_priv(dev);
 	short ioaddr = dev->base_addr;
 
 	BUGMSG(D_INIT, "Resetting %s (status=%02Xh)\n", dev->name, ASTATUS());
diff --git a/drivers/net/arcnet/com90xx.c b/drivers/net/arcnet/com90xx.c
index 0d45553..f4113d2 100644
--- a/drivers/net/arcnet/com90xx.c
+++ b/drivers/net/arcnet/com90xx.c
@@ -468,7 +468,7 @@ static int __init com90xx_found(int ioad
 		release_mem_region(shmem, MIRROR_SIZE);
 		return -ENOMEM;
 	}
-	lp = dev->priv;
+	lp = netdev_priv(dev);
 	/* find the real shared memory start/end points, including mirrors */
 
 	/* guess the actual size of one "memory mirror" - the number of
@@ -585,7 +585,7 @@ static void com90xx_setmask(struct net_d
  */
 int com90xx_reset(struct net_device *dev, int really_reset)
 {
-	struct arcnet_local *lp = dev->priv;
+	struct arcnet_local *lp = netdev_priv(dev);
 	short ioaddr = dev->base_addr;
 
 	BUGMSG(D_INIT, "Resetting (status=%02Xh)\n", ASTATUS());
@@ -621,7 +621,7 @@ int com90xx_reset(struct net_device *dev
 static void com90xx_copy_to_card(struct net_device *dev, int bufnum, int offset,
 				 void *buf, int count)
 {
-	struct arcnet_local *lp = dev->priv;
+	struct arcnet_local *lp = netdev_priv(dev);
 	void __iomem *memaddr = lp->mem_start + bufnum * 512 + offset;
 	TIME("memcpy_toio", count, memcpy_toio(memaddr, buf, count));
 }
@@ -630,7 +630,7 @@ static void com90xx_copy_to_card(struct 
 static void com90xx_copy_from_card(struct net_device *dev, int bufnum, int offset,
 				   void *buf, int count)
 {
-	struct arcnet_local *lp = dev->priv;
+	struct arcnet_local *lp = netdev_priv(dev);
 	void __iomem *memaddr = lp->mem_start + bufnum * 512 + offset;
 	TIME("memcpy_fromio", count, memcpy_fromio(buf, memaddr, count));
 }
@@ -656,7 +656,7 @@ static void __exit com90xx_exit(void)
 
 	for (count = 0; count < numcards; count++) {
 		dev = cards[count];
-		lp = dev->priv;
+		lp = netdev_priv(dev);
 
 		unregister_netdev(dev);
 		free_irq(dev->irq, dev);
diff --git a/drivers/net/arcnet/rfc1051.c b/drivers/net/arcnet/rfc1051.c
index 2de8877..ba58089 100644
--- a/drivers/net/arcnet/rfc1051.c
+++ b/drivers/net/arcnet/rfc1051.c
@@ -88,7 +88,7 @@ MODULE_LICENSE("GPL");
  */
 static unsigned short type_trans(struct sk_buff *skb, struct net_device *dev)
 {
-	struct arcnet_local *lp = dev->priv;
+	struct arcnet_local *lp = netdev_priv(dev);
 	struct archdr *pkt = (struct archdr *) skb->data;
 	struct arc_rfc1051 *soft = &pkt->soft.rfc1051;
 	int hdr_size = ARC_HDR_SIZE + RFC1051_HDR_SIZE;
@@ -125,7 +125,7 @@ static unsigned short type_trans(struct 
 static void rx(struct net_device *dev, int bufnum,
 	       struct archdr *pkthdr, int length)
 {
-	struct arcnet_local *lp = dev->priv;
+	struct arcnet_local *lp = netdev_priv(dev);
 	struct sk_buff *skb;
 	struct archdr *pkt = pkthdr;
 	int ofs;
@@ -169,7 +169,7 @@ static void rx(struct net_device *dev, i
 static int build_header(struct sk_buff *skb, struct net_device *dev,
 			unsigned short type, uint8_t daddr)
 {
-	struct arcnet_local *lp = dev->priv;
+	struct arcnet_local *lp = netdev_priv(dev);
 	int hdr_size = ARC_HDR_SIZE + RFC1051_HDR_SIZE;
 	struct archdr *pkt = (struct archdr *) skb_push(skb, hdr_size);
 	struct arc_rfc1051 *soft = &pkt->soft.rfc1051;
@@ -220,7 +220,7 @@ static int build_header(struct sk_buff *
 static int prepare_tx(struct net_device *dev, struct archdr *pkt, int length,
 		      int bufnum)
 {
-	struct arcnet_local *lp = dev->priv;
+	struct arcnet_local *lp = netdev_priv(dev);
 	struct arc_hardware *hard = &pkt->hard;
 	int ofs;
 
diff --git a/drivers/net/arcnet/rfc1201.c b/drivers/net/arcnet/rfc1201.c
index 460a095..75998f4 100644
--- a/drivers/net/arcnet/rfc1201.c
+++ b/drivers/net/arcnet/rfc1201.c
@@ -92,7 +92,7 @@ static unsigned short type_trans(struct 
 {
 	struct archdr *pkt = (struct archdr *) skb->data;
 	struct arc_rfc1201 *soft = &pkt->soft.rfc1201;
-	struct arcnet_local *lp = dev->priv;
+	struct arcnet_local *lp = netdev_priv(dev);
 	int hdr_size = ARC_HDR_SIZE + RFC1201_HDR_SIZE;
 
 	/* Pull off the arcnet header. */
@@ -134,7 +134,7 @@ static unsigned short type_trans(struct 
 static void rx(struct net_device *dev, int bufnum,
 	       struct archdr *pkthdr, int length)
 {
-	struct arcnet_local *lp = dev->priv;
+	struct arcnet_local *lp = netdev_priv(dev);
 	struct sk_buff *skb;
 	struct archdr *pkt = pkthdr;
 	struct arc_rfc1201 *soft = &pkthdr->soft.rfc1201;
@@ -376,7 +376,7 @@ static void rx(struct net_device *dev, i
 static int build_header(struct sk_buff *skb, struct net_device *dev,
 			unsigned short type, uint8_t daddr)
 {
-	struct arcnet_local *lp = dev->priv;
+	struct arcnet_local *lp = netdev_priv(dev);
 	int hdr_size = ARC_HDR_SIZE + RFC1201_HDR_SIZE;
 	struct archdr *pkt = (struct archdr *) skb_push(skb, hdr_size);
 	struct arc_rfc1201 *soft = &pkt->soft.rfc1201;
@@ -443,7 +443,7 @@ static int build_header(struct sk_buff *
 static void load_pkt(struct net_device *dev, struct arc_hardware *hard,
 		     struct arc_rfc1201 *soft, int softlen, int bufnum)
 {
-	struct arcnet_local *lp = dev->priv;
+	struct arcnet_local *lp = netdev_priv(dev);
 	int ofs;
 
 	/* assume length <= XMTU: someone should have handled that by now. */
@@ -476,7 +476,7 @@ static void load_pkt(struct net_device *
 static int prepare_tx(struct net_device *dev, struct archdr *pkt, int length,
 		      int bufnum)
 {
-	struct arcnet_local *lp = dev->priv;
+	struct arcnet_local *lp = netdev_priv(dev);
 	const int maxsegsize = XMTU - RFC1201_HDR_SIZE;
 	struct Outgoing *out;
 
@@ -511,7 +511,7 @@ static int prepare_tx(struct net_device 
 
 static int continue_tx(struct net_device *dev, int bufnum)
 {
-	struct arcnet_local *lp = dev->priv;
+	struct arcnet_local *lp = netdev_priv(dev);
 	struct Outgoing *out = &lp->outgoing;
 	struct arc_hardware *hard = &out->pkt->hard;
 	struct arc_rfc1201 *soft = &out->pkt->soft.rfc1201, *newsoft;


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* Re: netdev_priv()
  2007-07-18 22:24 netdev_priv() Thomas Surrel
                   ` (2 preceding siblings ...)
  2007-07-19  8:18 ` netdev_priv() Yoann Padioleau
@ 2007-07-19  8:57 ` Thomas Surrel
  2007-07-19  9:01 ` netdev_priv() Thomas Surrel
                   ` (13 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: Thomas Surrel @ 2007-07-19  8:57 UTC (permalink / raw)
  To: kernel-janitors

On 7/19/07, Yoann Padioleau <padator@wanadoo.fr> wrote:
> "Thomas Surrel" <thomas.surrel@gmail.com> writes:
>
> > Hi,
> >
> > I'm starting to work on the change to netdev_priv() call to access the
> > priv field of the net_device structure. Is anybody already working on
> > this ?
>
> Yes, I am working a little on it. I already have written
> a semantic patch that does the transformation:
>
> @@
> struct net_device *dev;
> type T;
> @@
>
> - (T) dev->priv
> + netdev_priv(dev)
>
>
> The end of this mail contains an excerpt of the patch generated
> by my automatic program transformation tool given the semantic patch
> for drivers/net/arcnet/
>
> >
> > Also, what is the best way to organize my patches: one per subsystem
> > (wireless, token ring, ...) or even more detailed which would imply a
> > lot more patches ?
>
> From what I understand Morton prefers patch per subsystem.
> Maybe I can submit the patch generated automatically by my tool
> and later you can try to find the remaining case that my tool
> does not handle ?
>

Sounds good. But from what I saw, you have to be really careful with
what your semantic patch would do. Correct me if I am wrong, but the
point of using netdev_priv is to access a private structure that is
right next to the net_device structure in memory. Unfortunately, some
drivers are allocating their private structure in other memory area,
e.g. net/wireless/libertas/main.c:

int libertas_add_mesh(wlan_private *priv, struct device *dev)
{
	struct net_device *mesh_dev = NULL;
	int ret = 0;

	lbs_deb_enter(LBS_DEB_MESH);

	/* Allocate a virtual mesh device */
	if (!(mesh_dev = alloc_netdev(0, "msh%d", ether_setup))) {
		lbs_deb_mesh("init mshX device failed\n");
		ret = -ENOMEM;
		goto done;
	}
	mesh_dev->priv = priv;
	priv->mesh_dev = mesh_dev;
	[...]

In that case, using netdev_priv() would break things. I guess we
should not try to change anything to these drivers.

Regards,

Thomas

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: netdev_priv()
  2007-07-18 22:24 netdev_priv() Thomas Surrel
                   ` (3 preceding siblings ...)
  2007-07-19  8:57 ` netdev_priv() Thomas Surrel
@ 2007-07-19  9:01 ` Thomas Surrel
  2007-07-19  9:14 ` netdev_priv() pradeep singh
                   ` (12 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: Thomas Surrel @ 2007-07-19  9:01 UTC (permalink / raw)
  To: kernel-janitors

On 7/19/07, pradeep singh <pradeep.rautela@gmail.com> wrote:
> On 7/19/07, Thomas Surrel <thomas.surrel@gmail.com> wrote:
> > Hi,
> >
> > I'm starting to work on the change to netdev_priv() call to access the
> > priv field of the net_device structure. Is anybody already working on
> > this ?
>
> I am a little slow. Can you please help me in understanding why is a
> change required in netdev_priv()?
> Is something wrong in it?

No, nothing is wrong with it. But lots of drivers don't use it to
access the 'priv' field of the net_device structure (they do dev->priv
instead). So the change required is in the net drivers, not in the
netdev_priv() call. Sorry if I was unclear.

Regards,

Thomas

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: netdev_priv()
  2007-07-18 22:24 netdev_priv() Thomas Surrel
                   ` (4 preceding siblings ...)
  2007-07-19  9:01 ` netdev_priv() Thomas Surrel
@ 2007-07-19  9:14 ` pradeep singh
  2007-07-19 11:49 ` netdev_priv() Yoann Padioleau
                   ` (11 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: pradeep singh @ 2007-07-19  9:14 UTC (permalink / raw)
  To: kernel-janitors

On 7/19/07, Thomas Surrel <thomas.surrel@gmail.com> wrote:
> On 7/19/07, pradeep singh <pradeep.rautela@gmail.com> wrote:
> > On 7/19/07, Thomas Surrel <thomas.surrel@gmail.com> wrote:
> > > Hi,
> > >
> > > I'm starting to work on the change to netdev_priv() call to access the
> > > priv field of the net_device structure. Is anybody already working on
> > > this ?
> >
> > I am a little slow. Can you please help me in understanding why is a
> > change required in netdev_priv()?
> > Is something wrong in it?
>
> No, nothing is wrong with it. But lots of drivers don't use it to
> access the 'priv' field of the net_device structure (they do dev->priv
> instead). So the change required is in the net drivers, not in the
> netdev_priv() call. Sorry if I was unclear.
Oh i see.
Great then, good luck with your work.

Thanks for the explanation though.

Cheers,

--pradeep
>
> Regards,
>
> Thomas
>


-- 
Pradeep

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: netdev_priv()
  2007-07-18 22:24 netdev_priv() Thomas Surrel
                   ` (5 preceding siblings ...)
  2007-07-19  9:14 ` netdev_priv() pradeep singh
@ 2007-07-19 11:49 ` Yoann Padioleau
  2007-07-19 13:27 ` netdev_priv() Thomas Surrel
                   ` (10 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: Yoann Padioleau @ 2007-07-19 11:49 UTC (permalink / raw)
  To: kernel-janitors

"Thomas Surrel" <thomas.surrel@gmail.com> writes:

>> @@
>> struct net_device *dev;
>> type T;
>> @@
>>
>> - (T) dev->priv
>> + netdev_priv(dev)
>>
>>
>
> Sounds good. But from what I saw, you have to be really careful with
> what your semantic patch would do. Correct me if I am wrong, but the
> point of using netdev_priv is to access a private structure that is
> right next to the net_device structure in memory. 

Yes, you are right according to
http://groups.google.com/group/comp.os.linux.development.system/browse_thread/thread/de19321bcd94dbb8/0d74a4adcd6177bd

Thanks for pointing out a problem. I have refined my semantic patch:

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

 dev = alloc_netdev(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)


@ rule3 depends on rule1 && !rule1bis @
struct net_device *dev;
@@

- dev->priv
+ netdev_priv(dev)



I have put the generated patch in the end of this mail for all drivers
under drivers/net/. Because of the new condition on alloc_netdev, the patch
does not touch anymore net/wireless/libertas/main.c.

> Unfortunately, some
> drivers are allocating their private structure in other memory area,
> e.g. net/wireless/libertas/main.c:
>
> int libertas_add_mesh(wlan_private *priv, struct device *dev)
> {
> 	struct net_device *mesh_dev = NULL;
> 	int ret = 0;
>
> 	lbs_deb_enter(LBS_DEB_MESH);
>
> 	/* Allocate a virtual mesh device */
> 	if (!(mesh_dev = alloc_netdev(0, "msh%d", ether_setup))) {
> 		lbs_deb_mesh("init mshX device failed\n");
> 		ret = -ENOMEM;
> 		goto done;
> 	}
> 	mesh_dev->priv = priv;
> 	priv->mesh_dev = mesh_dev;
> 	[...]
>
> In that case, using netdev_priv() would break things. I guess we
> should not try to change anything to these drivers.

That's what my new semantic patch does. But maybe I am now too
restrictive. Do you know other conditions where we can safely
do the transformation ? 

>
> Regards,
>
> Thomas



 arcnet/arcnet.c     |   32 +++++++++++++-------------
 bonding/bond_main.c |   62 ++++++++++++++++++++++++++--------------------------
 shaper.c            |   16 ++++++-------
 wan/dlci.c          |   30 ++++++++++++-------------
 wan/lmc/lmc_main.c  |   26 ++++++++++-----------
 wan/sdla.c          |   46 +++++++++++++++++++-------------------
 wan/sealevel.c      |   12 +++++-----
 wan/x25_asy.c       |   28 +++++++++++------------
 wireless/strip.c    |    2 -
 9 files changed, 127 insertions(+), 127 deletions(-)




diff --git a/drivers/net/arcnet/arcnet.c b/drivers/net/arcnet/arcnet.c
index 681e20b..230b545 100644
--- a/drivers/net/arcnet/arcnet.c
+++ b/drivers/net/arcnet/arcnet.c
@@ -181,7 +181,7 @@ #if (ARCNET_DEBUG_MAX & (D_RX | D_TX))
 static void arcnet_dump_packet(struct net_device *dev, int bufnum,
 			       char *desc, int take_arcnet_lock)
 {
-	struct arcnet_local *lp = dev->priv;
+	struct arcnet_local *lp = netdev_priv(dev);
 	int i, length;
 	unsigned long flags = 0;
 	static uint8_t buf[512];
@@ -247,7 +247,7 @@ void arcnet_unregister_proto(struct ArcP
  */
 static void release_arcbuf(struct net_device *dev, int bufnum)
 {
-	struct arcnet_local *lp = dev->priv;
+	struct arcnet_local *lp = netdev_priv(dev);
 	int i;
 
 	lp->buf_queue[lp->first_free_buf++] = bufnum;
@@ -269,7 +269,7 @@ static void release_arcbuf(struct net_de
  */
 static int get_arcbuf(struct net_device *dev)
 {
-	struct arcnet_local *lp = dev->priv;
+	struct arcnet_local *lp = netdev_priv(dev);
 	int buf = -1, i;
 
 	if (!atomic_dec_and_test(&lp->buf_lock)) {
@@ -353,7 +353,7 @@ struct net_device *alloc_arcdev(char *na
 	dev = alloc_netdev(sizeof(struct arcnet_local),
 			   name && *name ? name : "arc%d", arcdev_setup);
 	if(dev) {
-		struct arcnet_local *lp = (struct arcnet_local *) dev->priv;
+		struct arcnet_local *lp = netdev_priv(dev);
 		spin_lock_init(&lp->lock);
 	}
 
@@ -370,7 +370,7 @@ struct net_device *alloc_arcdev(char *na
  */
 static int arcnet_open(struct net_device *dev)
 {
-	struct arcnet_local *lp = dev->priv;
+	struct arcnet_local *lp = netdev_priv(dev);
 	int count, newmtu, error;
 
 	BUGMSG(D_INIT,"opened.");
@@ -470,7 +470,7 @@ static int arcnet_open(struct net_device
 /* The inverse routine to arcnet_open - shuts down the card. */
 static int arcnet_close(struct net_device *dev)
 {
-	struct arcnet_local *lp = dev->priv;
+	struct arcnet_local *lp = netdev_priv(dev);
 
 	netif_stop_queue(dev);
 
@@ -491,7 +491,7 @@ static int arcnet_header(struct sk_buff 
 			 unsigned short type, void *daddr, void *saddr,
 			 unsigned len)
 {
-	struct arcnet_local *lp = dev->priv;
+	struct arcnet_local *lp = netdev_priv(dev);
 	uint8_t _daddr, proto_num;
 	struct ArcProto *proto;
 
@@ -552,7 +552,7 @@ static int arcnet_header(struct sk_buff 
 static int arcnet_rebuild_header(struct sk_buff *skb)
 {
 	struct net_device *dev = skb->dev;
-	struct arcnet_local *lp = dev->priv;
+	struct arcnet_local *lp = netdev_priv(dev);
 	int status = 0;		/* default is failure */
 	unsigned short type;
 	uint8_t daddr=0;
@@ -599,7 +599,7 @@ #endif
 /* Called by the kernel in order to transmit a packet. */
 static int arcnet_send_packet(struct sk_buff *skb, struct net_device *dev)
 {
-	struct arcnet_local *lp = dev->priv;
+	struct arcnet_local *lp = netdev_priv(dev);
 	struct archdr *pkt;
 	struct arc_rfc1201 *soft;
 	struct ArcProto *proto;
@@ -689,7 +689,7 @@ static int arcnet_send_packet(struct sk_
  */
 static int go_tx(struct net_device *dev)
 {
-	struct arcnet_local *lp = dev->priv;
+	struct arcnet_local *lp = netdev_priv(dev);
 
 	BUGMSG(D_DURING, "go_tx: status=%Xh, intmask=%Xh, next_tx=%d, cur_tx=%d\n",
 	       ASTATUS(), lp->intmask, lp->next_tx, lp->cur_tx);
@@ -719,7 +719,7 @@ static int go_tx(struct net_device *dev)
 static void arcnet_timeout(struct net_device *dev)
 {
 	unsigned long flags;
-	struct arcnet_local *lp = dev->priv;
+	struct arcnet_local *lp = netdev_priv(dev);
 	int status = ASTATUS();
 	char *msg;
 
@@ -768,7 +768,7 @@ irqreturn_t arcnet_interrupt(int irq, vo
 
 	BUGMSG(D_DURING, "in arcnet_interrupt\n");
 	
-	lp = dev->priv;
+	lp = netdev_priv(dev);
 	BUG_ON(!lp);
 		
 	spin_lock(&lp->lock);
@@ -1005,7 +1005,7 @@ irqreturn_t arcnet_interrupt(int irq, vo
  */
 static void arcnet_rx(struct net_device *dev, int bufnum)
 {
-	struct arcnet_local *lp = dev->priv;
+	struct arcnet_local *lp = netdev_priv(dev);
 	struct archdr pkt;
 	struct arc_rfc1201 *soft;
 	int length, ofs;
@@ -1069,7 +1069,7 @@ static void arcnet_rx(struct net_device 
  */
 static struct net_device_stats *arcnet_get_stats(struct net_device *dev)
 {
-	struct arcnet_local *lp = dev->priv;
+	struct arcnet_local *lp = netdev_priv(dev);
 	return &lp->stats;
 }
 
@@ -1086,7 +1086,7 @@ static void null_rx(struct net_device *d
 static int null_build_header(struct sk_buff *skb, struct net_device *dev,
 			     unsigned short type, uint8_t daddr)
 {
-	struct arcnet_local *lp = dev->priv;
+	struct arcnet_local *lp = netdev_priv(dev);
 
 	BUGMSG(D_PROTO,
 	       "tx: can't build header for encap %02Xh; load a protocol driver.\n",
@@ -1101,7 +1101,7 @@ static int null_build_header(struct sk_b
 static int null_prepare_tx(struct net_device *dev, struct archdr *pkt,
 			   int length, int bufnum)
 {
-	struct arcnet_local *lp = dev->priv;
+	struct arcnet_local *lp = netdev_priv(dev);
 	struct arc_hardware newpkt;
 
 	BUGMSG(D_PROTO, "tx: no encap for this host; load a protocol driver.\n");
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index cb9cb30..ed75253 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -425,7 +425,7 @@ int bond_dev_queue_xmit(struct bonding *
  */
 static void bond_vlan_rx_register(struct net_device *bond_dev, struct vlan_group *grp)
 {
-	struct bonding *bond = bond_dev->priv;
+	struct bonding *bond = netdev_priv(bond_dev);
 	struct slave *slave;
 	int i;
 
@@ -448,7 +448,7 @@ static void bond_vlan_rx_register(struct
  */
 static void bond_vlan_rx_add_vid(struct net_device *bond_dev, uint16_t vid)
 {
-	struct bonding *bond = bond_dev->priv;
+	struct bonding *bond = netdev_priv(bond_dev);
 	struct slave *slave;
 	int i, res;
 
@@ -476,7 +476,7 @@ static void bond_vlan_rx_add_vid(struct 
  */
 static void bond_vlan_rx_kill_vid(struct net_device *bond_dev, uint16_t vid)
 {
-	struct bonding *bond = bond_dev->priv;
+	struct bonding *bond = netdev_priv(bond_dev);
 	struct slave *slave;
 	struct net_device *vlan_dev;
 	int i, res;
@@ -932,7 +932,7 @@ static int bond_mc_list_copy(struct dev_
  */
 static void bond_mc_list_flush(struct net_device *bond_dev, struct net_device *slave_dev)
 {
-	struct bonding *bond = bond_dev->priv;
+	struct bonding *bond = netdev_priv(bond_dev);
 	struct dev_mc_list *dmi;
 
 	for (dmi = bond_dev->mc_list; dmi; dmi = dmi->next) {
@@ -1280,7 +1280,7 @@ static int bond_compute_features(struct 
 /* enslave device <slave> to bond device <master> */
 int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
 {
-	struct bonding *bond = bond_dev->priv;
+	struct bonding *bond = netdev_priv(bond_dev);
 	struct slave *new_slave = NULL;
 	struct dev_mc_list *dmi;
 	struct sockaddr addr;
@@ -1639,7 +1639,7 @@ err_undo_flags:
  */
 int bond_release(struct net_device *bond_dev, struct net_device *slave_dev)
 {
-	struct bonding *bond = bond_dev->priv;
+	struct bonding *bond = netdev_priv(bond_dev);
 	struct slave *slave, *oldcurrent;
 	struct sockaddr addr;
 	int mac_addr_differ;
@@ -1812,7 +1812,7 @@ int bond_release(struct net_device *bond
  */
 static int bond_release_all(struct net_device *bond_dev)
 {
-	struct bonding *bond = bond_dev->priv;
+	struct bonding *bond = netdev_priv(bond_dev);
 	struct slave *slave;
 	struct net_device *slave_dev;
 	struct sockaddr addr;
@@ -1939,7 +1939,7 @@ out:
  */
 static int bond_ioctl_change_active(struct net_device *bond_dev, struct net_device *slave_dev)
 {
-	struct bonding *bond = bond_dev->priv;
+	struct bonding *bond = netdev_priv(bond_dev);
 	struct slave *old_active = NULL;
 	struct slave *new_active = NULL;
 	int res = 0;
@@ -1983,7 +1983,7 @@ static int bond_ioctl_change_active(stru
 
 static int bond_info_query(struct net_device *bond_dev, struct ifbond *info)
 {
-	struct bonding *bond = bond_dev->priv;
+	struct bonding *bond = netdev_priv(bond_dev);
 
 	info->bond_mode = bond->params.mode;
 	info->miimon = bond->params.miimon;
@@ -1997,7 +1997,7 @@ static int bond_info_query(struct net_de
 
 static int bond_slave_info_query(struct net_device *bond_dev, struct ifslave *info)
 {
-	struct bonding *bond = bond_dev->priv;
+	struct bonding *bond = netdev_priv(bond_dev);
 	struct slave *slave;
 	int i, found = 0;
 
@@ -2033,7 +2033,7 @@ static int bond_slave_info_query(struct 
 /* this function is called regularly to monitor each slave's link. */
 void bond_mii_monitor(struct net_device *bond_dev)
 {
-	struct bonding *bond = bond_dev->priv;
+	struct bonding *bond = netdev_priv(bond_dev);
 	struct slave *slave, *oldcurrent;
 	int do_failover = 0;
 	int delta_in_ticks;
@@ -2500,7 +2500,7 @@ static int bond_arp_rcv(struct sk_buff *
 	if (!(dev->priv_flags & IFF_BONDING) || !(dev->flags & IFF_MASTER))
 		goto out;
 
-	bond = dev->priv;
+	bond = netdev_priv(dev);
 	read_lock(&bond->lock);
 
 	dprintk("bond_arp_rcv: bond %s skb->dev %s orig_dev %s\n",
@@ -2566,7 +2566,7 @@ out:
  */
 void bond_loadbalance_arp_mon(struct net_device *bond_dev)
 {
-	struct bonding *bond = bond_dev->priv;
+	struct bonding *bond = netdev_priv(bond_dev);
 	struct slave *slave, *oldcurrent;
 	int do_failover = 0;
 	int delta_in_ticks;
@@ -2697,7 +2697,7 @@ out:
  */
 void bond_activebackup_arp_mon(struct net_device *bond_dev)
 {
-	struct bonding *bond = bond_dev->priv;
+	struct bonding *bond = netdev_priv(bond_dev);
 	struct slave *slave;
 	int delta_in_ticks;
 	int i;
@@ -3254,7 +3254,7 @@ #endif
 
 static int bond_master_netdev_event(unsigned long event, struct net_device *bond_dev)
 {
-	struct bonding *event_bond = bond_dev->priv;
+	struct bonding *event_bond = netdev_priv(bond_dev);
 
 	switch (event) {
 	case NETDEV_CHANGENAME:
@@ -3274,7 +3274,7 @@ static int bond_master_netdev_event(unsi
 static int bond_slave_netdev_event(unsigned long event, struct net_device *slave_dev)
 {
 	struct net_device *bond_dev = slave_dev->master;
-	struct bonding *bond = bond_dev->priv;
+	struct bonding *bond = netdev_priv(bond_dev);
 
 	switch (event) {
 	case NETDEV_UNREGISTER:
@@ -3502,7 +3502,7 @@ static int bond_xmit_hash_policy_l2(stru
 
 static int bond_open(struct net_device *bond_dev)
 {
-	struct bonding *bond = bond_dev->priv;
+	struct bonding *bond = netdev_priv(bond_dev);
 	struct timer_list *mii_timer = &bond->mii_timer;
 	struct timer_list *arp_timer = &bond->arp_timer;
 
@@ -3567,7 +3567,7 @@ static int bond_open(struct net_device *
 
 static int bond_close(struct net_device *bond_dev)
 {
-	struct bonding *bond = bond_dev->priv;
+	struct bonding *bond = netdev_priv(bond_dev);
 
 	if (bond->params.mode = BOND_MODE_8023AD) {
 		/* Unregister the receive of LACPDUs */
@@ -3623,7 +3623,7 @@ static int bond_close(struct net_device 
 
 static struct net_device_stats *bond_get_stats(struct net_device *bond_dev)
 {
-	struct bonding *bond = bond_dev->priv;
+	struct bonding *bond = netdev_priv(bond_dev);
 	struct net_device_stats *stats = &(bond->stats), *sstats;
 	struct slave *slave;
 	int i;
@@ -3698,7 +3698,7 @@ static int bond_do_ioctl(struct net_devi
 		}
 
 		if (mii->reg_num = 1) {
-			struct bonding *bond = bond_dev->priv;
+			struct bonding *bond = netdev_priv(bond_dev);
 			mii->val_out = 0;
 			read_lock_bh(&bond->lock);
 			read_lock(&bond->curr_slave_lock);
@@ -3790,7 +3790,7 @@ static int bond_do_ioctl(struct net_devi
 
 static void bond_set_multicast_list(struct net_device *bond_dev)
 {
-	struct bonding *bond = bond_dev->priv;
+	struct bonding *bond = netdev_priv(bond_dev);
 	struct dev_mc_list *dmi;
 
 	write_lock_bh(&bond->lock);
@@ -3843,7 +3843,7 @@ static void bond_set_multicast_list(stru
  */
 static int bond_change_mtu(struct net_device *bond_dev, int new_mtu)
 {
-	struct bonding *bond = bond_dev->priv;
+	struct bonding *bond = netdev_priv(bond_dev);
 	struct slave *slave, *stop_at;
 	int res = 0;
 	int i;
@@ -3915,7 +3915,7 @@ unwind:
  */
 static int bond_set_mac_address(struct net_device *bond_dev, void *addr)
 {
-	struct bonding *bond = bond_dev->priv;
+	struct bonding *bond = netdev_priv(bond_dev);
 	struct sockaddr *sa = addr, tmp_sa;
 	struct slave *slave, *stop_at;
 	int res = 0;
@@ -3989,7 +3989,7 @@ unwind:
 
 static int bond_xmit_roundrobin(struct sk_buff *skb, struct net_device *bond_dev)
 {
-	struct bonding *bond = bond_dev->priv;
+	struct bonding *bond = netdev_priv(bond_dev);
 	struct slave *slave, *start_at;
 	int i;
 	int res = 1;
@@ -4039,7 +4039,7 @@ out:
  */
 static int bond_xmit_activebackup(struct sk_buff *skb, struct net_device *bond_dev)
 {
-	struct bonding *bond = bond_dev->priv;
+	struct bonding *bond = netdev_priv(bond_dev);
 	int res = 1;
 
 	read_lock(&bond->lock);
@@ -4071,7 +4071,7 @@ out:
  */
 static int bond_xmit_xor(struct sk_buff *skb, struct net_device *bond_dev)
 {
-	struct bonding *bond = bond_dev->priv;
+	struct bonding *bond = netdev_priv(bond_dev);
 	struct slave *slave, *start_at;
 	int slave_no;
 	int i;
@@ -4117,7 +4117,7 @@ out:
  */
 static int bond_xmit_broadcast(struct sk_buff *skb, struct net_device *bond_dev)
 {
-	struct bonding *bond = bond_dev->priv;
+	struct bonding *bond = netdev_priv(bond_dev);
 	struct slave *slave, *start_at;
 	struct net_device *tx_dev = NULL;
 	int i;
@@ -4248,7 +4248,7 @@ static const struct ethtool_ops bond_eth
  */
 static int bond_init(struct net_device *bond_dev, struct bond_params *params)
 {
-	struct bonding *bond = bond_dev->priv;
+	struct bonding *bond = netdev_priv(bond_dev);
 
 	dprintk("Begin bond_init for %s\n", bond_dev->name);
 
@@ -4323,7 +4323,7 @@ #endif
  */
 void bond_deinit(struct net_device *bond_dev)
 {
-	struct bonding *bond = bond_dev->priv;
+	struct bonding *bond = netdev_priv(bond_dev);
 
 	list_del(&bond->bond_list);
 
@@ -4717,12 +4717,12 @@ int bond_create(char *name, struct bond_
 	lockdep_set_class(&bond_dev->_xmit_lock, &bonding_netdev_xmit_lock_key);
 
 	if (newbond)
-		*newbond = bond_dev->priv;
+		*newbond = netdev_priv(bond_dev);
 
 	netif_carrier_off(bond_dev);
 
 	rtnl_unlock(); /* allows sysfs registration of net device */
-	res = bond_create_sysfs_entry(bond_dev->priv);
+	res = bond_create_sysfs_entry(netdev_priv(bond_dev));
 	if (res < 0) {
 		rtnl_lock();
 		goto out_bond;
diff --git a/drivers/net/shaper.c b/drivers/net/shaper.c
index e886e8d..0b8e9af 100644
--- a/drivers/net/shaper.c
+++ b/drivers/net/shaper.c
@@ -133,7 +133,7 @@ static void shaper_setspeed(struct shape
 
 static int shaper_start_xmit(struct sk_buff *skb, struct net_device *dev)
 {
-	struct shaper *shaper = dev->priv;
+	struct shaper *shaper = netdev_priv(dev);
  	struct sk_buff *ptr;
 
 	spin_lock(&shaper->lock);
@@ -288,7 +288,7 @@ static void shaper_kick(struct shaper *s
 
 static int shaper_open(struct net_device *dev)
 {
-	struct shaper *shaperÞv->priv;
+	struct shaper *shaper=netdev_priv(dev);
 
 	/*
 	 *	Can't open until attached.
@@ -309,7 +309,7 @@ static int shaper_open(struct net_device
 
 static int shaper_close(struct net_device *dev)
 {
-	struct shaper *shaperÞv->priv;
+	struct shaper *shaper=netdev_priv(dev);
 	struct sk_buff *skb;
 
 	while ((skb = skb_dequeue(&shaper->sendq)) != NULL)
@@ -331,14 +331,14 @@ static int shaper_close(struct net_devic
 
 static struct net_device_stats *shaper_get_stats(struct net_device *dev)
 {
-     	struct shaper *shÞv->priv;
+     	struct shaper *sh=netdev_priv(dev);
 	return &sh->stats;
 }
 
 static int shaper_header(struct sk_buff *skb, struct net_device *dev,
 	unsigned short type, void *daddr, void *saddr, unsigned len)
 {
-	struct shaper *shÞv->priv;
+	struct shaper *sh=netdev_priv(dev);
 	int v;
 	if(sh_debug)
 		printk("Shaper header\n");
@@ -476,7 +476,7 @@ #endif
 static int shaper_ioctl(struct net_device *dev,  struct ifreq *ifr, int cmd)
 {
 	struct shaperconf *ss= (struct shaperconf *)&ifr->ifr_ifru;
-	struct shaper *shÞv->priv;
+	struct shaper *sh=netdev_priv(dev);
 
 	if(ss->ss_cmd = SHAPER_SET_DEV || ss->ss_cmd = SHAPER_SET_SPEED)
 	{
@@ -493,7 +493,7 @@ static int shaper_ioctl(struct net_devic
 				return -ENODEV;
 			if(sh->dev)
 				return -EBUSY;
-			return shaper_attach(dev,dev->priv, them);
+			return shaper_attach(dev,netdev_priv(dev), them);
 		}
 		case SHAPER_GET_DEV:
 			if(sh->dev=NULL)
@@ -513,7 +513,7 @@ static int shaper_ioctl(struct net_devic
 
 static void shaper_init_priv(struct net_device *dev)
 {
-	struct shaper *sh = dev->priv;
+	struct shaper *sh = netdev_priv(dev);
 
 	skb_queue_head_init(&sh->sendq);
 	init_timer(&sh->timer);
diff --git a/drivers/net/wan/dlci.c b/drivers/net/wan/dlci.c
index 66be20c..d988161 100644
--- a/drivers/net/wan/dlci.c
+++ b/drivers/net/wan/dlci.c
@@ -74,7 +74,7 @@ static int dlci_header(struct sk_buff *s
 	unsigned int		hlen;
 	char			*dest;
 
-	dlp = dev->priv;
+	dlp = netdev_priv(dev);
 
 	hdr.control = FRAD_I_UI;
 	switch(type)
@@ -110,7 +110,7 @@ static void dlci_receive(struct sk_buff 
 	struct frhdr		*hdr;
 	int					process, header;
 
-	dlp = dev->priv;
+	dlp = netdev_priv(dev);
 	if (!pskb_may_pull(skb, sizeof(*hdr))) {
 		printk(KERN_NOTICE "%s: invalid data no header\n",
 		       dev->name);
@@ -197,7 +197,7 @@ static int dlci_transmit(struct sk_buff 
 	if (!skb || !dev)
 		return(0);
 
-	dlp = dev->priv;
+	dlp = netdev_priv(dev);
 
 	netif_stop_queue(dev);
 	
@@ -235,7 +235,7 @@ static int dlci_config(struct net_device
 	struct frad_local	*flp;
 	int			err;
 
-	dlp = dev->priv;
+	dlp = netdev_priv(dev);
 
 	flp = dlp->slave->priv;
 
@@ -269,7 +269,7 @@ static int dlci_dev_ioctl(struct net_dev
 	if (!capable(CAP_NET_ADMIN))
 		return(-EPERM);
 
-	dlp = dev->priv;
+	dlp = netdev_priv(dev);
 
 	switch(cmd)
 	{
@@ -298,7 +298,7 @@ static int dlci_change_mtu(struct net_de
 {
 	struct dlci_local *dlp;
 
-	dlp = dev->priv;
+	dlp = netdev_priv(dev);
 
 	return((*dlp->slave->change_mtu)(dlp->slave, new_mtu));
 }
@@ -309,7 +309,7 @@ static int dlci_open(struct net_device *
 	struct frad_local	*flp;
 	int			err;
 
-	dlp = dev->priv;
+	dlp = netdev_priv(dev);
 
 	if (!*(short *)(dev->dev_addr))
 		return(-EINVAL);
@@ -335,7 +335,7 @@ static int dlci_close(struct net_device 
 
 	netif_stop_queue(dev);
 
-	dlp = dev->priv;
+	dlp = netdev_priv(dev);
 
 	flp = dlp->slave->priv;
 	err = (*flp->deactivate)(dlp->slave, dev);
@@ -347,7 +347,7 @@ static struct net_device_stats *dlci_get
 {
 	struct dlci_local *dlp;
 
-	dlp = dev->priv;
+	dlp = netdev_priv(dev);
 
 	return(&dlp->stats);
 }
@@ -365,7 +365,7 @@ static int dlci_add(struct dlci_add *dlc
 	if (!slave)
 		return -ENODEV;
 
-	if (slave->type != ARPHRD_FRAD || slave->priv = NULL)
+	if (slave->type != ARPHRD_FRAD || netdev_priv(slave) = NULL)
 		goto err1;
 
 	/* create device name */
@@ -391,11 +391,11 @@ static int dlci_add(struct dlci_add *dlc
 
 	*(short *)(master->dev_addr) = dlci->dlci;
 
-	dlp = (struct dlci_local *) master->priv;
+	dlp = netdev_priv(master);
 	dlp->slave = slave;
 	dlp->master = master;
 
-	flp = slave->priv;
+	flp = netdev_priv(slave);
 	err = (*flp->assoc)(slave, master);
 	if (err < 0)
 		goto err2;
@@ -435,9 +435,9 @@ static int dlci_del(struct dlci_add *dlc
 		return(-EBUSY);
 	}
 
-	dlp = master->priv;
+	dlp = netdev_priv(master);
 	slave = dlp->slave;
-	flp = slave->priv;
+	flp = netdev_priv(slave);
 
 	rtnl_lock();
 	err = (*flp->deassoc)(slave, master);
@@ -487,7 +487,7 @@ static int dlci_ioctl(unsigned int cmd, 
 
 static void dlci_setup(struct net_device *dev)
 {
-	struct dlci_local *dlp = dev->priv;
+	struct dlci_local *dlp = netdev_priv(dev);
 
 	dev->flags		= 0;
 	dev->open		= dlci_open;
diff --git a/drivers/net/wan/lmc/lmc_main.c b/drivers/net/wan/lmc/lmc_main.c
index 750b3ef..8c95f3d 100644
--- a/drivers/net/wan/lmc/lmc_main.c
+++ b/drivers/net/wan/lmc/lmc_main.c
@@ -126,7 +126,7 @@ int lmc_ioctl (struct net_device *dev, s
 
     ret = -EOPNOTSUPP;
 
-    sc = dev->priv;
+    sc = netdev_priv(dev);
 
     lmc_trace(dev, "lmc_ioctl in");
 
@@ -634,7 +634,7 @@ static void lmc_watchdog (unsigned long 
     u_int32_t ticks;
     unsigned long flags;
 
-    sc = dev->priv;
+    sc = netdev_priv(dev);
 
     lmc_trace(dev, "lmc_watchdog in");
 
@@ -872,7 +872,7 @@ #endif
         lmc_first_load = 1;
     }
     
-    sc = dev->priv;
+    sc = netdev_priv(dev);
     sc->lmc_device = dev;
     sc->name = dev->name;
 
@@ -1018,7 +1018,7 @@ static void __devexit lmc_remove_one (st
     struct net_device *dev = pci_get_drvdata(pdev);
     
     if (dev) {
-	    lmc_softc_t *sc = dev->priv;
+	    lmc_softc_t *sc = netdev_priv(dev);
 	    
 	    printk("%s: removing...\n", dev->name);
 	    lmc_proto_detach(sc);
@@ -1035,7 +1035,7 @@ static void __devexit lmc_remove_one (st
  */
 static int lmc_open (struct net_device *dev) /*fold00*/
 {
-    lmc_softc_t *sc = dev->priv;
+    lmc_softc_t *sc = netdev_priv(dev);
 
     lmc_trace(dev, "lmc_open in");
 
@@ -1153,7 +1153,7 @@ static int lmc_open (struct net_device *
 static void lmc_running_reset (struct net_device *dev) /*fold00*/
 {
 
-    lmc_softc_t *sc = (lmc_softc_t *) dev->priv;
+    lmc_softc_t *sc = netdev_priv(dev);
 
     lmc_trace(dev, "lmc_runnig_reset in");
 
@@ -1194,7 +1194,7 @@ static int lmc_close (struct net_device 
 
     lmc_trace(dev, "lmc_close in");
     
-    sc = dev->priv;
+    sc = netdev_priv(dev);
     sc->lmc_ok = 0;
     sc->lmc_media->set_link_status (sc, 0);
     del_timer (&sc->timer);
@@ -1210,7 +1210,7 @@ static int lmc_close (struct net_device 
 /* When the interface goes down, this is called */
 static int lmc_ifdown (struct net_device *dev) /*fold00*/
 {
-    lmc_softc_t *sc = dev->priv;
+    lmc_softc_t *sc = netdev_priv(dev);
     u32 csr6;
     int i;
 
@@ -1287,7 +1287,7 @@ static irqreturn_t lmc_interrupt (int ir
 
     lmc_trace(dev, "lmc_interrupt in");
 
-    sc = dev->priv;
+    sc = netdev_priv(dev);
     
     spin_lock(&sc->lmc_lock);
 
@@ -1473,7 +1473,7 @@ static int lmc_start_xmit (struct sk_buf
 
     lmc_trace(dev, "lmc_start_xmit in");
 
-    sc = dev->priv;
+    sc = netdev_priv(dev);
 
     spin_lock_irqsave(&sc->lmc_lock, flags);
 
@@ -1570,7 +1570,7 @@ static int lmc_rx (struct net_device *de
 
     lmc_trace(dev, "lmc_rx in");
 
-    sc = dev->priv;
+    sc = netdev_priv(dev);
 
     lmc_led_on(sc, LMC_DS3_LED3);
 
@@ -1764,7 +1764,7 @@ skip_out_of_mem:
 
 static struct net_device_stats *lmc_get_stats (struct net_device *dev) /*fold00*/
 {
-    lmc_softc_t *sc = dev->priv;
+    lmc_softc_t *sc = netdev_priv(dev);
     unsigned long flags;
 
     lmc_trace(dev, "lmc_get_stats in");
@@ -2145,7 +2145,7 @@ static void lmc_driver_timeout(struct ne
 
     lmc_trace(dev, "lmc_driver_timeout in");
 
-    sc = dev->priv;
+    sc = netdev_priv(dev);
 
     spin_lock_irqsave(&sc->lmc_lock, flags);
 
diff --git a/drivers/net/wan/sdla.c b/drivers/net/wan/sdla.c
index 6a485f0..4cb43f4 100644
--- a/drivers/net/wan/sdla.c
+++ b/drivers/net/wan/sdla.c
@@ -185,7 +185,7 @@ static void sdla_stop(struct net_device 
 {
 	struct frad_local *flp;
 
-	flp = dev->priv;
+	flp = netdev_priv(dev);
 	switch(flp->type)
 	{
 		case SDLA_S502A:
@@ -212,7 +212,7 @@ static void sdla_start(struct net_device
 {
 	struct frad_local *flp;
 
-	flp = dev->priv;
+	flp = netdev_priv(dev);
 	switch(flp->type)
 	{
 		case SDLA_S502A:
@@ -432,7 +432,7 @@ static int sdla_cmd(struct net_device *d
 	int                      ret, waiting, len;
 	long                     window;
 
-	flp = dev->priv;
+	flp = netdev_priv(dev);
 	window = flp->type = SDLA_S508 ? SDLA_508_CMD_BUF : SDLA_502_CMD_BUF;
 	cmd_buf = (struct sdla_cmd *)(dev->mem_start + (window & SDLA_ADDR_MASK));
 	ret = 0;
@@ -509,7 +509,7 @@ static int sdla_activate(struct net_devi
 	struct frad_local *flp;
 	int i;
 
-	flp = slave->priv;
+	flp = netdev_priv(slave);
 
 	for(i=0;i<CONFIG_DLCI_MAX;i++)
 		if (flp->master[i] = master)
@@ -531,7 +531,7 @@ static int sdla_deactivate(struct net_de
 	struct frad_local *flp;
 	int               i;
 
-	flp = slave->priv;
+	flp = netdev_priv(slave);
 
 	for(i=0;i<CONFIG_DLCI_MAX;i++)
 		if (flp->master[i] = master)
@@ -556,7 +556,7 @@ static int sdla_assoc(struct net_device 
 	if (master->type != ARPHRD_DLCI)
 		return(-EINVAL);
 
-	flp = slave->priv;
+	flp = netdev_priv(slave);
 
 	for(i=0;i<CONFIG_DLCI_MAX;i++)
 	{
@@ -589,7 +589,7 @@ static int sdla_deassoc(struct net_devic
 	struct frad_local *flp;
 	int               i;
 
-	flp = slave->priv;
+	flp = netdev_priv(slave);
 
 	for(i=0;i<CONFIG_DLCI_MAX;i++)
 		if (flp->master[i] = master)
@@ -619,7 +619,7 @@ static int sdla_dlci_conf(struct net_dev
 	int               i;
 	short             len, ret;
 
-	flp = slave->priv;
+	flp = netdev_priv(slave);
 
 	for(i=0;i<CONFIG_DLCI_MAX;i++)
 		if (flp->master[i] = master)
@@ -628,7 +628,7 @@ static int sdla_dlci_conf(struct net_dev
 	if (i = CONFIG_DLCI_MAX)
 		return(-ENODEV);
 
-	dlp = master->priv;
+	dlp = netdev_priv(master);
 
 	ret = SDLA_RET_OK;
 	len = sizeof(struct dlci_conf);
@@ -659,7 +659,7 @@ static int sdla_transmit(struct sk_buff 
 	unsigned long     flags;
 	struct buf_entry  *pbuf;
 
-	flp = dev->priv;
+	flp = netdev_priv(dev);
 	ret = 0;
 	accept = 1;
 
@@ -755,7 +755,7 @@ static void sdla_receive(struct net_devi
 	int               i=0, received, success, addr, buf_base, buf_top;
 	short             dlci, len, len2, split;
 
-	flp = dev->priv;
+	flp = netdev_priv(dev);
 	success = 1;
 	received = addr = buf_top = buf_base = 0;
 	len = dlci = 0;
@@ -860,7 +860,7 @@ static void sdla_receive(struct net_devi
 	if (success)
 	{
 		flp->stats.rx_packets++;
-		dlp = master->priv;
+		dlp = netdev_priv(master);
 		(*dlp->receive)(skb, master);
 	}
 
@@ -924,7 +924,7 @@ static void sdla_poll(unsigned long devi
 	struct frad_local *flp;
 
 	dev = (struct net_device *) device;
-	flp = dev->priv;
+	flp = netdev_priv(dev);
 
 	if (sdla_byte(dev, SDLA_502_RCV_BUF))
 		sdla_receive(dev);
@@ -940,7 +940,7 @@ static int sdla_close(struct net_device 
 	int               len, i;
 	short             dlcis[CONFIG_DLCI_MAX];
 
-	flp = dev->priv;
+	flp = netdev_priv(dev);
 
 	len = 0;
 	for(i=0;i<CONFIG_DLCI_MAX;i++)
@@ -1001,7 +1001,7 @@ static int sdla_open(struct net_device *
 	int               len, i;
 	char              byte;
 
-	flp = dev->priv;
+	flp = netdev_priv(dev);
 
 	if (!flp->initialized)
 		return(-EPERM);
@@ -1098,7 +1098,7 @@ static int sdla_config(struct net_device
 	if (dev->type = 0xFFFF)
 		return(-EUNATCH);
 
-	flp = dev->priv;
+	flp = netdev_priv(dev);
 
 	if (!get)
 	{
@@ -1230,7 +1230,7 @@ static int sdla_reconfig(struct net_devi
 	struct conf_data  data;
 	int               i, len;
 
-	flp = dev->priv;
+	flp = netdev_priv(dev);
 
 	len = 0;
 	for(i=0;i<CONFIG_DLCI_MAX;i++)
@@ -1255,7 +1255,7 @@ static int sdla_ioctl(struct net_device 
 	if(!capable(CAP_NET_ADMIN))
 		return -EPERM;
 		
-	flp = dev->priv;
+	flp = netdev_priv(dev);
 
 	if (!flp->initialized)
 		return(-EINVAL);
@@ -1321,7 +1321,7 @@ static int sdla_change_mtu(struct net_de
 {
 	struct frad_local *flp;
 
-	flp = dev->priv;
+	flp = netdev_priv(dev);
 
 	if (netif_running(dev))
 		return(-EBUSY);
@@ -1338,7 +1338,7 @@ static int sdla_set_config(struct net_de
 	unsigned base;
 	int err = -EINVAL;
 
-	flp = dev->priv;
+	flp = netdev_priv(dev);
 
 	if (flp->initialized)
 		return(-EINVAL);
@@ -1593,14 +1593,14 @@ fail:
 static struct net_device_stats *sdla_stats(struct net_device *dev)
 {
 	struct frad_local *flp;
-	flp = dev->priv;
+	flp = netdev_priv(dev);
 
 	return(&flp->stats);
 }
 
 static void setup_sdla(struct net_device *dev)
 {
-	struct frad_local *flp = dev->priv;
+	struct frad_local *flp = netdev_priv(dev);
 
 	netdev_boot_setup_check(dev);
 
@@ -1652,7 +1652,7 @@ static int __init init_sdla(void)
 
 static void __exit exit_sdla(void)
 {
-	struct frad_local *flp = sdla->priv;
+	struct frad_local *flp = netdev_priv(sdla);
 
 	unregister_netdev(sdla);
 	if (flp->initialized) {
diff --git a/drivers/net/wan/sealevel.c b/drivers/net/wan/sealevel.c
index 1313581..e78c50b 100644
--- a/drivers/net/wan/sealevel.c
+++ b/drivers/net/wan/sealevel.c
@@ -77,7 +77,7 @@ static void sealevel_input(struct z8530_
  
 static int sealevel_open(struct net_device *d)
 {
-	struct slvl_device *slvl=d->priv;
+	struct slvl_device *slvl=netdev_priv(d);
 	int err = -1;
 	int unit = slvl->channel;
 	
@@ -126,7 +126,7 @@ static int sealevel_open(struct net_devi
 
 static int sealevel_close(struct net_device *d)
 {
-	struct slvl_device *slvl=d->priv;
+	struct slvl_device *slvl=netdev_priv(d);
 	int unit = slvl->channel;
 	
 	/*
@@ -166,7 +166,7 @@ static int sealevel_ioctl(struct net_dev
 
 static struct net_device_stats *sealevel_get_stats(struct net_device *d)
 {
-	struct slvl_device *slvl=d->priv;
+	struct slvl_device *slvl=netdev_priv(d);
 	if(slvl)
 		return z8530_get_stats(slvl->chan);
 	else
@@ -179,7 +179,7 @@ static struct net_device_stats *sealevel
  
 static int sealevel_queue_xmit(struct sk_buff *skb, struct net_device *d)
 {
-	struct slvl_device *slvl=d->priv;
+	struct slvl_device *slvl=netdev_priv(d);
 	return z8530_queue_xmit(slvl->chan, skb);
 }
 
@@ -204,7 +204,7 @@ static int sealevel_neigh_setup_dev(stru
 
 static int sealevel_attach(struct net_device *dev)
 {
-	struct slvl_device *sv = dev->priv;
+	struct slvl_device *sv = netdev_priv(dev);
 	sppp_attach(&sv->pppdev);
 	return 0;
 }
@@ -240,7 +240,7 @@ static inline struct slvl_device *slvl_a
 	if (!d) 
 		return NULL;
 
-	sv = d->priv;
+	sv = netdev_priv(d);
 	sv->if_ptr = &sv->pppdev;
 	sv->pppdev.dev = d;
 	d->base_addr = iobase;
diff --git a/drivers/net/wan/x25_asy.c b/drivers/net/wan/x25_asy.c
index 1c9edd9..9dbf21a 100644
--- a/drivers/net/wan/x25_asy.c
+++ b/drivers/net/wan/x25_asy.c
@@ -63,7 +63,7 @@ static struct x25_asy *x25_asy_alloc(voi
 		if (dev = NULL)
 			break;
 
-		sl = dev->priv;
+		sl = netdev_priv(dev);
 		/* Not in use ? */
 		if (!test_and_set_bit(SLF_INUSE, &sl->flags))
 			return sl;
@@ -85,7 +85,7 @@ static struct x25_asy *x25_asy_alloc(voi
 			return NULL;
 
 		/* Initialize channel control data */
-		sl = dev->priv;
+		sl = netdev_priv(dev);
 		dev->base_addr    = i;
 
 		/* register device so that it can be ifconfig'ed       */
@@ -119,7 +119,7 @@ static void x25_asy_free(struct x25_asy 
 
 static int x25_asy_change_mtu(struct net_device *dev, int newmtu)
 {
-	struct x25_asy *sl = dev->priv;
+	struct x25_asy *sl = netdev_priv(dev);
 	unsigned char *xbuff, *rbuff;
 	int len = 2* newmtu;
 
@@ -282,7 +282,7 @@ static void x25_asy_write_wakeup(struct 
 
 static void x25_asy_timeout(struct net_device *dev)
 {
-	struct x25_asy *sl = (struct x25_asy*)(dev->priv);
+	struct x25_asy *sl = (struct x25_asy*)(netdev_priv(dev));
 
 	spin_lock(&sl->lock);
 	if (netif_queue_stopped(dev)) {
@@ -303,7 +303,7 @@ static void x25_asy_timeout(struct net_d
 
 static int x25_asy_xmit(struct sk_buff *skb, struct net_device *dev)
 {
-	struct x25_asy *sl = (struct x25_asy*)(dev->priv);
+	struct x25_asy *sl = (struct x25_asy*)(netdev_priv(dev));
 	int err;
 
 	if (!netif_running(sl->dev)) {
@@ -372,7 +372,7 @@ static int x25_asy_data_indication(struc
  
 static void x25_asy_data_transmit(struct net_device *dev, struct sk_buff *skb)
 {
-	struct x25_asy *slÞv->priv;
+	struct x25_asy *sl=netdev_priv(dev);
 	
 	spin_lock(&sl->lock);
 	if (netif_queue_stopped(sl->dev) || sl->tty = NULL)
@@ -399,7 +399,7 @@ static void x25_asy_data_transmit(struct
  
 static void x25_asy_connected(struct net_device *dev, int reason)
 {
-	struct x25_asy *sl = dev->priv;
+	struct x25_asy *sl = netdev_priv(dev);
 	struct sk_buff *skb;
 	unsigned char *ptr;
 
@@ -418,7 +418,7 @@ static void x25_asy_connected(struct net
 
 static void x25_asy_disconnected(struct net_device *dev, int reason)
 {
-	struct x25_asy *sl = dev->priv;
+	struct x25_asy *sl = netdev_priv(dev);
 	struct sk_buff *skb;
 	unsigned char *ptr;
 
@@ -449,7 +449,7 @@ static struct lapb_register_struct x25_a
 /* Open the low-level part of the X.25 channel. Easy! */
 static int x25_asy_open(struct net_device *dev)
 {
-	struct x25_asy *sl = (struct x25_asy*)(dev->priv);
+	struct x25_asy *sl = (struct x25_asy*)(netdev_priv(dev));
 	unsigned long len;
 	int err;
 
@@ -499,7 +499,7 @@ norbuff:
 /* Close the low-level part of the X.25 channel. Easy! */
 static int x25_asy_close(struct net_device *dev)
 {
-	struct x25_asy *sl = (struct x25_asy*)(dev->priv);
+	struct x25_asy *sl = (struct x25_asy*)(netdev_priv(dev));
 	int err;
 
 	spin_lock(&sl->lock);
@@ -615,7 +615,7 @@ static void x25_asy_close_tty(struct tty
 
 static struct net_device_stats *x25_asy_get_stats(struct net_device *dev)
 {
-	struct x25_asy *sl = (struct x25_asy*)(dev->priv);
+	struct x25_asy *sl = (struct x25_asy*)(netdev_priv(dev));
 
 	return &sl->stats;
 }
@@ -730,7 +730,7 @@ static int x25_asy_ioctl(struct tty_stru
 
 static int x25_asy_open_dev(struct net_device *dev)
 {
-	struct x25_asy *sl = (struct x25_asy*)(dev->priv);
+	struct x25_asy *sl = (struct x25_asy*)(netdev_priv(dev));
 	if(sl->tty=NULL)
 		return -ENODEV;
 	return 0;
@@ -739,7 +739,7 @@ static int x25_asy_open_dev(struct net_d
 /* Initialise the X.25 driver.  Called by the device init code */
 static void x25_asy_setup(struct net_device *dev)
 {
-	struct x25_asy *sl = dev->priv;
+	struct x25_asy *sl = netdev_priv(dev);
 
 	sl->magic  = X25_ASY_MAGIC;
 	sl->dev	   = dev;
@@ -807,7 +807,7 @@ static void __exit exit_x25_asy(void)
 	for (i = 0; i < x25_asy_maxdev; i++) {
 		dev = x25_asy_devs[i];
 		if (dev) {
-			struct x25_asy *sl = dev->priv;
+			struct x25_asy *sl = netdev_priv(dev);
 
 			spin_lock_bh(&sl->lock);
 			if (sl->tty) 
diff --git a/drivers/net/wireless/strip.c b/drivers/net/wireless/strip.c
index ef32a5c..ed146ae 100644
--- a/drivers/net/wireless/strip.c
+++ b/drivers/net/wireless/strip.c
@@ -2571,7 +2571,7 @@ static struct strip *strip_alloc(void)
 		return NULL;	/* If no more memory, return */
 
 
-	strip_info = dev->priv;
+	strip_info = netdev_priv(dev);
 	strip_info->dev = dev;
 
 	strip_info->magic = STRIP_MAGIC;

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

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* Re: netdev_priv()
  2007-07-18 22:24 netdev_priv() Thomas Surrel
                   ` (6 preceding siblings ...)
  2007-07-19 11:49 ` netdev_priv() Yoann Padioleau
@ 2007-07-19 13:27 ` Thomas Surrel
  2007-07-19 13:34 ` netdev_priv() Alexey Dobriyan
                   ` (9 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: Thomas Surrel @ 2007-07-19 13:27 UTC (permalink / raw)
  To: kernel-janitors

>
> That's what my new semantic patch does. But maybe I am now too
> restrictive.

Your patch is indeed missing some needed changes. I had a look in
drivers/net/wireless only, and it appears that the following drivers
would need to be worked on as well:
airo
arlan
hostap
prism54
ray_cs
wavelan
wl3501

and I assume there are much more in the whole drivers/net/.

I'm not sure there is an easy way to do all the changes at once. I'm
going to make the changes manually in the remaining drivers, but if
there is a faster method, don't hesitate to stop me.

Best regards,

Thomas

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: netdev_priv()
  2007-07-18 22:24 netdev_priv() Thomas Surrel
                   ` (7 preceding siblings ...)
  2007-07-19 13:27 ` netdev_priv() Thomas Surrel
@ 2007-07-19 13:34 ` Alexey Dobriyan
  2007-07-19 13:52 ` netdev_priv() Yoann Padioleau
                   ` (8 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: Alexey Dobriyan @ 2007-07-19 13:34 UTC (permalink / raw)
  To: kernel-janitors

This reminds me OOP wankers adding private members to class and
two accessors per member of get_foo, set_foo variety instead of
simple assignments.

General direction is that struct net_device::priv will be made integer,
If yes, patch is OK, if not -- quite reverse patch should be done.

On 7/19/07, Yoann Padioleau <padator@wanadoo.fr> wrote:
> "Thomas Surrel" <thomas.surrel@gmail.com> writes:
>
> >> @@
> >> struct net_device *dev;
> >> type T;
> >> @@
> >>
> >> - (T) dev->priv
> >> + netdev_priv(dev)
> >>
> >>
> >
> > Sounds good. But from what I saw, you have to be really careful with
> > what your semantic patch would do. Correct me if I am wrong, but the
> > point of using netdev_priv is to access a private structure that is
> > right next to the net_device structure in memory.
>
> Yes, you are right according to
> http://groups.google.com/group/comp.os.linux.development.system/browse_thread/thread/de19321bcd94dbb8/0d74a4adcd6177bd
>
> Thanks for pointing out a problem. I have refined my semantic patch:
>
> @ rule1 @
> type T;
> struct net_device *dev;
> @@
>
>  dev = alloc_netdev(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)
>
>
> @ rule3 depends on rule1 && !rule1bis @
> struct net_device *dev;
> @@
>
> - dev->priv
> + netdev_priv(dev)
>
>
>
> I have put the generated patch in the end of this mail for all drivers
> under drivers/net/. Because of the new condition on alloc_netdev, the patch
> does not touch anymore net/wireless/libertas/main.c.
>
> > Unfortunately, some
> > drivers are allocating their private structure in other memory area,
> > e.g. net/wireless/libertas/main.c:
> >
> > int libertas_add_mesh(wlan_private *priv, struct device *dev)
> > {
> > 	struct net_device *mesh_dev = NULL;
> > 	int ret = 0;
> >
> > 	lbs_deb_enter(LBS_DEB_MESH);
> >
> > 	/* Allocate a virtual mesh device */
> > 	if (!(mesh_dev = alloc_netdev(0, "msh%d", ether_setup))) {
> > 		lbs_deb_mesh("init mshX device failed\n");
> > 		ret = -ENOMEM;
> > 		goto done;
> > 	}
> > 	mesh_dev->priv = priv;
> > 	priv->mesh_dev = mesh_dev;
> > 	[...]
> >
> > In that case, using netdev_priv() would break things. I guess we
> > should not try to change anything to these drivers.
>
> That's what my new semantic patch does. But maybe I am now too
> restrictive. Do you know other conditions where we can safely
> do the transformation ?
>
> >
> > Regards,
> >
> > Thomas
>
>
>
>  arcnet/arcnet.c     |   32 +++++++++++++-------------
>  bonding/bond_main.c |   62
> ++++++++++++++++++++++++++--------------------------
>  shaper.c            |   16 ++++++-------
>  wan/dlci.c          |   30 ++++++++++++-------------
>  wan/lmc/lmc_main.c  |   26 ++++++++++-----------
>  wan/sdla.c          |   46 +++++++++++++++++++-------------------
>  wan/sealevel.c      |   12 +++++-----
>  wan/x25_asy.c       |   28 +++++++++++------------
>  wireless/strip.c    |    2 -
>  9 files changed, 127 insertions(+), 127 deletions(-)
>
>
>
>
> diff --git a/drivers/net/arcnet/arcnet.c b/drivers/net/arcnet/arcnet.c
> index 681e20b..230b545 100644
> --- a/drivers/net/arcnet/arcnet.c
> +++ b/drivers/net/arcnet/arcnet.c
> @@ -181,7 +181,7 @@ #if (ARCNET_DEBUG_MAX & (D_RX | D_TX))
>  static void arcnet_dump_packet(struct net_device *dev, int bufnum,
>  			       char *desc, int take_arcnet_lock)
>  {
> -	struct arcnet_local *lp = dev->priv;
> +	struct arcnet_local *lp = netdev_priv(dev);
>  	int i, length;
>  	unsigned long flags = 0;
>  	static uint8_t buf[512];
> @@ -247,7 +247,7 @@ void arcnet_unregister_proto(struct ArcP
>   */
>  static void release_arcbuf(struct net_device *dev, int bufnum)
>  {
> -	struct arcnet_local *lp = dev->priv;
> +	struct arcnet_local *lp = netdev_priv(dev);
>  	int i;
>
>  	lp->buf_queue[lp->first_free_buf++] = bufnum;
> @@ -269,7 +269,7 @@ static void release_arcbuf(struct net_de
>   */
>  static int get_arcbuf(struct net_device *dev)
>  {
> -	struct arcnet_local *lp = dev->priv;
> +	struct arcnet_local *lp = netdev_priv(dev);
>  	int buf = -1, i;
>
>  	if (!atomic_dec_and_test(&lp->buf_lock)) {
> @@ -353,7 +353,7 @@ struct net_device *alloc_arcdev(char *na
>  	dev = alloc_netdev(sizeof(struct arcnet_local),
>  			   name && *name ? name : "arc%d", arcdev_setup);
>  	if(dev) {
> -		struct arcnet_local *lp = (struct arcnet_local *) dev->priv;
> +		struct arcnet_local *lp = netdev_priv(dev);
>  		spin_lock_init(&lp->lock);
>  	}
>
> @@ -370,7 +370,7 @@ struct net_device *alloc_arcdev(char *na
>   */
>  static int arcnet_open(struct net_device *dev)
>  {
> -	struct arcnet_local *lp = dev->priv;
> +	struct arcnet_local *lp = netdev_priv(dev);
>  	int count, newmtu, error;
>
>  	BUGMSG(D_INIT,"opened.");
> @@ -470,7 +470,7 @@ static int arcnet_open(struct net_device
>  /* The inverse routine to arcnet_open - shuts down the card. */
>  static int arcnet_close(struct net_device *dev)
>  {
> -	struct arcnet_local *lp = dev->priv;
> +	struct arcnet_local *lp = netdev_priv(dev);
>
>  	netif_stop_queue(dev);
>
> @@ -491,7 +491,7 @@ static int arcnet_header(struct sk_buff
>  			 unsigned short type, void *daddr, void *saddr,
>  			 unsigned len)
>  {
> -	struct arcnet_local *lp = dev->priv;
> +	struct arcnet_local *lp = netdev_priv(dev);
>  	uint8_t _daddr, proto_num;
>  	struct ArcProto *proto;
>
> @@ -552,7 +552,7 @@ static int arcnet_header(struct sk_buff
>  static int arcnet_rebuild_header(struct sk_buff *skb)
>  {
>  	struct net_device *dev = skb->dev;
> -	struct arcnet_local *lp = dev->priv;
> +	struct arcnet_local *lp = netdev_priv(dev);
>  	int status = 0;		/* default is failure */
>  	unsigned short type;
>  	uint8_t daddr=0;
> @@ -599,7 +599,7 @@ #endif
>  /* Called by the kernel in order to transmit a packet. */
>  static int arcnet_send_packet(struct sk_buff *skb, struct net_device *dev)
>  {
> -	struct arcnet_local *lp = dev->priv;
> +	struct arcnet_local *lp = netdev_priv(dev);
>  	struct archdr *pkt;
>  	struct arc_rfc1201 *soft;
>  	struct ArcProto *proto;
> @@ -689,7 +689,7 @@ static int arcnet_send_packet(struct sk_
>   */
>  static int go_tx(struct net_device *dev)
>  {
> -	struct arcnet_local *lp = dev->priv;
> +	struct arcnet_local *lp = netdev_priv(dev);
>
>  	BUGMSG(D_DURING, "go_tx: status=%Xh, intmask=%Xh, next_tx=%d,
> cur_tx=%d\n",
>  	       ASTATUS(), lp->intmask, lp->next_tx, lp->cur_tx);
> @@ -719,7 +719,7 @@ static int go_tx(struct net_device *dev)
>  static void arcnet_timeout(struct net_device *dev)
>  {
>  	unsigned long flags;
> -	struct arcnet_local *lp = dev->priv;
> +	struct arcnet_local *lp = netdev_priv(dev);
>  	int status = ASTATUS();
>  	char *msg;
>
> @@ -768,7 +768,7 @@ irqreturn_t arcnet_interrupt(int irq, vo
>
>  	BUGMSG(D_DURING, "in arcnet_interrupt\n");
>  	
> -	lp = dev->priv;
> +	lp = netdev_priv(dev);
>  	BUG_ON(!lp);
>  		
>  	spin_lock(&lp->lock);
> @@ -1005,7 +1005,7 @@ irqreturn_t arcnet_interrupt(int irq, vo
>   */
>  static void arcnet_rx(struct net_device *dev, int bufnum)
>  {
> -	struct arcnet_local *lp = dev->priv;
> +	struct arcnet_local *lp = netdev_priv(dev);
>  	struct archdr pkt;
>  	struct arc_rfc1201 *soft;
>  	int length, ofs;
> @@ -1069,7 +1069,7 @@ static void arcnet_rx(struct net_device
>   */
>  static struct net_device_stats *arcnet_get_stats(struct net_device *dev)
>  {
> -	struct arcnet_local *lp = dev->priv;
> +	struct arcnet_local *lp = netdev_priv(dev);
>  	return &lp->stats;
>  }
>
> @@ -1086,7 +1086,7 @@ static void null_rx(struct net_device *d
>  static int null_build_header(struct sk_buff *skb, struct net_device *dev,
>  			     unsigned short type, uint8_t daddr)
>  {
> -	struct arcnet_local *lp = dev->priv;
> +	struct arcnet_local *lp = netdev_priv(dev);
>
>  	BUGMSG(D_PROTO,
>  	       "tx: can't build header for encap %02Xh; load a protocol
> driver.\n",
> @@ -1101,7 +1101,7 @@ static int null_build_header(struct sk_b
>  static int null_prepare_tx(struct net_device *dev, struct archdr *pkt,
>  			   int length, int bufnum)
>  {
> -	struct arcnet_local *lp = dev->priv;
> +	struct arcnet_local *lp = netdev_priv(dev);
>  	struct arc_hardware newpkt;
>
>  	BUGMSG(D_PROTO, "tx: no encap for this host; load a protocol driver.\n");
> diff --git a/drivers/net/bonding/bond_main.c
> b/drivers/net/bonding/bond_main.c
> index cb9cb30..ed75253 100644
> --- a/drivers/net/bonding/bond_main.c
> +++ b/drivers/net/bonding/bond_main.c
> @@ -425,7 +425,7 @@ int bond_dev_queue_xmit(struct bonding *
>   */
>  static void bond_vlan_rx_register(struct net_device *bond_dev, struct
> vlan_group *grp)
>  {
> -	struct bonding *bond = bond_dev->priv;
> +	struct bonding *bond = netdev_priv(bond_dev);
>  	struct slave *slave;
>  	int i;
>
> @@ -448,7 +448,7 @@ static void bond_vlan_rx_register(struct
>   */
>  static void bond_vlan_rx_add_vid(struct net_device *bond_dev, uint16_t vid)
>  {
> -	struct bonding *bond = bond_dev->priv;
> +	struct bonding *bond = netdev_priv(bond_dev);
>  	struct slave *slave;
>  	int i, res;
>
> @@ -476,7 +476,7 @@ static void bond_vlan_rx_add_vid(struct
>   */
>  static void bond_vlan_rx_kill_vid(struct net_device *bond_dev, uint16_t
> vid)
>  {
> -	struct bonding *bond = bond_dev->priv;
> +	struct bonding *bond = netdev_priv(bond_dev);
>  	struct slave *slave;
>  	struct net_device *vlan_dev;
>  	int i, res;
> @@ -932,7 +932,7 @@ static int bond_mc_list_copy(struct dev_
>   */
>  static void bond_mc_list_flush(struct net_device *bond_dev, struct
> net_device *slave_dev)
>  {
> -	struct bonding *bond = bond_dev->priv;
> +	struct bonding *bond = netdev_priv(bond_dev);
>  	struct dev_mc_list *dmi;
>
>  	for (dmi = bond_dev->mc_list; dmi; dmi = dmi->next) {
> @@ -1280,7 +1280,7 @@ static int bond_compute_features(struct
>  /* enslave device <slave> to bond device <master> */
>  int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
>  {
> -	struct bonding *bond = bond_dev->priv;
> +	struct bonding *bond = netdev_priv(bond_dev);
>  	struct slave *new_slave = NULL;
>  	struct dev_mc_list *dmi;
>  	struct sockaddr addr;
> @@ -1639,7 +1639,7 @@ err_undo_flags:
>   */
>  int bond_release(struct net_device *bond_dev, struct net_device *slave_dev)
>  {
> -	struct bonding *bond = bond_dev->priv;
> +	struct bonding *bond = netdev_priv(bond_dev);
>  	struct slave *slave, *oldcurrent;
>  	struct sockaddr addr;
>  	int mac_addr_differ;
> @@ -1812,7 +1812,7 @@ int bond_release(struct net_device *bond
>   */
>  static int bond_release_all(struct net_device *bond_dev)
>  {
> -	struct bonding *bond = bond_dev->priv;
> +	struct bonding *bond = netdev_priv(bond_dev);
>  	struct slave *slave;
>  	struct net_device *slave_dev;
>  	struct sockaddr addr;
> @@ -1939,7 +1939,7 @@ out:
>   */
>  static int bond_ioctl_change_active(struct net_device *bond_dev, struct
> net_device *slave_dev)
>  {
> -	struct bonding *bond = bond_dev->priv;
> +	struct bonding *bond = netdev_priv(bond_dev);
>  	struct slave *old_active = NULL;
>  	struct slave *new_active = NULL;
>  	int res = 0;
> @@ -1983,7 +1983,7 @@ static int bond_ioctl_change_active(stru
>
>  static int bond_info_query(struct net_device *bond_dev, struct ifbond
> *info)
>  {
> -	struct bonding *bond = bond_dev->priv;
> +	struct bonding *bond = netdev_priv(bond_dev);
>
>  	info->bond_mode = bond->params.mode;
>  	info->miimon = bond->params.miimon;
> @@ -1997,7 +1997,7 @@ static int bond_info_query(struct net_de
>
>  static int bond_slave_info_query(struct net_device *bond_dev, struct
> ifslave *info)
>  {
> -	struct bonding *bond = bond_dev->priv;
> +	struct bonding *bond = netdev_priv(bond_dev);
>  	struct slave *slave;
>  	int i, found = 0;
>
> @@ -2033,7 +2033,7 @@ static int bond_slave_info_query(struct
>  /* this function is called regularly to monitor each slave's link. */
>  void bond_mii_monitor(struct net_device *bond_dev)
>  {
> -	struct bonding *bond = bond_dev->priv;
> +	struct bonding *bond = netdev_priv(bond_dev);
>  	struct slave *slave, *oldcurrent;
>  	int do_failover = 0;
>  	int delta_in_ticks;
> @@ -2500,7 +2500,7 @@ static int bond_arp_rcv(struct sk_buff *
>  	if (!(dev->priv_flags & IFF_BONDING) || !(dev->flags & IFF_MASTER))
>  		goto out;
>
> -	bond = dev->priv;
> +	bond = netdev_priv(dev);
>  	read_lock(&bond->lock);
>
>  	dprintk("bond_arp_rcv: bond %s skb->dev %s orig_dev %s\n",
> @@ -2566,7 +2566,7 @@ out:
>   */
>  void bond_loadbalance_arp_mon(struct net_device *bond_dev)
>  {
> -	struct bonding *bond = bond_dev->priv;
> +	struct bonding *bond = netdev_priv(bond_dev);
>  	struct slave *slave, *oldcurrent;
>  	int do_failover = 0;
>  	int delta_in_ticks;
> @@ -2697,7 +2697,7 @@ out:
>   */
>  void bond_activebackup_arp_mon(struct net_device *bond_dev)
>  {
> -	struct bonding *bond = bond_dev->priv;
> +	struct bonding *bond = netdev_priv(bond_dev);
>  	struct slave *slave;
>  	int delta_in_ticks;
>  	int i;
> @@ -3254,7 +3254,7 @@ #endif
>
>  static int bond_master_netdev_event(unsigned long event, struct net_device
> *bond_dev)
>  {
> -	struct bonding *event_bond = bond_dev->priv;
> +	struct bonding *event_bond = netdev_priv(bond_dev);
>
>  	switch (event) {
>  	case NETDEV_CHANGENAME:
> @@ -3274,7 +3274,7 @@ static int bond_master_netdev_event(unsi
>  static int bond_slave_netdev_event(unsigned long event, struct net_device
> *slave_dev)
>  {
>  	struct net_device *bond_dev = slave_dev->master;
> -	struct bonding *bond = bond_dev->priv;
> +	struct bonding *bond = netdev_priv(bond_dev);
>
>  	switch (event) {
>  	case NETDEV_UNREGISTER:
> @@ -3502,7 +3502,7 @@ static int bond_xmit_hash_policy_l2(stru
>
>  static int bond_open(struct net_device *bond_dev)
>  {
> -	struct bonding *bond = bond_dev->priv;
> +	struct bonding *bond = netdev_priv(bond_dev);
>  	struct timer_list *mii_timer = &bond->mii_timer;
>  	struct timer_list *arp_timer = &bond->arp_timer;
>
> @@ -3567,7 +3567,7 @@ static int bond_open(struct net_device *
>
>  static int bond_close(struct net_device *bond_dev)
>  {
> -	struct bonding *bond = bond_dev->priv;
> +	struct bonding *bond = netdev_priv(bond_dev);
>
>  	if (bond->params.mode = BOND_MODE_8023AD) {
>  		/* Unregister the receive of LACPDUs */
> @@ -3623,7 +3623,7 @@ static int bond_close(struct net_device
>
>  static struct net_device_stats *bond_get_stats(struct net_device *bond_dev)
>  {
> -	struct bonding *bond = bond_dev->priv;
> +	struct bonding *bond = netdev_priv(bond_dev);
>  	struct net_device_stats *stats = &(bond->stats), *sstats;
>  	struct slave *slave;
>  	int i;
> @@ -3698,7 +3698,7 @@ static int bond_do_ioctl(struct net_devi
>  		}
>
>  		if (mii->reg_num = 1) {
> -			struct bonding *bond = bond_dev->priv;
> +			struct bonding *bond = netdev_priv(bond_dev);
>  			mii->val_out = 0;
>  			read_lock_bh(&bond->lock);
>  			read_lock(&bond->curr_slave_lock);
> @@ -3790,7 +3790,7 @@ static int bond_do_ioctl(struct net_devi
>
>  static void bond_set_multicast_list(struct net_device *bond_dev)
>  {
> -	struct bonding *bond = bond_dev->priv;
> +	struct bonding *bond = netdev_priv(bond_dev);
>  	struct dev_mc_list *dmi;
>
>  	write_lock_bh(&bond->lock);
> @@ -3843,7 +3843,7 @@ static void bond_set_multicast_list(stru
>   */
>  static int bond_change_mtu(struct net_device *bond_dev, int new_mtu)
>  {
> -	struct bonding *bond = bond_dev->priv;
> +	struct bonding *bond = netdev_priv(bond_dev);
>  	struct slave *slave, *stop_at;
>  	int res = 0;
>  	int i;
> @@ -3915,7 +3915,7 @@ unwind:
>   */
>  static int bond_set_mac_address(struct net_device *bond_dev, void *addr)
>  {
> -	struct bonding *bond = bond_dev->priv;
> +	struct bonding *bond = netdev_priv(bond_dev);
>  	struct sockaddr *sa = addr, tmp_sa;
>  	struct slave *slave, *stop_at;
>  	int res = 0;
> @@ -3989,7 +3989,7 @@ unwind:
>
>  static int bond_xmit_roundrobin(struct sk_buff *skb, struct net_device
> *bond_dev)
>  {
> -	struct bonding *bond = bond_dev->priv;
> +	struct bonding *bond = netdev_priv(bond_dev);
>  	struct slave *slave, *start_at;
>  	int i;
>  	int res = 1;
> @@ -4039,7 +4039,7 @@ out:
>   */
>  static int bond_xmit_activebackup(struct sk_buff *skb, struct net_device
> *bond_dev)
>  {
> -	struct bonding *bond = bond_dev->priv;
> +	struct bonding *bond = netdev_priv(bond_dev);
>  	int res = 1;
>
>  	read_lock(&bond->lock);
> @@ -4071,7 +4071,7 @@ out:
>   */
>  static int bond_xmit_xor(struct sk_buff *skb, struct net_device *bond_dev)
>  {
> -	struct bonding *bond = bond_dev->priv;
> +	struct bonding *bond = netdev_priv(bond_dev);
>  	struct slave *slave, *start_at;
>  	int slave_no;
>  	int i;
> @@ -4117,7 +4117,7 @@ out:
>   */
>  static int bond_xmit_broadcast(struct sk_buff *skb, struct net_device
> *bond_dev)
>  {
> -	struct bonding *bond = bond_dev->priv;
> +	struct bonding *bond = netdev_priv(bond_dev);
>  	struct slave *slave, *start_at;
>  	struct net_device *tx_dev = NULL;
>  	int i;
> @@ -4248,7 +4248,7 @@ static const struct ethtool_ops bond_eth
>   */
>  static int bond_init(struct net_device *bond_dev, struct bond_params
> *params)
>  {
> -	struct bonding *bond = bond_dev->priv;
> +	struct bonding *bond = netdev_priv(bond_dev);
>
>  	dprintk("Begin bond_init for %s\n", bond_dev->name);
>
> @@ -4323,7 +4323,7 @@ #endif
>   */
>  void bond_deinit(struct net_device *bond_dev)
>  {
> -	struct bonding *bond = bond_dev->priv;
> +	struct bonding *bond = netdev_priv(bond_dev);
>
>  	list_del(&bond->bond_list);
>
> @@ -4717,12 +4717,12 @@ int bond_create(char *name, struct bond_
>  	lockdep_set_class(&bond_dev->_xmit_lock, &bonding_netdev_xmit_lock_key);
>
>  	if (newbond)
> -		*newbond = bond_dev->priv;
> +		*newbond = netdev_priv(bond_dev);
>
>  	netif_carrier_off(bond_dev);
>
>  	rtnl_unlock(); /* allows sysfs registration of net device */
> -	res = bond_create_sysfs_entry(bond_dev->priv);
> +	res = bond_create_sysfs_entry(netdev_priv(bond_dev));
>  	if (res < 0) {
>  		rtnl_lock();
>  		goto out_bond;
> diff --git a/drivers/net/shaper.c b/drivers/net/shaper.c
> index e886e8d..0b8e9af 100644
> --- a/drivers/net/shaper.c
> +++ b/drivers/net/shaper.c
> @@ -133,7 +133,7 @@ static void shaper_setspeed(struct shape
>
>  static int shaper_start_xmit(struct sk_buff *skb, struct net_device *dev)
>  {
> -	struct shaper *shaper = dev->priv;
> +	struct shaper *shaper = netdev_priv(dev);
>   	struct sk_buff *ptr;
>
>  	spin_lock(&shaper->lock);
> @@ -288,7 +288,7 @@ static void shaper_kick(struct shaper *s
>
>  static int shaper_open(struct net_device *dev)
>  {
> -	struct shaper *shaperÞv->priv;
> +	struct shaper *shaper=netdev_priv(dev);
>
>  	/*
>  	 *	Can't open until attached.
> @@ -309,7 +309,7 @@ static int shaper_open(struct net_device
>
>  static int shaper_close(struct net_device *dev)
>  {
> -	struct shaper *shaperÞv->priv;
> +	struct shaper *shaper=netdev_priv(dev);
>  	struct sk_buff *skb;
>
>  	while ((skb = skb_dequeue(&shaper->sendq)) != NULL)
> @@ -331,14 +331,14 @@ static int shaper_close(struct net_devic
>
>  static struct net_device_stats *shaper_get_stats(struct net_device *dev)
>  {
> -     	struct shaper *shÞv->priv;
> +     	struct shaper *sh=netdev_priv(dev);
>  	return &sh->stats;
>  }
>
>  static int shaper_header(struct sk_buff *skb, struct net_device *dev,
>  	unsigned short type, void *daddr, void *saddr, unsigned len)
>  {
> -	struct shaper *shÞv->priv;
> +	struct shaper *sh=netdev_priv(dev);
>  	int v;
>  	if(sh_debug)
>  		printk("Shaper header\n");
> @@ -476,7 +476,7 @@ #endif
>  static int shaper_ioctl(struct net_device *dev,  struct ifreq *ifr, int
> cmd)
>  {
>  	struct shaperconf *ss= (struct shaperconf *)&ifr->ifr_ifru;
> -	struct shaper *shÞv->priv;
> +	struct shaper *sh=netdev_priv(dev);
>
>  	if(ss->ss_cmd = SHAPER_SET_DEV || ss->ss_cmd = SHAPER_SET_SPEED)
>  	{
> @@ -493,7 +493,7 @@ static int shaper_ioctl(struct net_devic
>  				return -ENODEV;
>  			if(sh->dev)
>  				return -EBUSY;
> -			return shaper_attach(dev,dev->priv, them);
> +			return shaper_attach(dev,netdev_priv(dev), them);
>  		}
>  		case SHAPER_GET_DEV:
>  			if(sh->dev=NULL)
> @@ -513,7 +513,7 @@ static int shaper_ioctl(struct net_devic
>
>  static void shaper_init_priv(struct net_device *dev)
>  {
> -	struct shaper *sh = dev->priv;
> +	struct shaper *sh = netdev_priv(dev);
>
>  	skb_queue_head_init(&sh->sendq);
>  	init_timer(&sh->timer);
> diff --git a/drivers/net/wan/dlci.c b/drivers/net/wan/dlci.c
> index 66be20c..d988161 100644
> --- a/drivers/net/wan/dlci.c
> +++ b/drivers/net/wan/dlci.c
> @@ -74,7 +74,7 @@ static int dlci_header(struct sk_buff *s
>  	unsigned int		hlen;
>  	char			*dest;
>
> -	dlp = dev->priv;
> +	dlp = netdev_priv(dev);
>
>  	hdr.control = FRAD_I_UI;
>  	switch(type)
> @@ -110,7 +110,7 @@ static void dlci_receive(struct sk_buff
>  	struct frhdr		*hdr;
>  	int					process, header;
>
> -	dlp = dev->priv;
> +	dlp = netdev_priv(dev);
>  	if (!pskb_may_pull(skb, sizeof(*hdr))) {
>  		printk(KERN_NOTICE "%s: invalid data no header\n",
>  		       dev->name);
> @@ -197,7 +197,7 @@ static int dlci_transmit(struct sk_buff
>  	if (!skb || !dev)
>  		return(0);
>
> -	dlp = dev->priv;
> +	dlp = netdev_priv(dev);
>
>  	netif_stop_queue(dev);
>  	
> @@ -235,7 +235,7 @@ static int dlci_config(struct net_device
>  	struct frad_local	*flp;
>  	int			err;
>
> -	dlp = dev->priv;
> +	dlp = netdev_priv(dev);
>
>  	flp = dlp->slave->priv;
>
> @@ -269,7 +269,7 @@ static int dlci_dev_ioctl(struct net_dev
>  	if (!capable(CAP_NET_ADMIN))
>  		return(-EPERM);
>
> -	dlp = dev->priv;
> +	dlp = netdev_priv(dev);
>
>  	switch(cmd)
>  	{
> @@ -298,7 +298,7 @@ static int dlci_change_mtu(struct net_de
>  {
>  	struct dlci_local *dlp;
>
> -	dlp = dev->priv;
> +	dlp = netdev_priv(dev);
>
>  	return((*dlp->slave->change_mtu)(dlp->slave, new_mtu));
>  }
> @@ -309,7 +309,7 @@ static int dlci_open(struct net_device *
>  	struct frad_local	*flp;
>  	int			err;
>
> -	dlp = dev->priv;
> +	dlp = netdev_priv(dev);
>
>  	if (!*(short *)(dev->dev_addr))
>  		return(-EINVAL);
> @@ -335,7 +335,7 @@ static int dlci_close(struct net_device
>
>  	netif_stop_queue(dev);
>
> -	dlp = dev->priv;
> +	dlp = netdev_priv(dev);
>
>  	flp = dlp->slave->priv;
>  	err = (*flp->deactivate)(dlp->slave, dev);
> @@ -347,7 +347,7 @@ static struct net_device_stats *dlci_get
>  {
>  	struct dlci_local *dlp;
>
> -	dlp = dev->priv;
> +	dlp = netdev_priv(dev);
>
>  	return(&dlp->stats);
>  }
> @@ -365,7 +365,7 @@ static int dlci_add(struct dlci_add *dlc
>  	if (!slave)
>  		return -ENODEV;
>
> -	if (slave->type != ARPHRD_FRAD || slave->priv = NULL)
> +	if (slave->type != ARPHRD_FRAD || netdev_priv(slave) = NULL)
>  		goto err1;
>
>  	/* create device name */
> @@ -391,11 +391,11 @@ static int dlci_add(struct dlci_add *dlc
>
>  	*(short *)(master->dev_addr) = dlci->dlci;
>
> -	dlp = (struct dlci_local *) master->priv;
> +	dlp = netdev_priv(master);
>  	dlp->slave = slave;
>  	dlp->master = master;
>
> -	flp = slave->priv;
> +	flp = netdev_priv(slave);
>  	err = (*flp->assoc)(slave, master);
>  	if (err < 0)
>  		goto err2;
> @@ -435,9 +435,9 @@ static int dlci_del(struct dlci_add *dlc
>  		return(-EBUSY);
>  	}
>
> -	dlp = master->priv;
> +	dlp = netdev_priv(master);
>  	slave = dlp->slave;
> -	flp = slave->priv;
> +	flp = netdev_priv(slave);
>
>  	rtnl_lock();
>  	err = (*flp->deassoc)(slave, master);
> @@ -487,7 +487,7 @@ static int dlci_ioctl(unsigned int cmd,
>
>  static void dlci_setup(struct net_device *dev)
>  {
> -	struct dlci_local *dlp = dev->priv;
> +	struct dlci_local *dlp = netdev_priv(dev);
>
>  	dev->flags		= 0;
>  	dev->open		= dlci_open;
> diff --git a/drivers/net/wan/lmc/lmc_main.c b/drivers/net/wan/lmc/lmc_main.c
> index 750b3ef..8c95f3d 100644
> --- a/drivers/net/wan/lmc/lmc_main.c
> +++ b/drivers/net/wan/lmc/lmc_main.c
> @@ -126,7 +126,7 @@ int lmc_ioctl (struct net_device *dev, s
>
>      ret = -EOPNOTSUPP;
>
> -    sc = dev->priv;
> +    sc = netdev_priv(dev);
>
>      lmc_trace(dev, "lmc_ioctl in");
>
> @@ -634,7 +634,7 @@ static void lmc_watchdog (unsigned long
>      u_int32_t ticks;
>      unsigned long flags;
>
> -    sc = dev->priv;
> +    sc = netdev_priv(dev);
>
>      lmc_trace(dev, "lmc_watchdog in");
>
> @@ -872,7 +872,7 @@ #endif
>          lmc_first_load = 1;
>      }
>
> -    sc = dev->priv;
> +    sc = netdev_priv(dev);
>      sc->lmc_device = dev;
>      sc->name = dev->name;
>
> @@ -1018,7 +1018,7 @@ static void __devexit lmc_remove_one (st
>      struct net_device *dev = pci_get_drvdata(pdev);
>
>      if (dev) {
> -	    lmc_softc_t *sc = dev->priv;
> +	    lmc_softc_t *sc = netdev_priv(dev);
>  	
>  	    printk("%s: removing...\n", dev->name);
>  	    lmc_proto_detach(sc);
> @@ -1035,7 +1035,7 @@ static void __devexit lmc_remove_one (st
>   */
>  static int lmc_open (struct net_device *dev) /*fold00*/
>  {
> -    lmc_softc_t *sc = dev->priv;
> +    lmc_softc_t *sc = netdev_priv(dev);
>
>      lmc_trace(dev, "lmc_open in");
>
> @@ -1153,7 +1153,7 @@ static int lmc_open (struct net_device *
>  static void lmc_running_reset (struct net_device *dev) /*fold00*/
>  {
>
> -    lmc_softc_t *sc = (lmc_softc_t *) dev->priv;
> +    lmc_softc_t *sc = netdev_priv(dev);
>
>      lmc_trace(dev, "lmc_runnig_reset in");
>
> @@ -1194,7 +1194,7 @@ static int lmc_close (struct net_device
>
>      lmc_trace(dev, "lmc_close in");
>
> -    sc = dev->priv;
> +    sc = netdev_priv(dev);
>      sc->lmc_ok = 0;
>      sc->lmc_media->set_link_status (sc, 0);
>      del_timer (&sc->timer);
> @@ -1210,7 +1210,7 @@ static int lmc_close (struct net_device
>  /* When the interface goes down, this is called */
>  static int lmc_ifdown (struct net_device *dev) /*fold00*/
>  {
> -    lmc_softc_t *sc = dev->priv;
> +    lmc_softc_t *sc = netdev_priv(dev);
>      u32 csr6;
>      int i;
>
> @@ -1287,7 +1287,7 @@ static irqreturn_t lmc_interrupt (int ir
>
>      lmc_trace(dev, "lmc_interrupt in");
>
> -    sc = dev->priv;
> +    sc = netdev_priv(dev);
>
>      spin_lock(&sc->lmc_lock);
>
> @@ -1473,7 +1473,7 @@ static int lmc_start_xmit (struct sk_buf
>
>      lmc_trace(dev, "lmc_start_xmit in");
>
> -    sc = dev->priv;
> +    sc = netdev_priv(dev);
>
>      spin_lock_irqsave(&sc->lmc_lock, flags);
>
> @@ -1570,7 +1570,7 @@ static int lmc_rx (struct net_device *de
>
>      lmc_trace(dev, "lmc_rx in");
>
> -    sc = dev->priv;
> +    sc = netdev_priv(dev);
>
>      lmc_led_on(sc, LMC_DS3_LED3);
>
> @@ -1764,7 +1764,7 @@ skip_out_of_mem:
>
>  static struct net_device_stats *lmc_get_stats (struct net_device *dev)
> /*fold00*/
>  {
> -    lmc_softc_t *sc = dev->priv;
> +    lmc_softc_t *sc = netdev_priv(dev);
>      unsigned long flags;
>
>      lmc_trace(dev, "lmc_get_stats in");
> @@ -2145,7 +2145,7 @@ static void lmc_driver_timeout(struct ne
>
>      lmc_trace(dev, "lmc_driver_timeout in");
>
> -    sc = dev->priv;
> +    sc = netdev_priv(dev);
>
>      spin_lock_irqsave(&sc->lmc_lock, flags);
>
> diff --git a/drivers/net/wan/sdla.c b/drivers/net/wan/sdla.c
> index 6a485f0..4cb43f4 100644
> --- a/drivers/net/wan/sdla.c
> +++ b/drivers/net/wan/sdla.c
> @@ -185,7 +185,7 @@ static void sdla_stop(struct net_device
>  {
>  	struct frad_local *flp;
>
> -	flp = dev->priv;
> +	flp = netdev_priv(dev);
>  	switch(flp->type)
>  	{
>  		case SDLA_S502A:
> @@ -212,7 +212,7 @@ static void sdla_start(struct net_device
>  {
>  	struct frad_local *flp;
>
> -	flp = dev->priv;
> +	flp = netdev_priv(dev);
>  	switch(flp->type)
>  	{
>  		case SDLA_S502A:
> @@ -432,7 +432,7 @@ static int sdla_cmd(struct net_device *d
>  	int                      ret, waiting, len;
>  	long                     window;
>
> -	flp = dev->priv;
> +	flp = netdev_priv(dev);
>  	window = flp->type = SDLA_S508 ? SDLA_508_CMD_BUF : SDLA_502_CMD_BUF;
>  	cmd_buf = (struct sdla_cmd *)(dev->mem_start + (window & SDLA_ADDR_MASK));
>  	ret = 0;
> @@ -509,7 +509,7 @@ static int sdla_activate(struct net_devi
>  	struct frad_local *flp;
>  	int i;
>
> -	flp = slave->priv;
> +	flp = netdev_priv(slave);
>
>  	for(i=0;i<CONFIG_DLCI_MAX;i++)
>  		if (flp->master[i] = master)
> @@ -531,7 +531,7 @@ static int sdla_deactivate(struct net_de
>  	struct frad_local *flp;
>  	int               i;
>
> -	flp = slave->priv;
> +	flp = netdev_priv(slave);
>
>  	for(i=0;i<CONFIG_DLCI_MAX;i++)
>  		if (flp->master[i] = master)
> @@ -556,7 +556,7 @@ static int sdla_assoc(struct net_device
>  	if (master->type != ARPHRD_DLCI)
>  		return(-EINVAL);
>
> -	flp = slave->priv;
> +	flp = netdev_priv(slave);
>
>  	for(i=0;i<CONFIG_DLCI_MAX;i++)
>  	{
> @@ -589,7 +589,7 @@ static int sdla_deassoc(struct net_devic
>  	struct frad_local *flp;
>  	int               i;
>
> -	flp = slave->priv;
> +	flp = netdev_priv(slave);
>
>  	for(i=0;i<CONFIG_DLCI_MAX;i++)
>  		if (flp->master[i] = master)
> @@ -619,7 +619,7 @@ static int sdla_dlci_conf(struct net_dev
>  	int               i;
>  	short             len, ret;
>
> -	flp = slave->priv;
> +	flp = netdev_priv(slave);
>
>  	for(i=0;i<CONFIG_DLCI_MAX;i++)
>  		if (flp->master[i] = master)
> @@ -628,7 +628,7 @@ static int sdla_dlci_conf(struct net_dev
>  	if (i = CONFIG_DLCI_MAX)
>  		return(-ENODEV);
>
> -	dlp = master->priv;
> +	dlp = netdev_priv(master);
>
>  	ret = SDLA_RET_OK;
>  	len = sizeof(struct dlci_conf);
> @@ -659,7 +659,7 @@ static int sdla_transmit(struct sk_buff
>  	unsigned long     flags;
>  	struct buf_entry  *pbuf;
>
> -	flp = dev->priv;
> +	flp = netdev_priv(dev);
>  	ret = 0;
>  	accept = 1;
>
> @@ -755,7 +755,7 @@ static void sdla_receive(struct net_devi
>  	int               i=0, received, success, addr, buf_base, buf_top;
>  	short             dlci, len, len2, split;
>
> -	flp = dev->priv;
> +	flp = netdev_priv(dev);
>  	success = 1;
>  	received = addr = buf_top = buf_base = 0;
>  	len = dlci = 0;
> @@ -860,7 +860,7 @@ static void sdla_receive(struct net_devi
>  	if (success)
>  	{
>  		flp->stats.rx_packets++;
> -		dlp = master->priv;
> +		dlp = netdev_priv(master);
>  		(*dlp->receive)(skb, master);
>  	}
>
> @@ -924,7 +924,7 @@ static void sdla_poll(unsigned long devi
>  	struct frad_local *flp;
>
>  	dev = (struct net_device *) device;
> -	flp = dev->priv;
> +	flp = netdev_priv(dev);
>
>  	if (sdla_byte(dev, SDLA_502_RCV_BUF))
>  		sdla_receive(dev);
> @@ -940,7 +940,7 @@ static int sdla_close(struct net_device
>  	int               len, i;
>  	short             dlcis[CONFIG_DLCI_MAX];
>
> -	flp = dev->priv;
> +	flp = netdev_priv(dev);
>
>  	len = 0;
>  	for(i=0;i<CONFIG_DLCI_MAX;i++)
> @@ -1001,7 +1001,7 @@ static int sdla_open(struct net_device *
>  	int               len, i;
>  	char              byte;
>
> -	flp = dev->priv;
> +	flp = netdev_priv(dev);
>
>  	if (!flp->initialized)
>  		return(-EPERM);
> @@ -1098,7 +1098,7 @@ static int sdla_config(struct net_device
>  	if (dev->type = 0xFFFF)
>  		return(-EUNATCH);
>
> -	flp = dev->priv;
> +	flp = netdev_priv(dev);
>
>  	if (!get)
>  	{
> @@ -1230,7 +1230,7 @@ static int sdla_reconfig(struct net_devi
>  	struct conf_data  data;
>  	int               i, len;
>
> -	flp = dev->priv;
> +	flp = netdev_priv(dev);
>
>  	len = 0;
>  	for(i=0;i<CONFIG_DLCI_MAX;i++)
> @@ -1255,7 +1255,7 @@ static int sdla_ioctl(struct net_device
>  	if(!capable(CAP_NET_ADMIN))
>  		return -EPERM;
>  		
> -	flp = dev->priv;
> +	flp = netdev_priv(dev);
>
>  	if (!flp->initialized)
>  		return(-EINVAL);
> @@ -1321,7 +1321,7 @@ static int sdla_change_mtu(struct net_de
>  {
>  	struct frad_local *flp;
>
> -	flp = dev->priv;
> +	flp = netdev_priv(dev);
>
>  	if (netif_running(dev))
>  		return(-EBUSY);
> @@ -1338,7 +1338,7 @@ static int sdla_set_config(struct net_de
>  	unsigned base;
>  	int err = -EINVAL;
>
> -	flp = dev->priv;
> +	flp = netdev_priv(dev);
>
>  	if (flp->initialized)
>  		return(-EINVAL);
> @@ -1593,14 +1593,14 @@ fail:
>  static struct net_device_stats *sdla_stats(struct net_device *dev)
>  {
>  	struct frad_local *flp;
> -	flp = dev->priv;
> +	flp = netdev_priv(dev);
>
>  	return(&flp->stats);
>  }
>
>  static void setup_sdla(struct net_device *dev)
>  {
> -	struct frad_local *flp = dev->priv;
> +	struct frad_local *flp = netdev_priv(dev);
>
>  	netdev_boot_setup_check(dev);
>
> @@ -1652,7 +1652,7 @@ static int __init init_sdla(void)
>
>  static void __exit exit_sdla(void)
>  {
> -	struct frad_local *flp = sdla->priv;
> +	struct frad_local *flp = netdev_priv(sdla);
>
>  	unregister_netdev(sdla);
>  	if (flp->initialized) {
> diff --git a/drivers/net/wan/sealevel.c b/drivers/net/wan/sealevel.c
> index 1313581..e78c50b 100644
> --- a/drivers/net/wan/sealevel.c
> +++ b/drivers/net/wan/sealevel.c
> @@ -77,7 +77,7 @@ static void sealevel_input(struct z8530_
>
>  static int sealevel_open(struct net_device *d)
>  {
> -	struct slvl_device *slvl=d->priv;
> +	struct slvl_device *slvl=netdev_priv(d);
>  	int err = -1;
>  	int unit = slvl->channel;
>  	
> @@ -126,7 +126,7 @@ static int sealevel_open(struct net_devi
>
>  static int sealevel_close(struct net_device *d)
>  {
> -	struct slvl_device *slvl=d->priv;
> +	struct slvl_device *slvl=netdev_priv(d);
>  	int unit = slvl->channel;
>  	
>  	/*
> @@ -166,7 +166,7 @@ static int sealevel_ioctl(struct net_dev
>
>  static struct net_device_stats *sealevel_get_stats(struct net_device *d)
>  {
> -	struct slvl_device *slvl=d->priv;
> +	struct slvl_device *slvl=netdev_priv(d);
>  	if(slvl)
>  		return z8530_get_stats(slvl->chan);
>  	else
> @@ -179,7 +179,7 @@ static struct net_device_stats *sealevel
>
>  static int sealevel_queue_xmit(struct sk_buff *skb, struct net_device *d)
>  {
> -	struct slvl_device *slvl=d->priv;
> +	struct slvl_device *slvl=netdev_priv(d);
>  	return z8530_queue_xmit(slvl->chan, skb);
>  }
>
> @@ -204,7 +204,7 @@ static int sealevel_neigh_setup_dev(stru
>
>  static int sealevel_attach(struct net_device *dev)
>  {
> -	struct slvl_device *sv = dev->priv;
> +	struct slvl_device *sv = netdev_priv(dev);
>  	sppp_attach(&sv->pppdev);
>  	return 0;
>  }
> @@ -240,7 +240,7 @@ static inline struct slvl_device *slvl_a
>  	if (!d)
>  		return NULL;
>
> -	sv = d->priv;
> +	sv = netdev_priv(d);
>  	sv->if_ptr = &sv->pppdev;
>  	sv->pppdev.dev = d;
>  	d->base_addr = iobase;
> diff --git a/drivers/net/wan/x25_asy.c b/drivers/net/wan/x25_asy.c
> index 1c9edd9..9dbf21a 100644
> --- a/drivers/net/wan/x25_asy.c
> +++ b/drivers/net/wan/x25_asy.c
> @@ -63,7 +63,7 @@ static struct x25_asy *x25_asy_alloc(voi
>  		if (dev = NULL)
>  			break;
>
> -		sl = dev->priv;
> +		sl = netdev_priv(dev);
>  		/* Not in use ? */
>  		if (!test_and_set_bit(SLF_INUSE, &sl->flags))
>  			return sl;
> @@ -85,7 +85,7 @@ static struct x25_asy *x25_asy_alloc(voi
>  			return NULL;
>
>  		/* Initialize channel control data */
> -		sl = dev->priv;
> +		sl = netdev_priv(dev);
>  		dev->base_addr    = i;
>
>  		/* register device so that it can be ifconfig'ed       */
> @@ -119,7 +119,7 @@ static void x25_asy_free(struct x25_asy
>
>  static int x25_asy_change_mtu(struct net_device *dev, int newmtu)
>  {
> -	struct x25_asy *sl = dev->priv;
> +	struct x25_asy *sl = netdev_priv(dev);
>  	unsigned char *xbuff, *rbuff;
>  	int len = 2* newmtu;
>
> @@ -282,7 +282,7 @@ static void x25_asy_write_wakeup(struct
>
>  static void x25_asy_timeout(struct net_device *dev)
>  {
> -	struct x25_asy *sl = (struct x25_asy*)(dev->priv);
> +	struct x25_asy *sl = (struct x25_asy*)(netdev_priv(dev));
>
>  	spin_lock(&sl->lock);
>  	if (netif_queue_stopped(dev)) {
> @@ -303,7 +303,7 @@ static void x25_asy_timeout(struct net_d
>
>  static int x25_asy_xmit(struct sk_buff *skb, struct net_device *dev)
>  {
> -	struct x25_asy *sl = (struct x25_asy*)(dev->priv);
> +	struct x25_asy *sl = (struct x25_asy*)(netdev_priv(dev));
>  	int err;
>
>  	if (!netif_running(sl->dev)) {
> @@ -372,7 +372,7 @@ static int x25_asy_data_indication(struc
>
>  static void x25_asy_data_transmit(struct net_device *dev, struct sk_buff
> *skb)
>  {
> -	struct x25_asy *slÞv->priv;
> +	struct x25_asy *sl=netdev_priv(dev);
>  	
>  	spin_lock(&sl->lock);
>  	if (netif_queue_stopped(sl->dev) || sl->tty = NULL)
> @@ -399,7 +399,7 @@ static void x25_asy_data_transmit(struct
>
>  static void x25_asy_connected(struct net_device *dev, int reason)
>  {
> -	struct x25_asy *sl = dev->priv;
> +	struct x25_asy *sl = netdev_priv(dev);
>  	struct sk_buff *skb;
>  	unsigned char *ptr;
>
> @@ -418,7 +418,7 @@ static void x25_asy_connected(struct net
>
>  static void x25_asy_disconnected(struct net_device *dev, int reason)
>  {
> -	struct x25_asy *sl = dev->priv;
> +	struct x25_asy *sl = netdev_priv(dev);
>  	struct sk_buff *skb;
>  	unsigned char *ptr;
>
> @@ -449,7 +449,7 @@ static struct lapb_register_struct x25_a
>  /* Open the low-level part of the X.25 channel. Easy! */
>  static int x25_asy_open(struct net_device *dev)
>  {
> -	struct x25_asy *sl = (struct x25_asy*)(dev->priv);
> +	struct x25_asy *sl = (struct x25_asy*)(netdev_priv(dev));
>  	unsigned long len;
>  	int err;
>
> @@ -499,7 +499,7 @@ norbuff:
>  /* Close the low-level part of the X.25 channel. Easy! */
>  static int x25_asy_close(struct net_device *dev)
>  {
> -	struct x25_asy *sl = (struct x25_asy*)(dev->priv);
> +	struct x25_asy *sl = (struct x25_asy*)(netdev_priv(dev));
>  	int err;
>
>  	spin_lock(&sl->lock);
> @@ -615,7 +615,7 @@ static void x25_asy_close_tty(struct tty
>
>  static struct net_device_stats *x25_asy_get_stats(struct net_device *dev)
>  {
> -	struct x25_asy *sl = (struct x25_asy*)(dev->priv);
> +	struct x25_asy *sl = (struct x25_asy*)(netdev_priv(dev));
>
>  	return &sl->stats;
>  }
> @@ -730,7 +730,7 @@ static int x25_asy_ioctl(struct tty_stru
>
>  static int x25_asy_open_dev(struct net_device *dev)
>  {
> -	struct x25_asy *sl = (struct x25_asy*)(dev->priv);
> +	struct x25_asy *sl = (struct x25_asy*)(netdev_priv(dev));
>  	if(sl->tty=NULL)
>  		return -ENODEV;
>  	return 0;
> @@ -739,7 +739,7 @@ static int x25_asy_open_dev(struct net_d
>  /* Initialise the X.25 driver.  Called by the device init code */
>  static void x25_asy_setup(struct net_device *dev)
>  {
> -	struct x25_asy *sl = dev->priv;
> +	struct x25_asy *sl = netdev_priv(dev);
>
>  	sl->magic  = X25_ASY_MAGIC;
>  	sl->dev	   = dev;
> @@ -807,7 +807,7 @@ static void __exit exit_x25_asy(void)
>  	for (i = 0; i < x25_asy_maxdev; i++) {
>  		dev = x25_asy_devs[i];
>  		if (dev) {
> -			struct x25_asy *sl = dev->priv;
> +			struct x25_asy *sl = netdev_priv(dev);
>
>  			spin_lock_bh(&sl->lock);
>  			if (sl->tty)
> diff --git a/drivers/net/wireless/strip.c b/drivers/net/wireless/strip.c
> index ef32a5c..ed146ae 100644
> --- a/drivers/net/wireless/strip.c
> +++ b/drivers/net/wireless/strip.c
> @@ -2571,7 +2571,7 @@ static struct strip *strip_alloc(void)
>  		return NULL;	/* If no more memory, return */
>
>
> -	strip_info = dev->priv;
> +	strip_info = netdev_priv(dev);
>  	strip_info->dev = dev;
>
>  	strip_info->magic = STRIP_MAGIC;
>
> -
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors"
> in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
-
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: netdev_priv()
  2007-07-18 22:24 netdev_priv() Thomas Surrel
                   ` (8 preceding siblings ...)
  2007-07-19 13:34 ` netdev_priv() Alexey Dobriyan
@ 2007-07-19 13:52 ` Yoann Padioleau
  2007-07-19 13:59 ` netdev_priv() Yoann Padioleau
                   ` (7 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: Yoann Padioleau @ 2007-07-19 13:52 UTC (permalink / raw)
  To: kernel-janitors

"Thomas Surrel" <thomas.surrel@gmail.com> writes:

>>
>> That's what my new semantic patch does. But maybe I am now too
>> restrictive.
>
> Your patch is indeed missing some needed changes. I had a look in
> drivers/net/wireless only, and it appears that the following drivers
> would need to be worked on as well:
> airo
> arlan
> hostap
> prism54
> ray_cs
> wavelan
> wl3501
>
> and I assume there are much more in the whole drivers/net/.
>
> I'm not sure there is an easy way to do all the changes at once. I'm
> going to make the changes manually in the remaining drivers, but if
> there is a faster method, don't hesitate to stop me.

Yes, I can apply my simpler semantic patch on the file you 
have clearly identified as "safe" to do the transformation. 

The only thing is that I would like also to automate the
identification part where you know when it's safe or not. How do you
know that for instance it's safe to replace the dev->priv by
netpriv(dev) in airo.c ? How do you know the private structure is
allocated behind the struct netdevice ?

in airo.c there is 

static struct net_device *init_wifidev(struct airo_info *ai,
					struct net_device *ethdev)
{
	int err;
	struct net_device *dev = alloc_netdev(0, "wifi%d", wifi_setup);
	if (!dev)
		return NULL;
	dev->priv = ethdev->priv;
	dev->irq = ethdev->irq;
	dev->base_addr = ethdev->base_addr;
	dev->wireless_data = ethdev->wireless_data;
	memcpy(dev->dev_addr, ethdev->dev_addr, dev->addr_len);
	err = register_netdev(dev);
	if (err<0) {
		free_netdev(dev);
		return NULL;
	}
	return dev;
}


So it does not look dev->priv is behind the freshly allocated
alloc_netdev.




>
> Best regards,
>
> Thomas


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: netdev_priv()
  2007-07-18 22:24 netdev_priv() Thomas Surrel
                   ` (9 preceding siblings ...)
  2007-07-19 13:52 ` netdev_priv() Yoann Padioleau
@ 2007-07-19 13:59 ` Yoann Padioleau
  2007-07-19 14:33 ` netdev_priv() Thomas Surrel
                   ` (6 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: Yoann Padioleau @ 2007-07-19 13:59 UTC (permalink / raw)
  To: kernel-janitors

"Alexey Dobriyan" <adobriyan@gmail.com> writes:

> This reminds me OOP wankers adding private members to class and
> two accessors per member of get_foo, set_foo variety instead of
> simple assignments.
>
> General direction is that struct net_device::priv will be made integer,

Why an integer ? 

> If yes, 

"If yes" what ? What is the question ? 

> patch is OK, if not -- quite reverse patch should be done.

I don't understand. By reverse patch you mean "don't do anything" ? 

>
> On 7/19/07, Yoann Padioleau <padator@wanadoo.fr> wrote:
>> "Thomas Surrel" <thomas.surrel@gmail.com> writes:
>>
>> >> @@
>> >> struct net_device *dev;
>> >> type T;
>> >> @@
>> >>
>> >> - (T) dev->priv
>> >> + netdev_priv(dev)
>> >>
>> >>
>> >
>> > Sounds good. But from what I saw, you have to be really careful with
>> > what your semantic patch would do. Correct me if I am wrong, but the
>> > point of using netdev_priv is to access a private structure that is
>> > right next to the net_device structure in memory.
>>
>> Yes, you are right according to
>> http://groups.google.com/group/comp.os.linux.development.system/browse_thread/thread/de19321bcd94dbb8/0d74a4adcd6177bd
>>
>> Thanks for pointing out a problem. I have refined my semantic patch:
>>
>> @ rule1 @
>> type T;
>> struct net_device *dev;
>> @@
>>
>>  dev = alloc_netdev(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)
>>
>>
>> @ rule3 depends on rule1 && !rule1bis @
>> struct net_device *dev;
>> @@
>>
>> - dev->priv
>> + netdev_priv(dev)
>>
>>
>>
>> I have put the generated patch in the end of this mail for all drivers
>> under drivers/net/. Because of the new condition on alloc_netdev, the patch
>> does not touch anymore net/wireless/libertas/main.c.
>>
>> > Unfortunately, some
>> > drivers are allocating their private structure in other memory area,
>> > e.g. net/wireless/libertas/main.c:
>> >
>> > int libertas_add_mesh(wlan_private *priv, struct device *dev)
>> > {
>> > 	struct net_device *mesh_dev = NULL;
>> > 	int ret = 0;
>> >
>> > 	lbs_deb_enter(LBS_DEB_MESH);
>> >
>> > 	/* Allocate a virtual mesh device */
>> > 	if (!(mesh_dev = alloc_netdev(0, "msh%d", ether_setup))) {
>> > 		lbs_deb_mesh("init mshX device failed\n");
>> > 		ret = -ENOMEM;
>> > 		goto done;
>> > 	}
>> > 	mesh_dev->priv = priv;
>> > 	priv->mesh_dev = mesh_dev;
>> > 	[...]
>> >
>> > In that case, using netdev_priv() would break things. I guess we
>> > should not try to change anything to these drivers.
>>
>> That's what my new semantic patch does. But maybe I am now too
>> restrictive. Do you know other conditions where we can safely
>> do the transformation ?
>>
>> >
>> > Regards,
>> >
>> > Thomas

[...]


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: netdev_priv()
  2007-07-18 22:24 netdev_priv() Thomas Surrel
                   ` (10 preceding siblings ...)
  2007-07-19 13:59 ` netdev_priv() Yoann Padioleau
@ 2007-07-19 14:33 ` Thomas Surrel
  2007-07-19 15:22 ` netdev_priv() pradeep singh
                   ` (5 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: Thomas Surrel @ 2007-07-19 14:33 UTC (permalink / raw)
  To: kernel-janitors

>
> Yes, I can apply my simpler semantic patch on the file you
> have clearly identified as "safe" to do the transformation.

Your simple semantic patch is not convering all the cases. Some driver
don't make the access with dev->priv, it can be
my_own_private_netdevice->priv. So we would still need to check behind
you patch, which is not far from doing manually, unfortunately ...

>
> The only thing is that I would like also to automate the
> identification part where you know when it's safe or not. How do you
> know that for instance it's safe to replace the dev->priv by
> netpriv(dev) in airo.c ? How do you know the private structure is
> allocated behind the struct netdevice ?
>
> in airo.c there is
>
> static struct net_device *init_wifidev(struct airo_info *ai,
>                                        struct net_device *ethdev)
> {
>        int err;
>        struct net_device *dev = alloc_netdev(0, "wifi%d", wifi_setup);
>        if (!dev)
>                return NULL;
>        dev->priv = ethdev->priv;
>        dev->irq = ethdev->irq;
>        dev->base_addr = ethdev->base_addr;
>        dev->wireless_data = ethdev->wireless_data;
>        memcpy(dev->dev_addr, ethdev->dev_addr, dev->addr_len);
>        err = register_netdev(dev);
>        if (err<0) {
>                free_netdev(dev);
>                return NULL;
>        }
>        return dev;
> }
>
>
> So it does not look dev->priv is behind the freshly allocated
> alloc_netdev.

Indeed, not in that location, but you also have:
static struct net_device *_init_airo_card( unsigned short irq, int port,
					   int is_pcmcia, struct pci_dev *pci,
					   struct device *dmdev )
{
	struct net_device *dev;
	struct airo_info *ai;
	int i, rc;

	/* Create the network device object. */
	dev = alloc_etherdev(sizeof(*ai));
	 if (!dev) {
		airo_print_err("", "Couldn't alloc_etherdev");
		return NULL;
	}
	if (dev_alloc_name(dev, dev->name) < 0) {
		airo_print_err("", "Couldn't get name!");
		goto err_out_free;
	}

	ai = dev->priv;

In that case again, autmating the process is not easy at all.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: netdev_priv()
  2007-07-18 22:24 netdev_priv() Thomas Surrel
                   ` (11 preceding siblings ...)
  2007-07-19 14:33 ` netdev_priv() Thomas Surrel
@ 2007-07-19 15:22 ` pradeep singh
  2007-07-19 15:35 ` netdev_priv() Yoann Padioleau
                   ` (4 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: pradeep singh @ 2007-07-19 15:22 UTC (permalink / raw)
  To: kernel-janitors

On 7/19/07, Alexey Dobriyan <adobriyan@gmail.com> wrote:
> This reminds me OOP wankers adding private members to class and
> two accessors per member of get_foo, set_foo variety instead of
> simple assignments.
>
> General direction is that struct net_device::priv will be made integer,

Why integer, Alexey??

thanks
> If yes, patch is OK, if not -- quite reverse patch should be done.
>
> On 7/19/07, Yoann Padioleau <padator@wanadoo.fr> wrote:
> > "Thomas Surrel" <thomas.surrel@gmail.com> writes:
> >
> > >> @@
> > >> struct net_device *dev;
> > >> type T;
> > >> @@
> > >>
> > >> - (T) dev->priv
> > >> + netdev_priv(dev)
> > >>
> > >>
> > >
> > > Sounds good. But from what I saw, you have to be really careful with
> > > what your semantic patch would do. Correct me if I am wrong, but the
> > > point of using netdev_priv is to access a private structure that is
> > > right next to the net_device structure in memory.
> >
> > Yes, you are right according to
> > http://groups.google.com/group/comp.os.linux.development.system/browse_thread/thread/de19321bcd94dbb8/0d74a4adcd6177bd
> >
> > Thanks for pointing out a problem. I have refined my semantic patch:
> >
> > @ rule1 @
> > type T;
> > struct net_device *dev;
> > @@
> >
> >  dev = alloc_netdev(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)
> >
> >
> > @ rule3 depends on rule1 && !rule1bis @
> > struct net_device *dev;
> > @@
> >
> > - dev->priv
> > + netdev_priv(dev)
> >
> >
> >
> > I have put the generated patch in the end of this mail for all drivers
> > under drivers/net/. Because of the new condition on alloc_netdev, the patch
> > does not touch anymore net/wireless/libertas/main.c.
> >
> > > Unfortunately, some
> > > drivers are allocating their private structure in other memory area,
> > > e.g. net/wireless/libertas/main.c:
> > >
> > > int libertas_add_mesh(wlan_private *priv, struct device *dev)
> > > {
> > >     struct net_device *mesh_dev = NULL;
> > >     int ret = 0;
> > >
> > >     lbs_deb_enter(LBS_DEB_MESH);
> > >
> > >     /* Allocate a virtual mesh device */
> > >     if (!(mesh_dev = alloc_netdev(0, "msh%d", ether_setup))) {
> > >             lbs_deb_mesh("init mshX device failed\n");
> > >             ret = -ENOMEM;
> > >             goto done;
> > >     }
> > >     mesh_dev->priv = priv;
> > >     priv->mesh_dev = mesh_dev;
> > >     [...]
> > >
> > > In that case, using netdev_priv() would break things. I guess we
> > > should not try to change anything to these drivers.
> >
> > That's what my new semantic patch does. But maybe I am now too
> > restrictive. Do you know other conditions where we can safely
> > do the transformation ?
> >
> > >
> > > Regards,
> > >
> > > Thomas
> >
> >
> >
> >  arcnet/arcnet.c     |   32 +++++++++++++-------------
> >  bonding/bond_main.c |   62
> > ++++++++++++++++++++++++++--------------------------
> >  shaper.c            |   16 ++++++-------
> >  wan/dlci.c          |   30 ++++++++++++-------------
> >  wan/lmc/lmc_main.c  |   26 ++++++++++-----------
> >  wan/sdla.c          |   46 +++++++++++++++++++-------------------
> >  wan/sealevel.c      |   12 +++++-----
> >  wan/x25_asy.c       |   28 +++++++++++------------
> >  wireless/strip.c    |    2 -
> >  9 files changed, 127 insertions(+), 127 deletions(-)
> >
> >
> >
> >
> > diff --git a/drivers/net/arcnet/arcnet.c b/drivers/net/arcnet/arcnet.c
> > index 681e20b..230b545 100644
> > --- a/drivers/net/arcnet/arcnet.c
> > +++ b/drivers/net/arcnet/arcnet.c
> > @@ -181,7 +181,7 @@ #if (ARCNET_DEBUG_MAX & (D_RX | D_TX))
> >  static void arcnet_dump_packet(struct net_device *dev, int bufnum,
> >                              char *desc, int take_arcnet_lock)
> >  {
> > -     struct arcnet_local *lp = dev->priv;
> > +     struct arcnet_local *lp = netdev_priv(dev);
> >       int i, length;
> >       unsigned long flags = 0;
> >       static uint8_t buf[512];
> > @@ -247,7 +247,7 @@ void arcnet_unregister_proto(struct ArcP
> >   */
> >  static void release_arcbuf(struct net_device *dev, int bufnum)
> >  {
> > -     struct arcnet_local *lp = dev->priv;
> > +     struct arcnet_local *lp = netdev_priv(dev);
> >       int i;
> >
> >       lp->buf_queue[lp->first_free_buf++] = bufnum;
> > @@ -269,7 +269,7 @@ static void release_arcbuf(struct net_de
> >   */
> >  static int get_arcbuf(struct net_device *dev)
> >  {
> > -     struct arcnet_local *lp = dev->priv;
> > +     struct arcnet_local *lp = netdev_priv(dev);
> >       int buf = -1, i;
> >
> >       if (!atomic_dec_and_test(&lp->buf_lock)) {
> > @@ -353,7 +353,7 @@ struct net_device *alloc_arcdev(char *na
> >       dev = alloc_netdev(sizeof(struct arcnet_local),
> >                          name && *name ? name : "arc%d", arcdev_setup);
> >       if(dev) {
> > -             struct arcnet_local *lp = (struct arcnet_local *) dev->priv;
> > +             struct arcnet_local *lp = netdev_priv(dev);
> >               spin_lock_init(&lp->lock);
> >       }
> >
> > @@ -370,7 +370,7 @@ struct net_device *alloc_arcdev(char *na
> >   */
> >  static int arcnet_open(struct net_device *dev)
> >  {
> > -     struct arcnet_local *lp = dev->priv;
> > +     struct arcnet_local *lp = netdev_priv(dev);
> >       int count, newmtu, error;
> >
> >       BUGMSG(D_INIT,"opened.");
> > @@ -470,7 +470,7 @@ static int arcnet_open(struct net_device
> >  /* The inverse routine to arcnet_open - shuts down the card. */
> >  static int arcnet_close(struct net_device *dev)
> >  {
> > -     struct arcnet_local *lp = dev->priv;
> > +     struct arcnet_local *lp = netdev_priv(dev);
> >
> >       netif_stop_queue(dev);
> >
> > @@ -491,7 +491,7 @@ static int arcnet_header(struct sk_buff
> >                        unsigned short type, void *daddr, void *saddr,
> >                        unsigned len)
> >  {
> > -     struct arcnet_local *lp = dev->priv;
> > +     struct arcnet_local *lp = netdev_priv(dev);
> >       uint8_t _daddr, proto_num;
> >       struct ArcProto *proto;
> >
> > @@ -552,7 +552,7 @@ static int arcnet_header(struct sk_buff
> >  static int arcnet_rebuild_header(struct sk_buff *skb)
> >  {
> >       struct net_device *dev = skb->dev;
> > -     struct arcnet_local *lp = dev->priv;
> > +     struct arcnet_local *lp = netdev_priv(dev);
> >       int status = 0;         /* default is failure */
> >       unsigned short type;
> >       uint8_t daddr=0;
> > @@ -599,7 +599,7 @@ #endif
> >  /* Called by the kernel in order to transmit a packet. */
> >  static int arcnet_send_packet(struct sk_buff *skb, struct net_device *dev)
> >  {
> > -     struct arcnet_local *lp = dev->priv;
> > +     struct arcnet_local *lp = netdev_priv(dev);
> >       struct archdr *pkt;
> >       struct arc_rfc1201 *soft;
> >       struct ArcProto *proto;
> > @@ -689,7 +689,7 @@ static int arcnet_send_packet(struct sk_
> >   */
> >  static int go_tx(struct net_device *dev)
> >  {
> > -     struct arcnet_local *lp = dev->priv;
> > +     struct arcnet_local *lp = netdev_priv(dev);
> >
> >       BUGMSG(D_DURING, "go_tx: status=%Xh, intmask=%Xh, next_tx=%d,
> > cur_tx=%d\n",
> >              ASTATUS(), lp->intmask, lp->next_tx, lp->cur_tx);
> > @@ -719,7 +719,7 @@ static int go_tx(struct net_device *dev)
> >  static void arcnet_timeout(struct net_device *dev)
> >  {
> >       unsigned long flags;
> > -     struct arcnet_local *lp = dev->priv;
> > +     struct arcnet_local *lp = netdev_priv(dev);
> >       int status = ASTATUS();
> >       char *msg;
> >
> > @@ -768,7 +768,7 @@ irqreturn_t arcnet_interrupt(int irq, vo
> >
> >       BUGMSG(D_DURING, "in arcnet_interrupt\n");
> >
> > -     lp = dev->priv;
> > +     lp = netdev_priv(dev);
> >       BUG_ON(!lp);
> >
> >       spin_lock(&lp->lock);
> > @@ -1005,7 +1005,7 @@ irqreturn_t arcnet_interrupt(int irq, vo
> >   */
> >  static void arcnet_rx(struct net_device *dev, int bufnum)
> >  {
> > -     struct arcnet_local *lp = dev->priv;
> > +     struct arcnet_local *lp = netdev_priv(dev);
> >       struct archdr pkt;
> >       struct arc_rfc1201 *soft;
> >       int length, ofs;
> > @@ -1069,7 +1069,7 @@ static void arcnet_rx(struct net_device
> >   */
> >  static struct net_device_stats *arcnet_get_stats(struct net_device *dev)
> >  {
> > -     struct arcnet_local *lp = dev->priv;
> > +     struct arcnet_local *lp = netdev_priv(dev);
> >       return &lp->stats;
> >  }
> >
> > @@ -1086,7 +1086,7 @@ static void null_rx(struct net_device *d
> >  static int null_build_header(struct sk_buff *skb, struct net_device *dev,
> >                            unsigned short type, uint8_t daddr)
> >  {
> > -     struct arcnet_local *lp = dev->priv;
> > +     struct arcnet_local *lp = netdev_priv(dev);
> >
> >       BUGMSG(D_PROTO,
> >              "tx: can't build header for encap %02Xh; load a protocol
> > driver.\n",
> > @@ -1101,7 +1101,7 @@ static int null_build_header(struct sk_b
> >  static int null_prepare_tx(struct net_device *dev, struct archdr *pkt,
> >                          int length, int bufnum)
> >  {
> > -     struct arcnet_local *lp = dev->priv;
> > +     struct arcnet_local *lp = netdev_priv(dev);
> >       struct arc_hardware newpkt;
> >
> >       BUGMSG(D_PROTO, "tx: no encap for this host; load a protocol driver.\n");
> > diff --git a/drivers/net/bonding/bond_main.c
> > b/drivers/net/bonding/bond_main.c
> > index cb9cb30..ed75253 100644
> > --- a/drivers/net/bonding/bond_main.c
> > +++ b/drivers/net/bonding/bond_main.c
> > @@ -425,7 +425,7 @@ int bond_dev_queue_xmit(struct bonding *
> >   */
> >  static void bond_vlan_rx_register(struct net_device *bond_dev, struct
> > vlan_group *grp)
> >  {
> > -     struct bonding *bond = bond_dev->priv;
> > +     struct bonding *bond = netdev_priv(bond_dev);
> >       struct slave *slave;
> >       int i;
> >
> > @@ -448,7 +448,7 @@ static void bond_vlan_rx_register(struct
> >   */
> >  static void bond_vlan_rx_add_vid(struct net_device *bond_dev, uint16_t vid)
> >  {
> > -     struct bonding *bond = bond_dev->priv;
> > +     struct bonding *bond = netdev_priv(bond_dev);
> >       struct slave *slave;
> >       int i, res;
> >
> > @@ -476,7 +476,7 @@ static void bond_vlan_rx_add_vid(struct
> >   */
> >  static void bond_vlan_rx_kill_vid(struct net_device *bond_dev, uint16_t
> > vid)
> >  {
> > -     struct bonding *bond = bond_dev->priv;
> > +     struct bonding *bond = netdev_priv(bond_dev);
> >       struct slave *slave;
> >       struct net_device *vlan_dev;
> >       int i, res;
> > @@ -932,7 +932,7 @@ static int bond_mc_list_copy(struct dev_
> >   */
> >  static void bond_mc_list_flush(struct net_device *bond_dev, struct
> > net_device *slave_dev)
> >  {
> > -     struct bonding *bond = bond_dev->priv;
> > +     struct bonding *bond = netdev_priv(bond_dev);
> >       struct dev_mc_list *dmi;
> >
> >       for (dmi = bond_dev->mc_list; dmi; dmi = dmi->next) {
> > @@ -1280,7 +1280,7 @@ static int bond_compute_features(struct
> >  /* enslave device <slave> to bond device <master> */
> >  int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
> >  {
> > -     struct bonding *bond = bond_dev->priv;
> > +     struct bonding *bond = netdev_priv(bond_dev);
> >       struct slave *new_slave = NULL;
> >       struct dev_mc_list *dmi;
> >       struct sockaddr addr;
> > @@ -1639,7 +1639,7 @@ err_undo_flags:
> >   */
> >  int bond_release(struct net_device *bond_dev, struct net_device *slave_dev)
> >  {
> > -     struct bonding *bond = bond_dev->priv;
> > +     struct bonding *bond = netdev_priv(bond_dev);
> >       struct slave *slave, *oldcurrent;
> >       struct sockaddr addr;
> >       int mac_addr_differ;
> > @@ -1812,7 +1812,7 @@ int bond_release(struct net_device *bond
> >   */
> >  static int bond_release_all(struct net_device *bond_dev)
> >  {
> > -     struct bonding *bond = bond_dev->priv;
> > +     struct bonding *bond = netdev_priv(bond_dev);
> >       struct slave *slave;
> >       struct net_device *slave_dev;
> >       struct sockaddr addr;
> > @@ -1939,7 +1939,7 @@ out:
> >   */
> >  static int bond_ioctl_change_active(struct net_device *bond_dev, struct
> > net_device *slave_dev)
> >  {
> > -     struct bonding *bond = bond_dev->priv;
> > +     struct bonding *bond = netdev_priv(bond_dev);
> >       struct slave *old_active = NULL;
> >       struct slave *new_active = NULL;
> >       int res = 0;
> > @@ -1983,7 +1983,7 @@ static int bond_ioctl_change_active(stru
> >
> >  static int bond_info_query(struct net_device *bond_dev, struct ifbond
> > *info)
> >  {
> > -     struct bonding *bond = bond_dev->priv;
> > +     struct bonding *bond = netdev_priv(bond_dev);
> >
> >       info->bond_mode = bond->params.mode;
> >       info->miimon = bond->params.miimon;
> > @@ -1997,7 +1997,7 @@ static int bond_info_query(struct net_de
> >
> >  static int bond_slave_info_query(struct net_device *bond_dev, struct
> > ifslave *info)
> >  {
> > -     struct bonding *bond = bond_dev->priv;
> > +     struct bonding *bond = netdev_priv(bond_dev);
> >       struct slave *slave;
> >       int i, found = 0;
> >
> > @@ -2033,7 +2033,7 @@ static int bond_slave_info_query(struct
> >  /* this function is called regularly to monitor each slave's link. */
> >  void bond_mii_monitor(struct net_device *bond_dev)
> >  {
> > -     struct bonding *bond = bond_dev->priv;
> > +     struct bonding *bond = netdev_priv(bond_dev);
> >       struct slave *slave, *oldcurrent;
> >       int do_failover = 0;
> >       int delta_in_ticks;
> > @@ -2500,7 +2500,7 @@ static int bond_arp_rcv(struct sk_buff *
> >       if (!(dev->priv_flags & IFF_BONDING) || !(dev->flags & IFF_MASTER))
> >               goto out;
> >
> > -     bond = dev->priv;
> > +     bond = netdev_priv(dev);
> >       read_lock(&bond->lock);
> >
> >       dprintk("bond_arp_rcv: bond %s skb->dev %s orig_dev %s\n",
> > @@ -2566,7 +2566,7 @@ out:
> >   */
> >  void bond_loadbalance_arp_mon(struct net_device *bond_dev)
> >  {
> > -     struct bonding *bond = bond_dev->priv;
> > +     struct bonding *bond = netdev_priv(bond_dev);
> >       struct slave *slave, *oldcurrent;
> >       int do_failover = 0;
> >       int delta_in_ticks;
> > @@ -2697,7 +2697,7 @@ out:
> >   */
> >  void bond_activebackup_arp_mon(struct net_device *bond_dev)
> >  {
> > -     struct bonding *bond = bond_dev->priv;
> > +     struct bonding *bond = netdev_priv(bond_dev);
> >       struct slave *slave;
> >       int delta_in_ticks;
> >       int i;
> > @@ -3254,7 +3254,7 @@ #endif
> >
> >  static int bond_master_netdev_event(unsigned long event, struct net_device
> > *bond_dev)
> >  {
> > -     struct bonding *event_bond = bond_dev->priv;
> > +     struct bonding *event_bond = netdev_priv(bond_dev);
> >
> >       switch (event) {
> >       case NETDEV_CHANGENAME:
> > @@ -3274,7 +3274,7 @@ static int bond_master_netdev_event(unsi
> >  static int bond_slave_netdev_event(unsigned long event, struct net_device
> > *slave_dev)
> >  {
> >       struct net_device *bond_dev = slave_dev->master;
> > -     struct bonding *bond = bond_dev->priv;
> > +     struct bonding *bond = netdev_priv(bond_dev);
> >
> >       switch (event) {
> >       case NETDEV_UNREGISTER:
> > @@ -3502,7 +3502,7 @@ static int bond_xmit_hash_policy_l2(stru
> >
> >  static int bond_open(struct net_device *bond_dev)
> >  {
> > -     struct bonding *bond = bond_dev->priv;
> > +     struct bonding *bond = netdev_priv(bond_dev);
> >       struct timer_list *mii_timer = &bond->mii_timer;
> >       struct timer_list *arp_timer = &bond->arp_timer;
> >
> > @@ -3567,7 +3567,7 @@ static int bond_open(struct net_device *
> >
> >  static int bond_close(struct net_device *bond_dev)
> >  {
> > -     struct bonding *bond = bond_dev->priv;
> > +     struct bonding *bond = netdev_priv(bond_dev);
> >
> >       if (bond->params.mode = BOND_MODE_8023AD) {
> >               /* Unregister the receive of LACPDUs */
> > @@ -3623,7 +3623,7 @@ static int bond_close(struct net_device
> >
> >  static struct net_device_stats *bond_get_stats(struct net_device *bond_dev)
> >  {
> > -     struct bonding *bond = bond_dev->priv;
> > +     struct bonding *bond = netdev_priv(bond_dev);
> >       struct net_device_stats *stats = &(bond->stats), *sstats;
> >       struct slave *slave;
> >       int i;
> > @@ -3698,7 +3698,7 @@ static int bond_do_ioctl(struct net_devi
> >               }
> >
> >               if (mii->reg_num = 1) {
> > -                     struct bonding *bond = bond_dev->priv;
> > +                     struct bonding *bond = netdev_priv(bond_dev);
> >                       mii->val_out = 0;
> >                       read_lock_bh(&bond->lock);
> >                       read_lock(&bond->curr_slave_lock);
> > @@ -3790,7 +3790,7 @@ static int bond_do_ioctl(struct net_devi
> >
> >  static void bond_set_multicast_list(struct net_device *bond_dev)
> >  {
> > -     struct bonding *bond = bond_dev->priv;
> > +     struct bonding *bond = netdev_priv(bond_dev);
> >       struct dev_mc_list *dmi;
> >
> >       write_lock_bh(&bond->lock);
> > @@ -3843,7 +3843,7 @@ static void bond_set_multicast_list(stru
> >   */
> >  static int bond_change_mtu(struct net_device *bond_dev, int new_mtu)
> >  {
> > -     struct bonding *bond = bond_dev->priv;
> > +     struct bonding *bond = netdev_priv(bond_dev);
> >       struct slave *slave, *stop_at;
> >       int res = 0;
> >       int i;
> > @@ -3915,7 +3915,7 @@ unwind:
> >   */
> >  static int bond_set_mac_address(struct net_device *bond_dev, void *addr)
> >  {
> > -     struct bonding *bond = bond_dev->priv;
> > +     struct bonding *bond = netdev_priv(bond_dev);
> >       struct sockaddr *sa = addr, tmp_sa;
> >       struct slave *slave, *stop_at;
> >       int res = 0;
> > @@ -3989,7 +3989,7 @@ unwind:
> >
> >  static int bond_xmit_roundrobin(struct sk_buff *skb, struct net_device
> > *bond_dev)
> >  {
> > -     struct bonding *bond = bond_dev->priv;
> > +     struct bonding *bond = netdev_priv(bond_dev);
> >       struct slave *slave, *start_at;
> >       int i;
> >       int res = 1;
> > @@ -4039,7 +4039,7 @@ out:
> >   */
> >  static int bond_xmit_activebackup(struct sk_buff *skb, struct net_device
> > *bond_dev)
> >  {
> > -     struct bonding *bond = bond_dev->priv;
> > +     struct bonding *bond = netdev_priv(bond_dev);
> >       int res = 1;
> >
> >       read_lock(&bond->lock);
> > @@ -4071,7 +4071,7 @@ out:
> >   */
> >  static int bond_xmit_xor(struct sk_buff *skb, struct net_device *bond_dev)
> >  {
> > -     struct bonding *bond = bond_dev->priv;
> > +     struct bonding *bond = netdev_priv(bond_dev);
> >       struct slave *slave, *start_at;
> >       int slave_no;
> >       int i;
> > @@ -4117,7 +4117,7 @@ out:
> >   */
> >  static int bond_xmit_broadcast(struct sk_buff *skb, struct net_device
> > *bond_dev)
> >  {
> > -     struct bonding *bond = bond_dev->priv;
> > +     struct bonding *bond = netdev_priv(bond_dev);
> >       struct slave *slave, *start_at;
> >       struct net_device *tx_dev = NULL;
> >       int i;
> > @@ -4248,7 +4248,7 @@ static const struct ethtool_ops bond_eth
> >   */
> >  static int bond_init(struct net_device *bond_dev, struct bond_params
> > *params)
> >  {
> > -     struct bonding *bond = bond_dev->priv;
> > +     struct bonding *bond = netdev_priv(bond_dev);
> >
> >       dprintk("Begin bond_init for %s\n", bond_dev->name);
> >
> > @@ -4323,7 +4323,7 @@ #endif
> >   */
> >  void bond_deinit(struct net_device *bond_dev)
> >  {
> > -     struct bonding *bond = bond_dev->priv;
> > +     struct bonding *bond = netdev_priv(bond_dev);
> >
> >       list_del(&bond->bond_list);
> >
> > @@ -4717,12 +4717,12 @@ int bond_create(char *name, struct bond_
> >       lockdep_set_class(&bond_dev->_xmit_lock, &bonding_netdev_xmit_lock_key);
> >
> >       if (newbond)
> > -             *newbond = bond_dev->priv;
> > +             *newbond = netdev_priv(bond_dev);
> >
> >       netif_carrier_off(bond_dev);
> >
> >       rtnl_unlock(); /* allows sysfs registration of net device */
> > -     res = bond_create_sysfs_entry(bond_dev->priv);
> > +     res = bond_create_sysfs_entry(netdev_priv(bond_dev));
> >       if (res < 0) {
> >               rtnl_lock();
> >               goto out_bond;
> > diff --git a/drivers/net/shaper.c b/drivers/net/shaper.c
> > index e886e8d..0b8e9af 100644
> > --- a/drivers/net/shaper.c
> > +++ b/drivers/net/shaper.c
> > @@ -133,7 +133,7 @@ static void shaper_setspeed(struct shape
> >
> >  static int shaper_start_xmit(struct sk_buff *skb, struct net_device *dev)
> >  {
> > -     struct shaper *shaper = dev->priv;
> > +     struct shaper *shaper = netdev_priv(dev);
> >       struct sk_buff *ptr;
> >
> >       spin_lock(&shaper->lock);
> > @@ -288,7 +288,7 @@ static void shaper_kick(struct shaper *s
> >
> >  static int shaper_open(struct net_device *dev)
> >  {
> > -     struct shaper *shaperÞv->priv;
> > +     struct shaper *shaper=netdev_priv(dev);
> >
> >       /*
> >        *      Can't open until attached.
> > @@ -309,7 +309,7 @@ static int shaper_open(struct net_device
> >
> >  static int shaper_close(struct net_device *dev)
> >  {
> > -     struct shaper *shaperÞv->priv;
> > +     struct shaper *shaper=netdev_priv(dev);
> >       struct sk_buff *skb;
> >
> >       while ((skb = skb_dequeue(&shaper->sendq)) != NULL)
> > @@ -331,14 +331,14 @@ static int shaper_close(struct net_devic
> >
> >  static struct net_device_stats *shaper_get_stats(struct net_device *dev)
> >  {
> > -             struct shaper *shÞv->priv;
> > +             struct shaper *sh=netdev_priv(dev);
> >       return &sh->stats;
> >  }
> >
> >  static int shaper_header(struct sk_buff *skb, struct net_device *dev,
> >       unsigned short type, void *daddr, void *saddr, unsigned len)
> >  {
> > -     struct shaper *shÞv->priv;
> > +     struct shaper *sh=netdev_priv(dev);
> >       int v;
> >       if(sh_debug)
> >               printk("Shaper header\n");
> > @@ -476,7 +476,7 @@ #endif
> >  static int shaper_ioctl(struct net_device *dev,  struct ifreq *ifr, int
> > cmd)
> >  {
> >       struct shaperconf *ss= (struct shaperconf *)&ifr->ifr_ifru;
> > -     struct shaper *shÞv->priv;
> > +     struct shaper *sh=netdev_priv(dev);
> >
> >       if(ss->ss_cmd = SHAPER_SET_DEV || ss->ss_cmd = SHAPER_SET_SPEED)
> >       {
> > @@ -493,7 +493,7 @@ static int shaper_ioctl(struct net_devic
> >                               return -ENODEV;
> >                       if(sh->dev)
> >                               return -EBUSY;
> > -                     return shaper_attach(dev,dev->priv, them);
> > +                     return shaper_attach(dev,netdev_priv(dev), them);
> >               }
> >               case SHAPER_GET_DEV:
> >                       if(sh->dev=NULL)
> > @@ -513,7 +513,7 @@ static int shaper_ioctl(struct net_devic
> >
> >  static void shaper_init_priv(struct net_device *dev)
> >  {
> > -     struct shaper *sh = dev->priv;
> > +     struct shaper *sh = netdev_priv(dev);
> >
> >       skb_queue_head_init(&sh->sendq);
> >       init_timer(&sh->timer);
> > diff --git a/drivers/net/wan/dlci.c b/drivers/net/wan/dlci.c
> > index 66be20c..d988161 100644
> > --- a/drivers/net/wan/dlci.c
> > +++ b/drivers/net/wan/dlci.c
> > @@ -74,7 +74,7 @@ static int dlci_header(struct sk_buff *s
> >       unsigned int            hlen;
> >       char                    *dest;
> >
> > -     dlp = dev->priv;
> > +     dlp = netdev_priv(dev);
> >
> >       hdr.control = FRAD_I_UI;
> >       switch(type)
> > @@ -110,7 +110,7 @@ static void dlci_receive(struct sk_buff
> >       struct frhdr            *hdr;
> >       int                                     process, header;
> >
> > -     dlp = dev->priv;
> > +     dlp = netdev_priv(dev);
> >       if (!pskb_may_pull(skb, sizeof(*hdr))) {
> >               printk(KERN_NOTICE "%s: invalid data no header\n",
> >                      dev->name);
> > @@ -197,7 +197,7 @@ static int dlci_transmit(struct sk_buff
> >       if (!skb || !dev)
> >               return(0);
> >
> > -     dlp = dev->priv;
> > +     dlp = netdev_priv(dev);
> >
> >       netif_stop_queue(dev);
> >
> > @@ -235,7 +235,7 @@ static int dlci_config(struct net_device
> >       struct frad_local       *flp;
> >       int                     err;
> >
> > -     dlp = dev->priv;
> > +     dlp = netdev_priv(dev);
> >
> >       flp = dlp->slave->priv;
> >
> > @@ -269,7 +269,7 @@ static int dlci_dev_ioctl(struct net_dev
> >       if (!capable(CAP_NET_ADMIN))
> >               return(-EPERM);
> >
> > -     dlp = dev->priv;
> > +     dlp = netdev_priv(dev);
> >
> >       switch(cmd)
> >       {
> > @@ -298,7 +298,7 @@ static int dlci_change_mtu(struct net_de
> >  {
> >       struct dlci_local *dlp;
> >
> > -     dlp = dev->priv;
> > +     dlp = netdev_priv(dev);
> >
> >       return((*dlp->slave->change_mtu)(dlp->slave, new_mtu));
> >  }
> > @@ -309,7 +309,7 @@ static int dlci_open(struct net_device *
> >       struct frad_local       *flp;
> >       int                     err;
> >
> > -     dlp = dev->priv;
> > +     dlp = netdev_priv(dev);
> >
> >       if (!*(short *)(dev->dev_addr))
> >               return(-EINVAL);
> > @@ -335,7 +335,7 @@ static int dlci_close(struct net_device
> >
> >       netif_stop_queue(dev);
> >
> > -     dlp = dev->priv;
> > +     dlp = netdev_priv(dev);
> >
> >       flp = dlp->slave->priv;
> >       err = (*flp->deactivate)(dlp->slave, dev);
> > @@ -347,7 +347,7 @@ static struct net_device_stats *dlci_get
> >  {
> >       struct dlci_local *dlp;
> >
> > -     dlp = dev->priv;
> > +     dlp = netdev_priv(dev);
> >
> >       return(&dlp->stats);
> >  }
> > @@ -365,7 +365,7 @@ static int dlci_add(struct dlci_add *dlc
> >       if (!slave)
> >               return -ENODEV;
> >
> > -     if (slave->type != ARPHRD_FRAD || slave->priv = NULL)
> > +     if (slave->type != ARPHRD_FRAD || netdev_priv(slave) = NULL)
> >               goto err1;
> >
> >       /* create device name */
> > @@ -391,11 +391,11 @@ static int dlci_add(struct dlci_add *dlc
> >
> >       *(short *)(master->dev_addr) = dlci->dlci;
> >
> > -     dlp = (struct dlci_local *) master->priv;
> > +     dlp = netdev_priv(master);
> >       dlp->slave = slave;
> >       dlp->master = master;
> >
> > -     flp = slave->priv;
> > +     flp = netdev_priv(slave);
> >       err = (*flp->assoc)(slave, master);
> >       if (err < 0)
> >               goto err2;
> > @@ -435,9 +435,9 @@ static int dlci_del(struct dlci_add *dlc
> >               return(-EBUSY);
> >       }
> >
> > -     dlp = master->priv;
> > +     dlp = netdev_priv(master);
> >       slave = dlp->slave;
> > -     flp = slave->priv;
> > +     flp = netdev_priv(slave);
> >
> >       rtnl_lock();
> >       err = (*flp->deassoc)(slave, master);
> > @@ -487,7 +487,7 @@ static int dlci_ioctl(unsigned int cmd,
> >
> >  static void dlci_setup(struct net_device *dev)
> >  {
> > -     struct dlci_local *dlp = dev->priv;
> > +     struct dlci_local *dlp = netdev_priv(dev);
> >
> >       dev->flags              = 0;
> >       dev->open               = dlci_open;
> > diff --git a/drivers/net/wan/lmc/lmc_main.c b/drivers/net/wan/lmc/lmc_main.c
> > index 750b3ef..8c95f3d 100644
> > --- a/drivers/net/wan/lmc/lmc_main.c
> > +++ b/drivers/net/wan/lmc/lmc_main.c
> > @@ -126,7 +126,7 @@ int lmc_ioctl (struct net_device *dev, s
> >
> >      ret = -EOPNOTSUPP;
> >
> > -    sc = dev->priv;
> > +    sc = netdev_priv(dev);
> >
> >      lmc_trace(dev, "lmc_ioctl in");
> >
> > @@ -634,7 +634,7 @@ static void lmc_watchdog (unsigned long
> >      u_int32_t ticks;
> >      unsigned long flags;
> >
> > -    sc = dev->priv;
> > +    sc = netdev_priv(dev);
> >
> >      lmc_trace(dev, "lmc_watchdog in");
> >
> > @@ -872,7 +872,7 @@ #endif
> >          lmc_first_load = 1;
> >      }
> >
> > -    sc = dev->priv;
> > +    sc = netdev_priv(dev);
> >      sc->lmc_device = dev;
> >      sc->name = dev->name;
> >
> > @@ -1018,7 +1018,7 @@ static void __devexit lmc_remove_one (st
> >      struct net_device *dev = pci_get_drvdata(pdev);
> >
> >      if (dev) {
> > -         lmc_softc_t *sc = dev->priv;
> > +         lmc_softc_t *sc = netdev_priv(dev);
> >
> >           printk("%s: removing...\n", dev->name);
> >           lmc_proto_detach(sc);
> > @@ -1035,7 +1035,7 @@ static void __devexit lmc_remove_one (st
> >   */
> >  static int lmc_open (struct net_device *dev) /*fold00*/
> >  {
> > -    lmc_softc_t *sc = dev->priv;
> > +    lmc_softc_t *sc = netdev_priv(dev);
> >
> >      lmc_trace(dev, "lmc_open in");
> >
> > @@ -1153,7 +1153,7 @@ static int lmc_open (struct net_device *
> >  static void lmc_running_reset (struct net_device *dev) /*fold00*/
> >  {
> >
> > -    lmc_softc_t *sc = (lmc_softc_t *) dev->priv;
> > +    lmc_softc_t *sc = netdev_priv(dev);
> >
> >      lmc_trace(dev, "lmc_runnig_reset in");
> >
> > @@ -1194,7 +1194,7 @@ static int lmc_close (struct net_device
> >
> >      lmc_trace(dev, "lmc_close in");
> >
> > -    sc = dev->priv;
> > +    sc = netdev_priv(dev);
> >      sc->lmc_ok = 0;
> >      sc->lmc_media->set_link_status (sc, 0);
> >      del_timer (&sc->timer);
> > @@ -1210,7 +1210,7 @@ static int lmc_close (struct net_device
> >  /* When the interface goes down, this is called */
> >  static int lmc_ifdown (struct net_device *dev) /*fold00*/
> >  {
> > -    lmc_softc_t *sc = dev->priv;
> > +    lmc_softc_t *sc = netdev_priv(dev);
> >      u32 csr6;
> >      int i;
> >
> > @@ -1287,7 +1287,7 @@ static irqreturn_t lmc_interrupt (int ir
> >
> >      lmc_trace(dev, "lmc_interrupt in");
> >
> > -    sc = dev->priv;
> > +    sc = netdev_priv(dev);
> >
> >      spin_lock(&sc->lmc_lock);
> >
> > @@ -1473,7 +1473,7 @@ static int lmc_start_xmit (struct sk_buf
> >
> >      lmc_trace(dev, "lmc_start_xmit in");
> >
> > -    sc = dev->priv;
> > +    sc = netdev_priv(dev);
> >
> >      spin_lock_irqsave(&sc->lmc_lock, flags);
> >
> > @@ -1570,7 +1570,7 @@ static int lmc_rx (struct net_device *de
> >
> >      lmc_trace(dev, "lmc_rx in");
> >
> > -    sc = dev->priv;
> > +    sc = netdev_priv(dev);
> >
> >      lmc_led_on(sc, LMC_DS3_LED3);
> >
> > @@ -1764,7 +1764,7 @@ skip_out_of_mem:
> >
> >  static struct net_device_stats *lmc_get_stats (struct net_device *dev)
> > /*fold00*/
> >  {
> > -    lmc_softc_t *sc = dev->priv;
> > +    lmc_softc_t *sc = netdev_priv(dev);
> >      unsigned long flags;
> >
> >      lmc_trace(dev, "lmc_get_stats in");
> > @@ -2145,7 +2145,7 @@ static void lmc_driver_timeout(struct ne
> >
> >      lmc_trace(dev, "lmc_driver_timeout in");
> >
> > -    sc = dev->priv;
> > +    sc = netdev_priv(dev);
> >
> >      spin_lock_irqsave(&sc->lmc_lock, flags);
> >
> > diff --git a/drivers/net/wan/sdla.c b/drivers/net/wan/sdla.c
> > index 6a485f0..4cb43f4 100644
> > --- a/drivers/net/wan/sdla.c
> > +++ b/drivers/net/wan/sdla.c
> > @@ -185,7 +185,7 @@ static void sdla_stop(struct net_device
> >  {
> >       struct frad_local *flp;
> >
> > -     flp = dev->priv;
> > +     flp = netdev_priv(dev);
> >       switch(flp->type)
> >       {
> >               case SDLA_S502A:
> > @@ -212,7 +212,7 @@ static void sdla_start(struct net_device
> >  {
> >       struct frad_local *flp;
> >
> > -     flp = dev->priv;
> > +     flp = netdev_priv(dev);
> >       switch(flp->type)
> >       {
> >               case SDLA_S502A:
> > @@ -432,7 +432,7 @@ static int sdla_cmd(struct net_device *d
> >       int                      ret, waiting, len;
> >       long                     window;
> >
> > -     flp = dev->priv;
> > +     flp = netdev_priv(dev);
> >       window = flp->type = SDLA_S508 ? SDLA_508_CMD_BUF : SDLA_502_CMD_BUF;
> >       cmd_buf = (struct sdla_cmd *)(dev->mem_start + (window & SDLA_ADDR_MASK));
> >       ret = 0;
> > @@ -509,7 +509,7 @@ static int sdla_activate(struct net_devi
> >       struct frad_local *flp;
> >       int i;
> >
> > -     flp = slave->priv;
> > +     flp = netdev_priv(slave);
> >
> >       for(i=0;i<CONFIG_DLCI_MAX;i++)
> >               if (flp->master[i] = master)
> > @@ -531,7 +531,7 @@ static int sdla_deactivate(struct net_de
> >       struct frad_local *flp;
> >       int               i;
> >
> > -     flp = slave->priv;
> > +     flp = netdev_priv(slave);
> >
> >       for(i=0;i<CONFIG_DLCI_MAX;i++)
> >               if (flp->master[i] = master)
> > @@ -556,7 +556,7 @@ static int sdla_assoc(struct net_device
> >       if (master->type != ARPHRD_DLCI)
> >               return(-EINVAL);
> >
> > -     flp = slave->priv;
> > +     flp = netdev_priv(slave);
> >
> >       for(i=0;i<CONFIG_DLCI_MAX;i++)
> >       {
> > @@ -589,7 +589,7 @@ static int sdla_deassoc(struct net_devic
> >       struct frad_local *flp;
> >       int               i;
> >
> > -     flp = slave->priv;
> > +     flp = netdev_priv(slave);
> >
> >       for(i=0;i<CONFIG_DLCI_MAX;i++)
> >               if (flp->master[i] = master)
> > @@ -619,7 +619,7 @@ static int sdla_dlci_conf(struct net_dev
> >       int               i;
> >       short             len, ret;
> >
> > -     flp = slave->priv;
> > +     flp = netdev_priv(slave);
> >
> >       for(i=0;i<CONFIG_DLCI_MAX;i++)
> >               if (flp->master[i] = master)
> > @@ -628,7 +628,7 @@ static int sdla_dlci_conf(struct net_dev
> >       if (i = CONFIG_DLCI_MAX)
> >               return(-ENODEV);
> >
> > -     dlp = master->priv;
> > +     dlp = netdev_priv(master);
> >
> >       ret = SDLA_RET_OK;
> >       len = sizeof(struct dlci_conf);
> > @@ -659,7 +659,7 @@ static int sdla_transmit(struct sk_buff
> >       unsigned long     flags;
> >       struct buf_entry  *pbuf;
> >
> > -     flp = dev->priv;
> > +     flp = netdev_priv(dev);
> >       ret = 0;
> >       accept = 1;
> >
> > @@ -755,7 +755,7 @@ static void sdla_receive(struct net_devi
> >       int               i=0, received, success, addr, buf_base, buf_top;
> >       short             dlci, len, len2, split;
> >
> > -     flp = dev->priv;
> > +     flp = netdev_priv(dev);
> >       success = 1;
> >       received = addr = buf_top = buf_base = 0;
> >       len = dlci = 0;
> > @@ -860,7 +860,7 @@ static void sdla_receive(struct net_devi
> >       if (success)
> >       {
> >               flp->stats.rx_packets++;
> > -             dlp = master->priv;
> > +             dlp = netdev_priv(master);
> >               (*dlp->receive)(skb, master);
> >       }
> >
> > @@ -924,7 +924,7 @@ static void sdla_poll(unsigned long devi
> >       struct frad_local *flp;
> >
> >       dev = (struct net_device *) device;
> > -     flp = dev->priv;
> > +     flp = netdev_priv(dev);
> >
> >       if (sdla_byte(dev, SDLA_502_RCV_BUF))
> >               sdla_receive(dev);
> > @@ -940,7 +940,7 @@ static int sdla_close(struct net_device
> >       int               len, i;
> >       short             dlcis[CONFIG_DLCI_MAX];
> >
> > -     flp = dev->priv;
> > +     flp = netdev_priv(dev);
> >
> >       len = 0;
> >       for(i=0;i<CONFIG_DLCI_MAX;i++)
> > @@ -1001,7 +1001,7 @@ static int sdla_open(struct net_device *
> >       int               len, i;
> >       char              byte;
> >
> > -     flp = dev->priv;
> > +     flp = netdev_priv(dev);
> >
> >       if (!flp->initialized)
> >               return(-EPERM);
> > @@ -1098,7 +1098,7 @@ static int sdla_config(struct net_device
> >       if (dev->type = 0xFFFF)
> >               return(-EUNATCH);
> >
> > -     flp = dev->priv;
> > +     flp = netdev_priv(dev);
> >
> >       if (!get)
> >       {
> > @@ -1230,7 +1230,7 @@ static int sdla_reconfig(struct net_devi
> >       struct conf_data  data;
> >       int               i, len;
> >
> > -     flp = dev->priv;
> > +     flp = netdev_priv(dev);
> >
> >       len = 0;
> >       for(i=0;i<CONFIG_DLCI_MAX;i++)
> > @@ -1255,7 +1255,7 @@ static int sdla_ioctl(struct net_device
> >       if(!capable(CAP_NET_ADMIN))
> >               return -EPERM;
> >
> > -     flp = dev->priv;
> > +     flp = netdev_priv(dev);
> >
> >       if (!flp->initialized)
> >               return(-EINVAL);
> > @@ -1321,7 +1321,7 @@ static int sdla_change_mtu(struct net_de
> >  {
> >       struct frad_local *flp;
> >
> > -     flp = dev->priv;
> > +     flp = netdev_priv(dev);
> >
> >       if (netif_running(dev))
> >               return(-EBUSY);
> > @@ -1338,7 +1338,7 @@ static int sdla_set_config(struct net_de
> >       unsigned base;
> >       int err = -EINVAL;
> >
> > -     flp = dev->priv;
> > +     flp = netdev_priv(dev);
> >
> >       if (flp->initialized)
> >               return(-EINVAL);
> > @@ -1593,14 +1593,14 @@ fail:
> >  static struct net_device_stats *sdla_stats(struct net_device *dev)
> >  {
> >       struct frad_local *flp;
> > -     flp = dev->priv;
> > +     flp = netdev_priv(dev);
> >
> >       return(&flp->stats);
> >  }
> >
> >  static void setup_sdla(struct net_device *dev)
> >  {
> > -     struct frad_local *flp = dev->priv;
> > +     struct frad_local *flp = netdev_priv(dev);
> >
> >       netdev_boot_setup_check(dev);
> >
> > @@ -1652,7 +1652,7 @@ static int __init init_sdla(void)
> >
> >  static void __exit exit_sdla(void)
> >  {
> > -     struct frad_local *flp = sdla->priv;
> > +     struct frad_local *flp = netdev_priv(sdla);
> >
> >       unregister_netdev(sdla);
> >       if (flp->initialized) {
> > diff --git a/drivers/net/wan/sealevel.c b/drivers/net/wan/sealevel.c
> > index 1313581..e78c50b 100644
> > --- a/drivers/net/wan/sealevel.c
> > +++ b/drivers/net/wan/sealevel.c
> > @@ -77,7 +77,7 @@ static void sealevel_input(struct z8530_
> >
> >  static int sealevel_open(struct net_device *d)
> >  {
> > -     struct slvl_device *slvl=d->priv;
> > +     struct slvl_device *slvl=netdev_priv(d);
> >       int err = -1;
> >       int unit = slvl->channel;
> >
> > @@ -126,7 +126,7 @@ static int sealevel_open(struct net_devi
> >
> >  static int sealevel_close(struct net_device *d)
> >  {
> > -     struct slvl_device *slvl=d->priv;
> > +     struct slvl_device *slvl=netdev_priv(d);
> >       int unit = slvl->channel;
> >
> >       /*
> > @@ -166,7 +166,7 @@ static int sealevel_ioctl(struct net_dev
> >
> >  static struct net_device_stats *sealevel_get_stats(struct net_device *d)
> >  {
> > -     struct slvl_device *slvl=d->priv;
> > +     struct slvl_device *slvl=netdev_priv(d);
> >       if(slvl)
> >               return z8530_get_stats(slvl->chan);
> >       else
> > @@ -179,7 +179,7 @@ static struct net_device_stats *sealevel
> >
> >  static int sealevel_queue_xmit(struct sk_buff *skb, struct net_device *d)
> >  {
> > -     struct slvl_device *slvl=d->priv;
> > +     struct slvl_device *slvl=netdev_priv(d);
> >       return z8530_queue_xmit(slvl->chan, skb);
> >  }
> >
> > @@ -204,7 +204,7 @@ static int sealevel_neigh_setup_dev(stru
> >
> >  static int sealevel_attach(struct net_device *dev)
> >  {
> > -     struct slvl_device *sv = dev->priv;
> > +     struct slvl_device *sv = netdev_priv(dev);
> >       sppp_attach(&sv->pppdev);
> >       return 0;
> >  }
> > @@ -240,7 +240,7 @@ static inline struct slvl_device *slvl_a
> >       if (!d)
> >               return NULL;
> >
> > -     sv = d->priv;
> > +     sv = netdev_priv(d);
> >       sv->if_ptr = &sv->pppdev;
> >       sv->pppdev.dev = d;
> >       d->base_addr = iobase;
> > diff --git a/drivers/net/wan/x25_asy.c b/drivers/net/wan/x25_asy.c
> > index 1c9edd9..9dbf21a 100644
> > --- a/drivers/net/wan/x25_asy.c
> > +++ b/drivers/net/wan/x25_asy.c
> > @@ -63,7 +63,7 @@ static struct x25_asy *x25_asy_alloc(voi
> >               if (dev = NULL)
> >                       break;
> >
> > -             sl = dev->priv;
> > +             sl = netdev_priv(dev);
> >               /* Not in use ? */
> >               if (!test_and_set_bit(SLF_INUSE, &sl->flags))
> >                       return sl;
> > @@ -85,7 +85,7 @@ static struct x25_asy *x25_asy_alloc(voi
> >                       return NULL;
> >
> >               /* Initialize channel control data */
> > -             sl = dev->priv;
> > +             sl = netdev_priv(dev);
> >               dev->base_addr    = i;
> >
> >               /* register device so that it can be ifconfig'ed       */
> > @@ -119,7 +119,7 @@ static void x25_asy_free(struct x25_asy
> >
> >  static int x25_asy_change_mtu(struct net_device *dev, int newmtu)
> >  {
> > -     struct x25_asy *sl = dev->priv;
> > +     struct x25_asy *sl = netdev_priv(dev);
> >       unsigned char *xbuff, *rbuff;
> >       int len = 2* newmtu;
> >
> > @@ -282,7 +282,7 @@ static void x25_asy_write_wakeup(struct
> >
> >  static void x25_asy_timeout(struct net_device *dev)
> >  {
> > -     struct x25_asy *sl = (struct x25_asy*)(dev->priv);
> > +     struct x25_asy *sl = (struct x25_asy*)(netdev_priv(dev));
> >
> >       spin_lock(&sl->lock);
> >       if (netif_queue_stopped(dev)) {
> > @@ -303,7 +303,7 @@ static void x25_asy_timeout(struct net_d
> >
> >  static int x25_asy_xmit(struct sk_buff *skb, struct net_device *dev)
> >  {
> > -     struct x25_asy *sl = (struct x25_asy*)(dev->priv);
> > +     struct x25_asy *sl = (struct x25_asy*)(netdev_priv(dev));
> >       int err;
> >
> >       if (!netif_running(sl->dev)) {
> > @@ -372,7 +372,7 @@ static int x25_asy_data_indication(struc
> >
> >  static void x25_asy_data_transmit(struct net_device *dev, struct sk_buff
> > *skb)
> >  {
> > -     struct x25_asy *slÞv->priv;
> > +     struct x25_asy *sl=netdev_priv(dev);
> >
> >       spin_lock(&sl->lock);
> >       if (netif_queue_stopped(sl->dev) || sl->tty = NULL)
> > @@ -399,7 +399,7 @@ static void x25_asy_data_transmit(struct
> >
> >  static void x25_asy_connected(struct net_device *dev, int reason)
> >  {
> > -     struct x25_asy *sl = dev->priv;
> > +     struct x25_asy *sl = netdev_priv(dev);
> >       struct sk_buff *skb;
> >       unsigned char *ptr;
> >
> > @@ -418,7 +418,7 @@ static void x25_asy_connected(struct net
> >
> >  static void x25_asy_disconnected(struct net_device *dev, int reason)
> >  {
> > -     struct x25_asy *sl = dev->priv;
> > +     struct x25_asy *sl = netdev_priv(dev);
> >       struct sk_buff *skb;
> >       unsigned char *ptr;
> >
> > @@ -449,7 +449,7 @@ static struct lapb_register_struct x25_a
> >  /* Open the low-level part of the X.25 channel. Easy! */
> >  static int x25_asy_open(struct net_device *dev)
> >  {
> > -     struct x25_asy *sl = (struct x25_asy*)(dev->priv);
> > +     struct x25_asy *sl = (struct x25_asy*)(netdev_priv(dev));
> >       unsigned long len;
> >       int err;
> >
> > @@ -499,7 +499,7 @@ norbuff:
> >  /* Close the low-level part of the X.25 channel. Easy! */
> >  static int x25_asy_close(struct net_device *dev)
> >  {
> > -     struct x25_asy *sl = (struct x25_asy*)(dev->priv);
> > +     struct x25_asy *sl = (struct x25_asy*)(netdev_priv(dev));
> >       int err;
> >
> >       spin_lock(&sl->lock);
> > @@ -615,7 +615,7 @@ static void x25_asy_close_tty(struct tty
> >
> >  static struct net_device_stats *x25_asy_get_stats(struct net_device *dev)
> >  {
> > -     struct x25_asy *sl = (struct x25_asy*)(dev->priv);
> > +     struct x25_asy *sl = (struct x25_asy*)(netdev_priv(dev));
> >
> >       return &sl->stats;
> >  }
> > @@ -730,7 +730,7 @@ static int x25_asy_ioctl(struct tty_stru
> >
> >  static int x25_asy_open_dev(struct net_device *dev)
> >  {
> > -     struct x25_asy *sl = (struct x25_asy*)(dev->priv);
> > +     struct x25_asy *sl = (struct x25_asy*)(netdev_priv(dev));
> >       if(sl->tty=NULL)
> >               return -ENODEV;
> >       return 0;
> > @@ -739,7 +739,7 @@ static int x25_asy_open_dev(struct net_d
> >  /* Initialise the X.25 driver.  Called by the device init code */
> >  static void x25_asy_setup(struct net_device *dev)
> >  {
> > -     struct x25_asy *sl = dev->priv;
> > +     struct x25_asy *sl = netdev_priv(dev);
> >
> >       sl->magic  = X25_ASY_MAGIC;
> >       sl->dev    = dev;
> > @@ -807,7 +807,7 @@ static void __exit exit_x25_asy(void)
> >       for (i = 0; i < x25_asy_maxdev; i++) {
> >               dev = x25_asy_devs[i];
> >               if (dev) {
> > -                     struct x25_asy *sl = dev->priv;
> > +                     struct x25_asy *sl = netdev_priv(dev);
> >
> >                       spin_lock_bh(&sl->lock);
> >                       if (sl->tty)
> > diff --git a/drivers/net/wireless/strip.c b/drivers/net/wireless/strip.c
> > index ef32a5c..ed146ae 100644
> > --- a/drivers/net/wireless/strip.c
> > +++ b/drivers/net/wireless/strip.c
> > @@ -2571,7 +2571,7 @@ static struct strip *strip_alloc(void)
> >               return NULL;    /* If no more memory, return */
> >
> >
> > -     strip_info = dev->priv;
> > +     strip_info = netdev_priv(dev);
> >       strip_info->dev = dev;
> >
> >       strip_info->magic = STRIP_MAGIC;
> >
> > -
> > To unsubscribe from this list: send the line "unsubscribe kernel-janitors"
> > in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> >
> -
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>


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

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: netdev_priv()
  2007-07-18 22:24 netdev_priv() Thomas Surrel
                   ` (12 preceding siblings ...)
  2007-07-19 15:22 ` netdev_priv() pradeep singh
@ 2007-07-19 15:35 ` Yoann Padioleau
  2007-07-19 15:57 ` netdev_priv() Thomas Surrel
                   ` (3 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: Yoann Padioleau @ 2007-07-19 15:35 UTC (permalink / raw)
  To: kernel-janitors

"Thomas Surrel" <thomas.surrel@gmail.com> writes:

>>
>> Yes, I can apply my simpler semantic patch on the file you
>> have clearly identified as "safe" to do the transformation.
>
> Your simple semantic patch is not convering all the cases. 

Here is the simple SP 

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

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

@@
struct net_device *dev;
@@

- dev->priv
+ netdev_priv(dev)



> Some driver
> don't make the access with dev->priv, it can be
> my_own_private_netdevice->priv. 

You mean that the name of the variable change ? But
my semantic path, or more precisly the transformation tool
handles that (unless my_own_private_netdevice has not
the struct net_device*  type in which case you are right). 
I have written 'dev' in the semantic patch but it's a "metavariable".

In fact if you look at one the patch my transformation tool has
generated, there is one such example: 

 static int bond_ioctl_change_active(struct net_device *bond_dev, struct net_device *slave_dev)
 {
-	struct bonding *bond = bond_dev->priv;
+	struct bonding *bond = netdev_priv(bond_dev);
 	struct slave *old_active = NULL;
 	struct slave *new_active = NULL;
 	int res = 0;



> So we would still need to check behind
> you patch, which is not far from doing manually, unfortunately ...
>
>>
>> The only thing is that I would like also to automate the
>> identification part where you know when it's safe or not. 

I think I have found why I was too restrictive. Some people
use alloc_etherdev which calls alloc_netdev. So I just
have to relax the condition. There are multiple "alias" 
to alloc_netdev.


> How do you
>> know that for instance it's safe to replace the dev->priv by
>> netpriv(dev) in airo.c ? How do you know the private structure is
>> allocated behind the struct netdevice ?
>>
>> in airo.c there is
>>
>> static struct net_device *init_wifidev(struct airo_info *ai,
>>                                        struct net_device *ethdev)
>> {
>>        int err;
>>        struct net_device *dev = alloc_netdev(0, "wifi%d", wifi_setup);
>>        if (!dev)
>>                return NULL;
>>        dev->priv = ethdev->priv;
>>        dev->irq = ethdev->irq;
>>        dev->base_addr = ethdev->base_addr;
>>        dev->wireless_data = ethdev->wireless_data;
>>        memcpy(dev->dev_addr, ethdev->dev_addr, dev->addr_len);
>>        err = register_netdev(dev);
>>        if (err<0) {
>>                free_netdev(dev);
>>                return NULL;
>>        }
>>        return dev;
>> }
>>
>>
>> So it does not look dev->priv is behind the freshly allocated
>> alloc_netdev.
>
> Indeed, not in that location, but you also have:
> static struct net_device *_init_airo_card( unsigned short irq, int port,
> 					   int is_pcmcia, struct pci_dev *pci,
> 					   struct device *dmdev )
> {
> 	struct net_device *dev;
> 	struct airo_info *ai;
> 	int i, rc;
>
> 	/* Create the network device object. */
> 	dev = alloc_etherdev(sizeof(*ai));
> 	 if (!dev) {
> 		airo_print_err("", "Couldn't alloc_etherdev");
> 		return NULL;
> 	}
> 	if (dev_alloc_name(dev, dev->name) < 0) {
> 		airo_print_err("", "Couldn't get name!");
> 		goto err_out_free;
> 	}
>
> 	ai = dev->priv;
>
> In that case again, autmating the process is not easy at all.

Maybe

> Your patch is indeed missing some needed changes. I had a look in
> drivers/net/wireless only, and it appears that the following drivers
> would need to be worked on as well:
> airo
> arlan
> hostap
> prism54
> ray_cs
> wavelan
> wl3501

With my updated semantic patch, where I relax the condition, where I
try to find both alloc_netdev and alloc_etherdev, I can now transform
(I think safely)
  ray_cs, 
  wl3501_cs, 
  strip.c 
in drivers/net/wireless

For some of the rest, the driver is splitted in multiple files
and my tool does not handle that well unless you specify on the
command line the list of files that must be treated together.

With that list of file specification, I can safely 
transform hostap/*, 

For airo my tool does not still accept because of the presence
of a dev->priv = E;  somewhere in the file.
For wavelan I don't know.

And finally for arlan and prism54, the transformation seems to 
have been already applied.




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

(
 dev = alloc_netdev(sizeof(T), ...)
|
 dev = alloc_etherdev(sizeof(T))
|
 dev = alloc_netdev(sizeof(*x), ...)
|
 dev = alloc_etherdev(sizeof(*x))
)


@ 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)


@ rule3 depends on rule1 && !rule1bis @
struct net_device *dev;
@@

- dev->priv
+ netdev_priv(dev)









And here is the patch generated: 



 hostap/hostap_cs.c    |    2 -
 hostap/hostap_hw.c    |    2 -
 hostap/hostap_ioctl.c |   14 +++++-----
 ray_cs.c              |   66 +++++++++++++++++++++++++-------------------------
 strip.c               |    2 -
 wl3501_cs.c           |   66 +++++++++++++++++++++++++-------------------------
 6 files changed, 76 insertions(+), 76 deletions(-)



diff --git a/drivers/net/wireless/hostap/hostap_cs.c b/drivers/net/wireless/hostap/hostap_cs.c
index 30e723f..f9cf22b 100644
--- a/drivers/net/wireless/hostap/hostap_cs.c
+++ b/drivers/net/wireless/hostap/hostap_cs.c
@@ -272,7 +272,7 @@ static int sandisk_enable_wireless(struc
 {
 	int res, ret = 0;
 	conf_reg_t reg;
-	struct hostap_interface *iface = dev->priv;
+	struct hostap_interface *iface = netdev_priv(dev);
 	local_info_t *local = iface->local;
 	tuple_t tuple;
 	cisparse_t *parse = NULL;
diff --git a/drivers/net/wireless/hostap/hostap_hw.c b/drivers/net/wireless/hostap/hostap_hw.c
index 959887b..18023b5 100644
--- a/drivers/net/wireless/hostap/hostap_hw.c
+++ b/drivers/net/wireless/hostap/hostap_hw.c
@@ -3424,7 +3424,7 @@ static void prism2_suspend(struct net_de
 	struct local_info *local;
 	union iwreq_data wrqu;
 
-	iface = dev->priv;
+	iface = netdev_priv(dev);
 	local = iface->local;
 
 	/* Send disconnect event, e.g., to trigger reassociation after resume
diff --git a/drivers/net/wireless/hostap/hostap_ioctl.c b/drivers/net/wireless/hostap/hostap_ioctl.c
index 8c71077..d58ac84 100644
--- a/drivers/net/wireless/hostap/hostap_ioctl.c
+++ b/drivers/net/wireless/hostap/hostap_ioctl.c
@@ -3088,7 +3088,7 @@ #endif /* PRISM2_DOWNLOAD_SUPPORT */
 static int prism2_set_genericelement(struct net_device *dev, u8 *elem,
 				     size_t len)
 {
-	struct hostap_interface *iface = dev->priv;
+	struct hostap_interface *iface = netdev_priv(dev);
 	local_info_t *local = iface->local;
 	u8 *buf;
 
@@ -3116,7 +3116,7 @@ static int prism2_ioctl_siwauth(struct n
 				struct iw_request_info *info,
 				struct iw_param *data, char *extra)
 {
-	struct hostap_interface *iface = dev->priv;
+	struct hostap_interface *iface = netdev_priv(dev);
 	local_info_t *local = iface->local;
 
 	switch (data->flags & IW_AUTH_INDEX) {
@@ -3182,7 +3182,7 @@ static int prism2_ioctl_giwauth(struct n
 				struct iw_request_info *info,
 				struct iw_param *data, char *extra)
 {
-	struct hostap_interface *iface = dev->priv;
+	struct hostap_interface *iface = netdev_priv(dev);
 	local_info_t *local = iface->local;
 
 	switch (data->flags & IW_AUTH_INDEX) {
@@ -3221,7 +3221,7 @@ static int prism2_ioctl_siwencodeext(str
 				     struct iw_request_info *info,
 				     struct iw_point *erq, char *extra)
 {
-	struct hostap_interface *iface = dev->priv;
+	struct hostap_interface *iface = netdev_priv(dev);
 	local_info_t *local = iface->local;
 	struct iw_encode_ext *ext = (struct iw_encode_ext *) extra;
 	int i, ret = 0;
@@ -3395,7 +3395,7 @@ static int prism2_ioctl_giwencodeext(str
 				     struct iw_request_info *info,
 				     struct iw_point *erq, char *extra)
 {
-	struct hostap_interface *iface = dev->priv;
+	struct hostap_interface *iface = netdev_priv(dev);
 	local_info_t *local = iface->local;
 	struct ieee80211_crypt_data **crypt;
 	void *sta_ptr;
@@ -3716,7 +3716,7 @@ static int prism2_ioctl_giwgenie(struct 
 				 struct iw_request_info *info,
 				 struct iw_point *data, char *extra)
 {
-	struct hostap_interface *iface = dev->priv;
+	struct hostap_interface *iface = netdev_priv(dev);
 	local_info_t *local = iface->local;
 	int len = local->generic_elem_len - 2;
 
@@ -3755,7 +3755,7 @@ static int prism2_ioctl_siwmlme(struct n
 				struct iw_request_info *info,
 				struct iw_point *data, char *extra)
 {
-	struct hostap_interface *iface = dev->priv;
+	struct hostap_interface *iface = netdev_priv(dev);
 	local_info_t *local = iface->local;
 	struct iw_mlme *mlme = (struct iw_mlme *) extra;
 	u16 reason;
diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c
index cbe9bf8..83fbb08 100644
--- a/drivers/net/wireless/ray_cs.c
+++ b/drivers/net/wireless/ray_cs.c
@@ -314,7 +314,7 @@ static int ray_probe(struct pcmcia_devic
     if (!dev)
 	    goto fail_alloc_dev;
 
-    local = dev->priv;
+    local = netdev_priv(dev);
     local->finder = p_dev;
 
     /* The io structure describes IO port mapping. None used here */
@@ -388,7 +388,7 @@ static void ray_detach(struct pcmcia_dev
 
     ray_release(link);
 
-    local = (ray_dev_t *)dev->priv;
+    local = netdev_priv(dev);
     del_timer(&local->timer);
 
     if (link->priv) {
@@ -412,7 +412,7 @@ static int ray_config(struct pcmcia_devi
     win_req_t req;
     memreq_t mem;
     struct net_device *dev = (struct net_device *)link->priv;
-    ray_dev_t *local = (ray_dev_t *)dev->priv;
+    ray_dev_t *local = netdev_priv(dev);
 
     DEBUG(1, "ray_config(0x%p)\n", link);
 
@@ -520,7 +520,7 @@ static int ray_init(struct net_device *d
     int i;
     UCHAR *p;
     struct ccs __iomem *pccs;
-    ray_dev_t *local = (ray_dev_t *)dev->priv;
+    ray_dev_t *local = netdev_priv(dev);
     struct pcmcia_device *link = local->finder;
     DEBUG(1, "ray_init(0x%p)\n", dev);
     if (!(pcmcia_dev_present(link))) {
@@ -581,7 +581,7 @@ static int ray_init(struct net_device *d
 static int dl_startup_params(struct net_device *dev)
 {
     int ccsindex;
-    ray_dev_t *local = (ray_dev_t *)dev->priv;
+    ray_dev_t *local = netdev_priv(dev);
     struct ccs __iomem *pccs;
     struct pcmcia_device *link = local->finder;
 
@@ -786,7 +786,7 @@ static void join_net(u_long data)
 static void ray_release(struct pcmcia_device *link)
 {
     struct net_device *dev = link->priv; 
-    ray_dev_t *local = dev->priv;
+    ray_dev_t *local = netdev_priv(dev);
     int i;
     
     DEBUG(1, "ray_release(0x%p)\n", link);
@@ -834,7 +834,7 @@ int ray_dev_init(struct net_device *dev)
 #ifdef RAY_IMMEDIATE_INIT
     int i;
 #endif	/* RAY_IMMEDIATE_INIT */
-    ray_dev_t *local = dev->priv;
+    ray_dev_t *local = netdev_priv(dev);
     struct pcmcia_device *link = local->finder;
 
     DEBUG(1,"ray_dev_init(dev=%p)\n",dev);
@@ -868,7 +868,7 @@ #endif	/* RAY_IMMEDIATE_INIT */
 /*======================================*/
 static int ray_dev_config(struct net_device *dev, struct ifmap *map)
 {
-    ray_dev_t *local = dev->priv;
+    ray_dev_t *local = netdev_priv(dev);
     struct pcmcia_device *link = local->finder;
     /* Dummy routine to satisfy device structure */
     DEBUG(1,"ray_dev_config(dev=%p,ifmap=%p)\n",dev,map);
@@ -882,7 +882,7 @@ static int ray_dev_config(struct net_dev
 /*======================================*/
 static int ray_dev_start_xmit(struct sk_buff *skb, struct net_device *dev)
 {
-    ray_dev_t *local = dev->priv;
+    ray_dev_t *local = netdev_priv(dev);
     struct pcmcia_device *link = local->finder;
     short length = skb->len;
 
@@ -925,7 +925,7 @@ static int ray_dev_start_xmit(struct sk_
 static int ray_hw_xmit(unsigned char* data, int len, struct net_device* dev, 
                 UCHAR msg_type)
 {
-    ray_dev_t *local = (ray_dev_t *)dev->priv;
+    ray_dev_t *local = netdev_priv(dev);
     struct ccs __iomem *pccs;
     int ccsindex;
     int offset;
@@ -1099,7 +1099,7 @@ static int ray_set_freq(struct net_devic
 			struct iw_freq *fwrq,
 			char *extra)
 {
-	ray_dev_t *local = (ray_dev_t *)dev->priv;
+	ray_dev_t *local = netdev_priv(dev);
 	int err = -EINPROGRESS;		/* Call commit handler */
 
 	/* Reject if card is already initialised */
@@ -1124,7 +1124,7 @@ static int ray_get_freq(struct net_devic
 			struct iw_freq *fwrq,
 			char *extra)
 {
-	ray_dev_t *local = (ray_dev_t *)dev->priv;
+	ray_dev_t *local = netdev_priv(dev);
 
 	fwrq->m = local->sparm.b5.a_hop_pattern;
 	fwrq->e = 0;
@@ -1140,7 +1140,7 @@ static int ray_set_essid(struct net_devi
 			 struct iw_point *dwrq,
 			 char *extra)
 {
-	ray_dev_t *local = (ray_dev_t *)dev->priv;
+	ray_dev_t *local = netdev_priv(dev);
 
 	/* Reject if card is already initialised */
 	if(local->card_status != CARD_AWAITING_PARAM)
@@ -1173,7 +1173,7 @@ static int ray_get_essid(struct net_devi
 			 struct iw_point *dwrq,
 			 char *extra)
 {
-	ray_dev_t *local = (ray_dev_t *)dev->priv;
+	ray_dev_t *local = netdev_priv(dev);
 
 	/* Get the essid that was set */
 	memcpy(extra, local->sparm.b5.a_current_ess_id, IW_ESSID_MAX_SIZE);
@@ -1194,7 +1194,7 @@ static int ray_get_wap(struct net_device
 			struct sockaddr *awrq,
 			char *extra)
 {
-	ray_dev_t *local = (ray_dev_t *)dev->priv;
+	ray_dev_t *local = netdev_priv(dev);
 
 	memcpy(awrq->sa_data, local->bss_id, ETH_ALEN);
 	awrq->sa_family = ARPHRD_ETHER;
@@ -1211,7 +1211,7 @@ static int ray_set_rate(struct net_devic
 			struct iw_param *vwrq,
 			char *extra)
 {
-	ray_dev_t *local = (ray_dev_t *)dev->priv;
+	ray_dev_t *local = netdev_priv(dev);
 
 	/* Reject if card is already initialised */
 	if(local->card_status != CARD_AWAITING_PARAM)
@@ -1240,7 +1240,7 @@ static int ray_get_rate(struct net_devic
 			struct iw_param *vwrq,
 			char *extra)
 {
-	ray_dev_t *local = (ray_dev_t *)dev->priv;
+	ray_dev_t *local = netdev_priv(dev);
 
 	if(local->net_default_tx_rate = 3)
 		vwrq->value = 2000000;		/* Hum... */
@@ -1260,7 +1260,7 @@ static int ray_set_rts(struct net_device
 		       struct iw_param *vwrq,
 		       char *extra)
 {
-	ray_dev_t *local = (ray_dev_t *)dev->priv;
+	ray_dev_t *local = netdev_priv(dev);
 	int rthr = vwrq->value;
 
 	/* Reject if card is already initialised */
@@ -1290,7 +1290,7 @@ static int ray_get_rts(struct net_device
 		       struct iw_param *vwrq,
 		       char *extra)
 {
-	ray_dev_t *local = (ray_dev_t *)dev->priv;
+	ray_dev_t *local = netdev_priv(dev);
 
 	vwrq->value = (local->sparm.b5.a_rts_threshold[0] << 8)
 		+ local->sparm.b5.a_rts_threshold[1];
@@ -1309,7 +1309,7 @@ static int ray_set_frag(struct net_devic
 			struct iw_param *vwrq,
 			char *extra)
 {
-	ray_dev_t *local = (ray_dev_t *)dev->priv;
+	ray_dev_t *local = netdev_priv(dev);
 	int fthr = vwrq->value;
 
 	/* Reject if card is already initialised */
@@ -1338,7 +1338,7 @@ static int ray_get_frag(struct net_devic
 			struct iw_param *vwrq,
 			char *extra)
 {
-	ray_dev_t *local = (ray_dev_t *)dev->priv;
+	ray_dev_t *local = netdev_priv(dev);
 
 	vwrq->value = (local->sparm.b5.a_frag_threshold[0] << 8)
 		+ local->sparm.b5.a_frag_threshold[1];
@@ -1357,7 +1357,7 @@ static int ray_set_mode(struct net_devic
 			__u32 *uwrq,
 			char *extra)
 {
-	ray_dev_t *local = (ray_dev_t *)dev->priv;
+	ray_dev_t *local = netdev_priv(dev);
 	int err = -EINPROGRESS;		/* Call commit handler */
 	char card_mode = 1;
 
@@ -1389,7 +1389,7 @@ static int ray_get_mode(struct net_devic
 			__u32 *uwrq,
 			char *extra)
 {
-	ray_dev_t *local = (ray_dev_t *)dev->priv;
+	ray_dev_t *local = netdev_priv(dev);
 
 	if(local->sparm.b5.a_network_type)
 		*uwrq = IW_MODE_INFRA;
@@ -1492,7 +1492,7 @@ static int ray_commit(struct net_device 
  */
 static iw_stats * ray_get_wireless_stats(struct net_device *	dev)
 {
-  ray_dev_t *	local = (ray_dev_t *) dev->priv;
+  ray_dev_t *	local = netdev_priv(dev);
   struct pcmcia_device *link = local->finder;
   struct status __iomem *p = local->sram + STATUS_BASE;
 
@@ -1580,7 +1580,7 @@ static const struct iw_handler_def	ray_h
 /*======================================*/
 static int ray_open(struct net_device *dev)
 {
-    ray_dev_t *local = (ray_dev_t *)dev->priv;
+    ray_dev_t *local = netdev_priv(dev);
     struct pcmcia_device *link;
     link = local->finder;
     
@@ -1614,7 +1614,7 @@ static int ray_open(struct net_device *d
 /*======================================*/
 static int ray_dev_close(struct net_device *dev)
 {
-    ray_dev_t *local = (ray_dev_t *)dev->priv;
+    ray_dev_t *local = netdev_priv(dev);
     struct pcmcia_device *link;
     link = local->finder;
 
@@ -1773,7 +1773,7 @@ static int parse_addr(char *in_str, UCHA
 /*======================================*/
 static struct net_device_stats *ray_get_stats(struct net_device *dev)
 {
-    ray_dev_t *local = (ray_dev_t *)dev->priv;
+    ray_dev_t *local = netdev_priv(dev);
     struct pcmcia_device *link = local->finder;
     struct status __iomem *p = local->sram + STATUS_BASE;
     if (!(pcmcia_dev_present(link))) {
@@ -1803,7 +1803,7 @@ static struct net_device_stats *ray_get_
 /*======================================*/
 static void ray_update_parm(struct net_device *dev, UCHAR objid, UCHAR *value, int len)
 {
-    ray_dev_t *local = (ray_dev_t *)dev->priv;
+    ray_dev_t *local = netdev_priv(dev);
     struct pcmcia_device *link = local->finder;
     int ccsindex;
     int i;
@@ -1840,7 +1840,7 @@ static void ray_update_multi_list(struct
     int ccsindex;
     struct ccs __iomem *pccs;
     int i = 0;
-    ray_dev_t *local = (ray_dev_t *)dev->priv;
+    ray_dev_t *local = netdev_priv(dev);
     struct pcmcia_device *link = local->finder;
     void __iomem *p = local->sram + HOST_TO_ECF_BASE;
 
@@ -1884,7 +1884,7 @@ static void ray_update_multi_list(struct
 /*======================================*/
 static void set_multicast_list(struct net_device *dev)
 {
-    ray_dev_t *local = (ray_dev_t *)dev->priv;
+    ray_dev_t *local = netdev_priv(dev);
     UCHAR promisc;
 
     DEBUG(2,"ray_cs set_multicast_list(%p)\n",dev);
@@ -1935,7 +1935,7 @@ static irqreturn_t ray_interrupt(int irq
 
     DEBUG(4,"ray_cs: interrupt for *dev=%p\n",dev);
 
-    local = (ray_dev_t *)dev->priv;
+    local = netdev_priv(dev);
     link = (struct pcmcia_device *)local->finder;
     if (!pcmcia_dev_present(link)) {
         DEBUG(2,"ray_cs interrupt from device not present or suspended.\n");
@@ -2165,7 +2165,7 @@ static void rx_data(struct net_device *d
 {
     struct sk_buff *skb = NULL;
     struct rcs __iomem *prcslink = prcs;
-    ray_dev_t *local = dev->priv;
+    ray_dev_t *local = netdev_priv(dev);
     UCHAR *rx_ptr;
     int total_len;
     int tmp;
@@ -2618,7 +2618,7 @@ static int ray_cs_proc_read(char *buf, c
     dev = (struct net_device *)link->priv;
     if (!dev)
     	return 0;
-    local = (ray_dev_t *)dev->priv;
+    local = netdev_priv(dev);
     if (!local)
     	return 0;
 
diff --git a/drivers/net/wireless/strip.c b/drivers/net/wireless/strip.c
index ef32a5c..ed146ae 100644
--- a/drivers/net/wireless/strip.c
+++ b/drivers/net/wireless/strip.c
@@ -2571,7 +2571,7 @@ static struct strip *strip_alloc(void)
 		return NULL;	/* If no more memory, return */
 
 
-	strip_info = dev->priv;
+	strip_info = netdev_priv(dev);
 	strip_info->dev = dev;
 
 	strip_info->magic = STRIP_MAGIC;
diff --git a/drivers/net/wireless/wl3501_cs.c b/drivers/net/wireless/wl3501_cs.c
index c8b5c22..72f3d97 100644
--- a/drivers/net/wireless/wl3501_cs.c
+++ b/drivers/net/wireless/wl3501_cs.c
@@ -859,7 +859,7 @@ static int wl3501_esbq_confirm(struct wl
 
 static void wl3501_online(struct net_device *dev)
 {
-	struct wl3501_card *this = dev->priv;
+	struct wl3501_card *this = netdev_priv(dev);
 
 	printk(KERN_INFO "%s: Wireless LAN online. BSSID: "
 	       "%02X %02X %02X %02X %02X %02X\n", dev->name,
@@ -907,7 +907,7 @@ static int wl3501_mgmt_association(struc
 
 static void wl3501_mgmt_join_confirm(struct net_device *dev, u16 addr)
 {
-	struct wl3501_card *this = dev->priv;
+	struct wl3501_card *this = netdev_priv(dev);
 	struct wl3501_join_confirm sig;
 
 	dprintk(3, "entry");
@@ -1046,7 +1046,7 @@ static inline void wl3501_start_confirm_
 static inline void wl3501_assoc_confirm_interrupt(struct net_device *dev,
 						  u16 addr)
 {
-	struct wl3501_card *this = dev->priv;
+	struct wl3501_card *this = netdev_priv(dev);
 	struct wl3501_assoc_confirm sig;
 
 	dprintk(3, "entry");
@@ -1075,7 +1075,7 @@ static inline void wl3501_rx_interrupt(s
 	int morepkts;
 	u16 addr;
 	u8 sig_id;
-	struct wl3501_card *this = dev->priv;
+	struct wl3501_card *this = netdev_priv(dev);
 
 	dprintk(3, "entry");
 loop:
@@ -1257,7 +1257,7 @@ fail:
 
 static int wl3501_close(struct net_device *dev)
 {
-	struct wl3501_card *this = dev->priv;
+	struct wl3501_card *this = netdev_priv(dev);
 	int rc = -ENODEV;
 	unsigned long flags;
 	struct pcmcia_device *link;
@@ -1289,7 +1289,7 @@ static int wl3501_close(struct net_devic
  */
 static int wl3501_reset(struct net_device *dev)
 {
-	struct wl3501_card *this = dev->priv;
+	struct wl3501_card *this = netdev_priv(dev);
 	int rc = -ENODEV;
 
 	wl3501_block_interrupt(this);
@@ -1318,7 +1318,7 @@ out:
 
 static void wl3501_tx_timeout(struct net_device *dev)
 {
-	struct wl3501_card *this = dev->priv;
+	struct wl3501_card *this = netdev_priv(dev);
 	struct net_device_stats *stats = &this->stats;
 	unsigned long flags;
 	int rc;
@@ -1344,7 +1344,7 @@ static void wl3501_tx_timeout(struct net
 static int wl3501_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
 {
 	int enabled, rc;
-	struct wl3501_card *this = dev->priv;
+	struct wl3501_card *this = netdev_priv(dev);
 	unsigned long flags;
 
 	spin_lock_irqsave(&this->lock, flags);
@@ -1371,7 +1371,7 @@ static int wl3501_hard_start_xmit(struct
 static int wl3501_open(struct net_device *dev)
 {
 	int rc = -ENODEV;
-	struct wl3501_card *this = dev->priv;
+	struct wl3501_card *this = netdev_priv(dev);
 	unsigned long flags;
 	struct pcmcia_device *link;
 	link = this->p_dev;
@@ -1410,14 +1410,14 @@ fail:
 
 static struct net_device_stats *wl3501_get_stats(struct net_device *dev)
 {
-	struct wl3501_card *this = dev->priv;
+	struct wl3501_card *this = netdev_priv(dev);
 
 	return &this->stats;
 }
 
 static struct iw_statistics *wl3501_get_wireless_stats(struct net_device *dev)
 {
-	struct wl3501_card *this = dev->priv;
+	struct wl3501_card *this = netdev_priv(dev);
 	struct iw_statistics *wstats = &this->wstats;
 	u32 value; /* size checked: it is u32 */
 
@@ -1497,7 +1497,7 @@ static int wl3501_get_name(struct net_de
 static int wl3501_set_freq(struct net_device *dev, struct iw_request_info *info,
 			   union iwreq_data *wrqu, char *extra)
 {
-	struct wl3501_card *this = dev->priv;
+	struct wl3501_card *this = netdev_priv(dev);
 	int channel = wrqu->freq.m;
 	int rc = -EINVAL;
 
@@ -1511,7 +1511,7 @@ static int wl3501_set_freq(struct net_de
 static int wl3501_get_freq(struct net_device *dev, struct iw_request_info *info,
 			   union iwreq_data *wrqu, char *extra)
 {
-	struct wl3501_card *this = dev->priv;
+	struct wl3501_card *this = netdev_priv(dev);
 
 	wrqu->freq.m = wl3501_chan2freq[this->chan - 1] * 100000;
 	wrqu->freq.e = 1;
@@ -1526,7 +1526,7 @@ static int wl3501_set_mode(struct net_de
 	if (wrqu->mode = IW_MODE_INFRA ||
 	    wrqu->mode = IW_MODE_ADHOC ||
 	    wrqu->mode = IW_MODE_AUTO) {
-		struct wl3501_card *this = dev->priv;
+		struct wl3501_card *this = netdev_priv(dev);
 
 		this->net_type = wrqu->mode;
 		rc = wl3501_reset(dev);
@@ -1537,7 +1537,7 @@ static int wl3501_set_mode(struct net_de
 static int wl3501_get_mode(struct net_device *dev, struct iw_request_info *info,
 			   union iwreq_data *wrqu, char *extra)
 {
-	struct wl3501_card *this = dev->priv;
+	struct wl3501_card *this = netdev_priv(dev);
 
 	wrqu->mode = this->net_type;
 	return 0;
@@ -1546,7 +1546,7 @@ static int wl3501_get_mode(struct net_de
 static int wl3501_get_sens(struct net_device *dev, struct iw_request_info *info,
 			   union iwreq_data *wrqu, char *extra)
 {
-	struct wl3501_card *this = dev->priv;
+	struct wl3501_card *this = netdev_priv(dev);
 
 	wrqu->sens.value = this->rssi;
 	wrqu->sens.disabled = !wrqu->sens.value;
@@ -1577,7 +1577,7 @@ static int wl3501_get_range(struct net_d
 static int wl3501_set_wap(struct net_device *dev, struct iw_request_info *info,
 			  union iwreq_data *wrqu, char *extra)
 {
-	struct wl3501_card *this = dev->priv;
+	struct wl3501_card *this = netdev_priv(dev);
 	static const u8 bcast[ETH_ALEN] = { 255, 255, 255, 255, 255, 255 };
 	int rc = -EINVAL;
 
@@ -1597,7 +1597,7 @@ out:
 static int wl3501_get_wap(struct net_device *dev, struct iw_request_info *info,
 			  union iwreq_data *wrqu, char *extra)
 {
-	struct wl3501_card *this = dev->priv;
+	struct wl3501_card *this = netdev_priv(dev);
 
 	wrqu->ap_addr.sa_family = ARPHRD_ETHER;
 	memcpy(wrqu->ap_addr.sa_data, this->bssid, ETH_ALEN);
@@ -1616,7 +1616,7 @@ static int wl3501_set_scan(struct net_de
 static int wl3501_get_scan(struct net_device *dev, struct iw_request_info *info,
 			   union iwreq_data *wrqu, char *extra)
 {
-	struct wl3501_card *this = dev->priv;
+	struct wl3501_card *this = netdev_priv(dev);
 	int i;
 	char *current_ev = extra;
 	struct iw_event iwe;
@@ -1666,7 +1666,7 @@ static int wl3501_set_essid(struct net_d
 			    struct iw_request_info *info,
 			    union iwreq_data *wrqu, char *extra)
 {
-	struct wl3501_card *this = dev->priv;
+	struct wl3501_card *this = netdev_priv(dev);
 
 	if (wrqu->data.flags) {
 		iw_set_mgmt_info_element(IW_MGMT_INFO_ELEMENT_SSID,
@@ -1683,7 +1683,7 @@ static int wl3501_get_essid(struct net_d
 			    struct iw_request_info *info,
 			    union iwreq_data *wrqu, char *extra)
 {
-	struct wl3501_card *this = dev->priv;
+	struct wl3501_card *this = netdev_priv(dev);
 	unsigned long flags;
 
 	spin_lock_irqsave(&this->lock, flags);
@@ -1697,7 +1697,7 @@ static int wl3501_get_essid(struct net_d
 static int wl3501_set_nick(struct net_device *dev, struct iw_request_info *info,
 			   union iwreq_data *wrqu, char *extra)
 {
-	struct wl3501_card *this = dev->priv;
+	struct wl3501_card *this = netdev_priv(dev);
 
 	if (wrqu->data.length > sizeof(this->nick))
 		return -E2BIG;
@@ -1708,7 +1708,7 @@ static int wl3501_set_nick(struct net_de
 static int wl3501_get_nick(struct net_device *dev, struct iw_request_info *info,
 			   union iwreq_data *wrqu, char *extra)
 {
-	struct wl3501_card *this = dev->priv;
+	struct wl3501_card *this = netdev_priv(dev);
 
 	strlcpy(extra, this->nick, 32);
 	wrqu->data.length = strlen(extra);
@@ -1733,7 +1733,7 @@ static int wl3501_get_rts_threshold(stru
 				    union iwreq_data *wrqu, char *extra)
 {
 	u16 threshold; /* size checked: it is u16 */
-	struct wl3501_card *this = dev->priv;
+	struct wl3501_card *this = netdev_priv(dev);
 	int rc = wl3501_get_mib_value(this, WL3501_MIB_ATTR_RTS_THRESHOLD,
 				      &threshold, sizeof(threshold));
 	if (!rc) {
@@ -1749,7 +1749,7 @@ static int wl3501_get_frag_threshold(str
 				     union iwreq_data *wrqu, char *extra)
 {
 	u16 threshold; /* size checked: it is u16 */
-	struct wl3501_card *this = dev->priv;
+	struct wl3501_card *this = netdev_priv(dev);
 	int rc = wl3501_get_mib_value(this, WL3501_MIB_ATTR_FRAG_THRESHOLD,
 				      &threshold, sizeof(threshold));
 	if (!rc) {
@@ -1765,7 +1765,7 @@ static int wl3501_get_txpow(struct net_d
 			    union iwreq_data *wrqu, char *extra)
 {
 	u16 txpow;
-	struct wl3501_card *this = dev->priv;
+	struct wl3501_card *this = netdev_priv(dev);
 	int rc = wl3501_get_mib_value(this,
 				      WL3501_MIB_ATTR_CURRENT_TX_PWR_LEVEL,
 				      &txpow, sizeof(txpow));
@@ -1787,7 +1787,7 @@ static int wl3501_get_retry(struct net_d
 			    union iwreq_data *wrqu, char *extra)
 {
 	u8 retry; /* size checked: it is u8 */
-	struct wl3501_card *this = dev->priv;
+	struct wl3501_card *this = netdev_priv(dev);
 	int rc = wl3501_get_mib_value(this,
 				      WL3501_MIB_ATTR_LONG_RETRY_LIMIT,
 				      &retry, sizeof(retry));
@@ -1814,7 +1814,7 @@ static int wl3501_get_encode(struct net_
 			     union iwreq_data *wrqu, char *extra)
 {
 	u8 implemented, restricted, keys[100], len_keys, tocopy;
-	struct wl3501_card *this = dev->priv;
+	struct wl3501_card *this = netdev_priv(dev);
 	int rc = wl3501_get_mib_value(this,
 				      WL3501_MIB_ATTR_PRIV_OPT_IMPLEMENTED,
 				      &implemented, sizeof(implemented));
@@ -1852,7 +1852,7 @@ static int wl3501_get_power(struct net_d
 			    union iwreq_data *wrqu, char *extra)
 {
 	u8 pwr_state;
-	struct wl3501_card *this = dev->priv;
+	struct wl3501_card *this = netdev_priv(dev);
 	int rc = wl3501_get_mib_value(this,
 				      WL3501_MIB_ATTR_CURRENT_PWR_STATE,
 				      &pwr_state, sizeof(pwr_state));
@@ -1937,7 +1937,7 @@ static int wl3501_probe(struct pcmcia_de
 	dev->tx_timeout		= wl3501_tx_timeout;
 	dev->watchdog_timeo	= 5 * HZ;
 	dev->get_stats		= wl3501_get_stats;
-	this = dev->priv;
+	this = netdev_priv(dev);
 	this->wireless_data.spy_data = &this->spy_data;
 	this->p_dev = p_dev;
 	dev->wireless_data	= &this->wireless_data;
@@ -2006,7 +2006,7 @@ static int wl3501_config(struct pcmcia_d
 
 	SET_MODULE_OWNER(dev);
 
-	this = dev->priv;
+	this = netdev_priv(dev);
 	/*
 	 * At this point, the dev_node_t structure(s) should be initialized and
 	 * arranged in a linked list at link->dev_node.
@@ -2079,7 +2079,7 @@ static int wl3501_suspend(struct pcmcia_
 {
 	struct net_device *dev = link->priv;
 
-	wl3501_pwr_mgmt(dev->priv, WL3501_SUSPEND);
+	wl3501_pwr_mgmt(netdev_priv(dev), WL3501_SUSPEND);
 	if (link->open)
 		netif_device_detach(dev);
 
@@ -2090,7 +2090,7 @@ static int wl3501_resume(struct pcmcia_d
 {
 	struct net_device *dev = link->priv;
 
-	wl3501_pwr_mgmt(dev->priv, WL3501_RESUME);
+	wl3501_pwr_mgmt(netdev_priv(dev), WL3501_RESUME);
 	if (link->open) {
 		wl3501_reset(dev);
 		netif_device_attach(dev);


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* Re: netdev_priv()
  2007-07-18 22:24 netdev_priv() Thomas Surrel
                   ` (13 preceding siblings ...)
  2007-07-19 15:35 ` netdev_priv() Yoann Padioleau
@ 2007-07-19 15:57 ` Thomas Surrel
  2007-07-19 17:06 ` netdev_priv() Yoann Padioleau
                   ` (2 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: Thomas Surrel @ 2007-07-19 15:57 UTC (permalink / raw)
  To: kernel-janitors

> You mean that the name of the variable change ? But
> my semantic path, or more precisly the transformation tool
> handles that (unless my_own_private_netdevice has not
> the struct net_device*  type in which case you are right).
> I have written 'dev' in the semantic patch but it's a "metavariable".

Ok, I didn't know.

> I think I have found why I was too restrictive. Some people
> use alloc_etherdev which calls alloc_netdev. So I just
> have to relax the condition. There are multiple "alias"
> to alloc_netdev.

Exactly. Could you also add all the other alias to your tool ? There are:
- alloc_fcdev
- alloc_fddidev
- alloc_hippi_dev
- alloc_trdev
- alloc_ltalkdev
- alloc_irdadev
- alloc_irlandev

(not sure I have them all ...)

So to sum up, your tool is now handling everything except when the
driver is split in multiple files (and in more tricky cases like
airo). That's much less work then before anyway.

A lot of drivers are doing useless casting (e.g. struct private_net
*pn = (struct private_net *) dev->priv;). Is it something semantic
patch can handle ?

Best regards,

Thomas

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: netdev_priv()
  2007-07-18 22:24 netdev_priv() Thomas Surrel
                   ` (14 preceding siblings ...)
  2007-07-19 15:57 ` netdev_priv() Thomas Surrel
@ 2007-07-19 17:06 ` Yoann Padioleau
  2007-07-20  8:20 ` netdev_priv() Thomas Surrel
  2007-07-20 10:41 ` netdev_priv() Yoann Padioleau
  17 siblings, 0 replies; 19+ messages in thread
From: Yoann Padioleau @ 2007-07-19 17:06 UTC (permalink / raw)
  To: kernel-janitors

"Thomas Surrel" <thomas.surrel@gmail.com> writes:

>> You mean that the name of the variable change ? But
>> my semantic path, or more precisly the transformation tool
>> handles that (unless my_own_private_netdevice has not
>> the struct net_device*  type in which case you are right).
>> I have written 'dev' in the semantic patch but it's a "metavariable".
>
> Ok, I didn't know.

There is a kind of tutorial on our tool if you are interested at OLS
this year. It's available here
http://www.emn.fr/x-info/coccinelle/ols07-padioleau.pdf

>
>> I think I have found why I was too restrictive. Some people
>> use alloc_etherdev which calls alloc_netdev. So I just
>> have to relax the condition. There are multiple "alias"
>> to alloc_netdev.
>
> Exactly. Could you also add all the other alias to your tool ? 

You mean to the semantic patch. Yes I just need to extend the list in

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

(
 dev = alloc_netdev(sizeof(T), ...)
|
 dev = alloc_etherdev(sizeof(T))
|
 dev = alloc_netdev(sizeof(*x), ...)
|
 dev = alloc_etherdev(sizeof(*x))
|
 dev = alloc_fcdev(sizeof(T), ...)
|
 dev = alloc_fddidev(sizeof(T), ...)
)


etc





> There are:
> - alloc_fcdev
> - alloc_fddidev
> - alloc_hippi_dev
> - alloc_trdev
> - alloc_ltalkdev
> - alloc_irdadev
> - alloc_irlandev
>
> (not sure I have them all ...)

I have written a "semantic grep" to find the possible aliases. 

Here is the semantic grep (it's similar to a semantic patch)

@@
identifier fn;
identifier sizeof_priv;
@@

- fn(...,int sizeofpriv, ...) 
{
   <...
(
        alloc_netdev(sizeofpriv, ...)
|
        alloc_netdev_mq(sizeofpriv, ...)
)
   ...>    
 }



And here is what I have found:

struct net_device *alloc_fcdev(int sizeof_priv)
struct net_device *alloc_fddidev(int sizeof_priv)
struct net_device *alloc_hippi_dev(int sizeof_priv)
struct net_device *alloc_trdev(int sizeof_priv)
struct net_device *alloc_ltalkdev(int sizeof_priv)
struct net_device *alloc_etherdev_mq(int sizeof_priv, unsigned int queue_count)
struct net_device *alloc_irdadev(int sizeof_priv)

So there is also alloc_etherdev_mq.

My semantic grep didn't find alloc_irlandev because in

struct net_device *alloc_irlandev(const char *name)
{
	return alloc_netdev(sizeof(struct irlan_cb), name,
			    irlan_eth_setup);
}

the size of the private structure is not passed to alloc_irlandev.
Maybe I should extend my semantic grep but in that case I think
they are far more functions that use internally 
alloc_netdev.




>
> So to sum up, your tool is now handling everything except when the
> driver is split in multiple files

Well in that case my tool can handle it too but I just need the
user of my tool to give me the list of files that must be treated
at once. That's what I made for hostap/.
For the moment my tool has an option '-dir' to treat all
the drivers in a kernel directory, but it treats them separately.


>  (and in more tricky cases like
> airo)

Yes the semantic patch refuses to handle the files where there is a 
 dev->priv = <something>;

I could maybe extend the semantic patch to still try 
to perform some transformation even in some cases but it's
maybe complicated.

> . That's much less work then before anyway.

Yes. 

>
> A lot of drivers are doing useless casting (e.g. struct private_net
> *pn = (struct private_net *) dev->priv;). Is it something semantic
> patch can handle ?

Of course. If you look at the semantic patch I have given I already handle
some with 

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

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

So with  - (T*) I also remove the cast. 



I have started to do a more general "remove-useless-cast" semantic patch:

@@
type T;
identifier x;
void *E;
@@

T x = 
-     (T)
      E;

That removes all cast to an expression of type void*
(such as the return value of kmalloc, kzalloc, etc).
There are lots of such cases. The generated patch is quite huge.
I plan to split it and give it part by part to Andrew Morton, see
if he thinks it's something useful.



>
> Best regards,
>
> Thomas


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: netdev_priv()
  2007-07-18 22:24 netdev_priv() Thomas Surrel
                   ` (15 preceding siblings ...)
  2007-07-19 17:06 ` netdev_priv() Yoann Padioleau
@ 2007-07-20  8:20 ` Thomas Surrel
  2007-07-20 10:41 ` netdev_priv() Yoann Padioleau
  17 siblings, 0 replies; 19+ messages in thread
From: Thomas Surrel @ 2007-07-20  8:20 UTC (permalink / raw)
  To: kernel-janitors

>
> There is a kind of tutorial on our tool if you are interested at OLS
> this year. It's available here
> http://www.emn.fr/x-info/coccinelle/ols07-padioleau.pdf
>

Great tool. Thanks for pointing out the tutorial.
It was really interesting to work with you on that. If you need me to
review the final patches when they are ready (and see if they missed
some dev->priv), don't hesitate.

Best regards,

Thomas

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: netdev_priv()
  2007-07-18 22:24 netdev_priv() Thomas Surrel
                   ` (16 preceding siblings ...)
  2007-07-20  8:20 ` netdev_priv() Thomas Surrel
@ 2007-07-20 10:41 ` Yoann Padioleau
  17 siblings, 0 replies; 19+ messages in thread
From: Yoann Padioleau @ 2007-07-20 10:41 UTC (permalink / raw)
  To: kernel-janitors

"Thomas Surrel" <thomas.surrel@gmail.com> writes:

>>
>> There is a kind of tutorial on our tool if you are interested at OLS
>> this year. It's available here
>> http://www.emn.fr/x-info/coccinelle/ols07-padioleau.pdf
>>
>
> Great tool. 

Thanks.

> Thanks for pointing out the tutorial.
> It was really interesting to work with you on that. 

Thanks helping me refining my semantic patch.

> If you need me to
> review the final patches when they are ready (and see if they missed
> some dev->priv), don't hesitate.

Sure, I will post the patch on the janitor mailing list.

>
> Best regards,
>
> Thomas


^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2007-07-20 10:41 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-18 22:24 netdev_priv() Thomas Surrel
2007-07-19  7:25 ` netdev_priv() pradeep singh
2007-07-19  7:51 ` netdev_priv() Yoann Padioleau
2007-07-19  8:18 ` netdev_priv() Yoann Padioleau
2007-07-19  8:57 ` netdev_priv() Thomas Surrel
2007-07-19  9:01 ` netdev_priv() Thomas Surrel
2007-07-19  9:14 ` netdev_priv() pradeep singh
2007-07-19 11:49 ` netdev_priv() Yoann Padioleau
2007-07-19 13:27 ` netdev_priv() Thomas Surrel
2007-07-19 13:34 ` netdev_priv() Alexey Dobriyan
2007-07-19 13:52 ` netdev_priv() Yoann Padioleau
2007-07-19 13:59 ` netdev_priv() Yoann Padioleau
2007-07-19 14:33 ` netdev_priv() Thomas Surrel
2007-07-19 15:22 ` netdev_priv() pradeep singh
2007-07-19 15:35 ` netdev_priv() Yoann Padioleau
2007-07-19 15:57 ` netdev_priv() Thomas Surrel
2007-07-19 17:06 ` netdev_priv() Yoann Padioleau
2007-07-20  8:20 ` netdev_priv() Thomas Surrel
2007-07-20 10:41 ` netdev_priv() Yoann Padioleau

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.