netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Ritz <daniel.ritz@gmx.ch>
To: Jeff Garzik <jgarzik@pobox.com>
Cc: netdev@oss.sgi.com
Subject: Re: [PATCH 2.6] missing s/dev->priv/netdev_priv(dev) in drivers/net/pcmcia/
Date: Wed, 24 Mar 2004 23:27:28 +0100	[thread overview]
Message-ID: <200403242327.28378.daniel.ritz@gmx.ch> (raw)
In-Reply-To: <40620ADD.90307@pobox.com>

On Wednesday 24 March 2004 23:25, Jeff Garzik wrote:
> Daniel Ritz wrote:
> > clean up the last two instances of dev->priv in drivers/net/pcmcia.
> > against 2.6.5-rc2-bk.
> > 
> > --- 1.27/drivers/net/pcmcia/3c589_cs.c	Wed Mar  3 01:03:51 2004
> > +++ edited/drivers/net/pcmcia/3c589_cs.c	Wed Mar 24 22:29:35 2004
> > @@ -716,7 +716,7 @@
> >  	  "status %4.4x.\n", dev->name, (long)skb->len,
> >  	  inw(ioaddr + EL3_STATUS));
> >  
> > -    ((struct el3_private *)dev->priv)->stats.tx_bytes += skb->len;
> > +    ((struct el3_private *)netdev_priv(dev))->stats.tx_bytes += skb->len;
> >  
> >      /* Put out the doubleword header... */
> >      outw(skb->len, ioaddr + TX_FIFO);
> > --- 1.24/drivers/net/pcmcia/ibmtr_cs.c	Wed Mar  3 01:06:03 2004
> > +++ edited/drivers/net/pcmcia/ibmtr_cs.c	Wed Mar 24 22:29:51 2004
> > @@ -444,7 +444,7 @@
> >          link->state &= ~DEV_PRESENT;
> >          if (link->state & DEV_CONFIG) {
> >  	    /* set flag to bypass normal interrupt code */
> > -	    ((struct tok_info *)dev->priv)->sram_virt |= 1;
> > +	    ((struct tok_info *)netdev_priv(dev))->sram_virt |= 1;
> >  	    netif_device_detach(dev);
> >  	    ibmtr_release(link);
> 
> 
> although the patch is OK, the code itself is a bit yucky.
> 
> Can you please create a temporary variable, of struct el3_private or 
> tok_info type, and eliminate that cast?
> 
> struct el3_private *priv = netdev_priv(dev);
> priv->stats.tx_bytes += skb->len;
> 
> Much nicer :)
> 

agreed. here we go...

--- 1.27/drivers/net/pcmcia/3c589_cs.c	Wed Mar  3 01:03:51 2004
+++ edited/drivers/net/pcmcia/3c589_cs.c	Wed Mar 24 23:22:59 2004
@@ -711,12 +711,13 @@
 static int el3_start_xmit(struct sk_buff *skb, struct net_device *dev)
 {
     ioaddr_t ioaddr = dev->base_addr;
+    struct el3_private *priv = netdev_priv(dev);
 
     DEBUG(3, "%s: el3_start_xmit(length = %ld) called, "
 	  "status %4.4x.\n", dev->name, (long)skb->len,
 	  inw(ioaddr + EL3_STATUS));
 
-    ((struct el3_private *)dev->priv)->stats.tx_bytes += skb->len;
+    priv->stats.tx_bytes += skb->len;
 
     /* Put out the doubleword header... */
     outw(skb->len, ioaddr + TX_FIFO);
--- 1.24/drivers/net/pcmcia/ibmtr_cs.c	Wed Mar  3 01:06:03 2004
+++ edited/drivers/net/pcmcia/ibmtr_cs.c	Wed Mar 24 23:24:39 2004
@@ -444,7 +444,8 @@
         link->state &= ~DEV_PRESENT;
         if (link->state & DEV_CONFIG) {
 	    /* set flag to bypass normal interrupt code */
-	    ((struct tok_info *)dev->priv)->sram_virt |= 1;
+	    struct tok_info *priv = netdev_priv(dev);
+	    priv->sram_virt |= 1;
 	    netif_device_detach(dev);
 	    ibmtr_release(link);
         }

  reply	other threads:[~2004-03-24 22:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-24 22:15 [PATCH 2.6] missing s/dev->priv/netdev_priv(dev) in drivers/net/pcmcia/ Daniel Ritz
2004-03-24 22:25 ` Jeff Garzik
2004-03-24 22:27   ` Daniel Ritz [this message]
2004-04-19 17:03     ` Jeff Garzik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200403242327.28378.daniel.ritz@gmx.ch \
    --to=daniel.ritz@gmx.ch \
    --cc=jgarzik@pobox.com \
    --cc=netdev@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).