0x2b0, 0x2b4, 0x2c0, 0x2c4, 0x2d0, 0x2d4, 0x2e0, 0x2e4, 0x2f0, 0x2f4,
        0 };
 
+#define NET_LOCAL_LOCK(dev) (((struct net_local *)netdev_priv(dev))->lock)
 
 /*
  * Look for SBNI card which addr stored in dev->base_addr, if nonzero.
 }
 
 
-int __init
+static int __init
 sbni_pci_probe( struct net_device  *dev )
 {
        struct pci_dev  *pdev = NULL;
        dev->irq = irq;
        dev->base_addr = ioaddr;
 
-       /* Allocate dev->priv and fill in sbni-specific dev fields. */
-       nl = dev->priv;
+       /* Fill in sbni-specific dev fields. */
+       nl = netdev_priv(dev);
        if( !nl ) {
                printk( KERN_ERR "%s: unable to get memory!\n", dev->name );
                release_region( ioaddr, SBNI_IO_EXTENT );
                return NULL;
        }
 
-       dev->priv = nl;
        memset( nl, 0, sizeof(struct net_local) );
        spin_lock_init( &nl->lock );
 
        /* store MAC address (generate if that isn't known) */
        *(__be16 *)dev->dev_addr = htons( 0x00ff );
        *(__be32 *)(dev->dev_addr + 2) = htonl( 0x01000000 |
-               ( (mac[num]  ?  mac[num]  :  (u32)((long)dev->priv)) & 0x00ffffff) );
+               ((mac[num] ?
+               mac[num] :
+               (u32)((long)netdev_priv(dev))) & 0x00ffffff));
 
        /* store link settings (speed, receive level ) */
        nl->maxframe  = DEFAULT_FRAME_LEN;
 
        /* Looking for idle device in the list */
        for( p = dev;  p; ) {
-               struct net_local  *nl = (struct net_local *) p->priv;
+               struct net_local  *nl = netdev_priv(p);
                spin_lock( &nl->lock );
                if( nl->tx_buf_p  ||  (nl->state & FL_LINE_DOWN) ) {
                        p = nl->link;
 static int
 sbni_start_xmit( struct sk_buff  *skb,  struct net_device  *dev )
 {
-       struct net_local  *nl  = (struct net_local *) dev->priv;
+       struct net_local  *nl  = netdev_priv(dev);
 
        netif_stop_queue( dev );
        spin_lock( &nl->lock );
 sbni_interrupt( int  irq,  void  *dev_id )
 {
        struct net_device         *dev = dev_id;
-       struct net_local  *nl  = dev->priv;
+       struct net_local  *nl  = netdev_priv(dev);
        int     repeat;
 
        spin_lock( &nl->lock );
        if( nl->second )
-               spin_lock( &((struct net_local *) nl->second->priv)->lock );
+               spin_lock(&NET_LOCAL_LOCK(nl->second));
 
        do {
                repeat = 0;
        } while( repeat );
 
        if( nl->second )
-               spin_unlock( &((struct net_local *)nl->second->priv)->lock );
+               spin_unlock(&NET_LOCAL_LOCK(nl->second));
        spin_unlock( &nl->lock );
        return IRQ_HANDLED;
 }
 static void
 handle_channel( struct net_device  *dev )
 {
-       struct net_local        *nl    = (struct net_local *) dev->priv;
+       struct net_local        *nl    = netdev_priv(dev);
        unsigned long           ioaddr = dev->base_addr;
 
        int  req_ans;
 #ifdef CONFIG_SBNI_MULTILINE
        /* Lock the master device because we going to change its local data */
        if( nl->state & FL_SLAVE )
-               spin_lock( &((struct net_local *) nl->master->priv)->lock );
+               spin_lock(&NET_LOCAL_LOCK(nl->master));
 #endif
 
        outb( (inb( ioaddr + CSR0 ) & ~EN_INT) | TR_REQ, ioaddr + CSR0 );
 
 #ifdef CONFIG_SBNI_MULTILINE
        if( nl->state & FL_SLAVE )
-               spin_unlock( &((struct net_local *) nl->master->priv)->lock );
+               spin_unlock(&NET_LOCAL_LOCK(nl->master));
 #endif
 }
 
 static int
 recv_frame( struct net_device  *dev )
 {
-       struct net_local  *nl   = (struct net_local *) dev->priv;
+       struct net_local  *nl   = netdev_priv(dev);
        unsigned long  ioaddr   = dev->base_addr;
 
        u32  crc = CRC32_INITIAL;
 static void
 send_frame( struct net_device  *dev )
 {
-       struct net_local  *nl    = (struct net_local *) dev->priv;
+       struct net_local  *nl    = netdev_priv(dev);
 
        u32  crc = CRC32_INITIAL;
 
 static void
 download_data( struct net_device  *dev,  u32  *crc_p )
 {
-       struct net_local  *nl    = (struct net_local *) dev->priv;
+       struct net_local  *nl    = netdev_priv(dev);
        struct sk_buff    *skb   = nl->tx_buf_p;
 
        unsigned  len = min_t(unsigned int, skb->len - nl->outpos, nl->framelen);
 upload_data( struct net_device  *dev,  unsigned  framelen,  unsigned  frameno,
             unsigned  is_first,  u32  crc )
 {
-       struct net_local  *nl = (struct net_local *) dev->priv;
+       struct net_local  *nl = netdev_priv(dev);
 
        int  frame_ok;
 
                        nl->wait_frameno = 0,
                        nl->inppos = 0,
 #ifdef CONFIG_SBNI_MULTILINE
-                       ((struct net_local *) nl->master->priv)
+                       ((struct net_local *)netdev_priv(nl->master))
                                ->stats.rx_errors++,
-                       ((struct net_local *) nl->master->priv)
+                       ((struct net_local *)netdev_priv(nl->master))
                                ->stats.rx_missed_errors++;
 #else
                        nl->stats.rx_errors++,
                 */
                nl->wait_frameno = 0,
 #ifdef CONFIG_SBNI_MULTILINE
-               ((struct net_local *) nl->master->priv)->stats.rx_errors++,
-               ((struct net_local *) nl->master->priv)->stats.rx_crc_errors++;
+               ((struct net_local *)netdev_priv(nl->master))
+                       ->stats.rx_errors++,
+               ((struct net_local *)netdev_priv(nl->master))
+                       ->stats.rx_crc_errors++;
 #else
                nl->stats.rx_errors++,
                nl->stats.rx_crc_errors++;
 send_complete( struct net_local  *nl )
 {
 #ifdef CONFIG_SBNI_MULTILINE
-       ((struct net_local *) nl->master->priv)->stats.tx_packets++;
-       ((struct net_local *) nl->master->priv)->stats.tx_bytes
+       ((struct net_local *)netdev_priv(nl->master))->stats.tx_packets++;
+       ((struct net_local *)netdev_priv(nl->master))->stats.tx_bytes
                += nl->tx_buf_p->len;
 #else
        nl->stats.tx_packets++;
 static void
 interpret_ack( struct net_device  *dev,  unsigned  ack )
 {
-       struct net_local  *nl = (struct net_local *) dev->priv;
+       struct net_local  *nl = netdev_priv(dev);
 
        if( ack == FRAME_SENT_OK ) {
                nl->state &= ~FL_NEED_RESEND;
 static int
 append_frame_to_pkt( struct net_device  *dev,  unsigned  framelen,  u32  crc )
 {
-       struct net_local  *nl = (struct net_local *) dev->priv;
+       struct net_local  *nl = netdev_priv(dev);
 
        u8  *p;
 
 static void
 prepare_to_send( struct sk_buff  *skb,  struct net_device  *dev )
 {
-       struct net_local  *nl = (struct net_local *) dev->priv;
+       struct net_local  *nl = netdev_priv(dev);
 
        unsigned int  len;
 
 static void
 drop_xmit_queue( struct net_device  *dev )
 {
-       struct net_local  *nl = (struct net_local *) dev->priv;
+       struct net_local  *nl = netdev_priv(dev);
 
        if( nl->tx_buf_p )
                dev_kfree_skb_any( nl->tx_buf_p ),
                nl->tx_buf_p = NULL,
 #ifdef CONFIG_SBNI_MULTILINE
-               ((struct net_local *) nl->master->priv)
+               ((struct net_local *)netdev_priv(nl->master))
                        ->stats.tx_errors++,
-               ((struct net_local *) nl->master->priv)
+               ((struct net_local *)netdev_priv(nl->master))
                        ->stats.tx_carrier_errors++;
 #else
                nl->stats.tx_errors++,
 static void
 send_frame_header( struct net_device  *dev,  u32  *crc_p )
 {
-       struct net_local  *nl  = (struct net_local *) dev->priv;
+       struct net_local  *nl  = netdev_priv(dev);
 
        u32  crc = *crc_p;
        u32  len_field = nl->framelen + 6;      /* CRC + frameno + reserved */
 static void
 indicate_pkt( struct net_device  *dev )
 {
-       struct net_local  *nl  = (struct net_local *) dev->priv;
+       struct net_local  *nl  = netdev_priv(dev);
        struct sk_buff    *skb = nl->rx_buf_p;
 
        skb_put( skb, nl->inppos );
 #ifdef CONFIG_SBNI_MULTILINE
        skb->protocol = eth_type_trans( skb, nl->master );
        netif_rx( skb );
-       ++((struct net_local *) nl->master->priv)->stats.rx_packets;
-       ((struct net_local *) nl->master->priv)->stats.rx_bytes += nl->inppos;
+       ++((struct net_local *)netdev_priv(nl->master))->stats.rx_packets;
+       ((struct net_local *)netdev_priv(nl->master))->stats.rx_bytes +=
+               nl->inppos;
 #else
        skb->protocol = eth_type_trans( skb, dev );
        netif_rx( skb );
 sbni_watchdog( unsigned long  arg )
 {
        struct net_device  *dev = (struct net_device *) arg;
-       struct net_local   *nl  = (struct net_local *) dev->priv;
+       struct net_local   *nl  = netdev_priv(dev);
        struct timer_list  *w   = &nl->watchdog; 
        unsigned long      flags;
        unsigned char      csr0;
 static void
 card_start( struct net_device  *dev )
 {
-       struct net_local  *nl = (struct net_local *) dev->priv;
+       struct net_local  *nl = netdev_priv(dev);
 
        nl->timer_ticks = CHANGE_LEVEL_START_TICKS;
        nl->state &= ~(FL_WAIT_ACK | FL_NEED_RESEND);
 static void
 change_level( struct net_device  *dev )
 {
-       struct net_local  *nl = (struct net_local *) dev->priv;
+       struct net_local  *nl = netdev_priv(dev);
 
        if( nl->delta_rxl == 0 )        /* do not auto-negotiate RxL */
                return;
 static void
 timeout_change_level( struct net_device  *dev )
 {
-       struct net_local  *nl = (struct net_local *) dev->priv;
+       struct net_local  *nl = netdev_priv(dev);
 
        nl->cur_rxl_index = timeout_rxl_tab[ nl->timeout_rxl ];
        if( ++nl->timeout_rxl >= 4 )
 static int
 sbni_open( struct net_device  *dev )
 {
-       struct net_local        *nl = (struct net_local *) dev->priv;
+       struct net_local        *nl = netdev_priv(dev);
        struct timer_list       *w  = &nl->watchdog;
 
        /*
                                 ||  (*p)->base_addr == dev->base_addr - 4)
                            &&  (*p)->flags & IFF_UP ) {
 
-                               ((struct net_local *) ((*p)->priv))
+                               ((struct net_local *) (netdev_priv(*p)))
                                        ->second = dev;
                                printk( KERN_NOTICE "%s: using shared irq "
                                        "with %s\n", dev->name, (*p)->name );
 static int
 sbni_close( struct net_device  *dev )
 {
-       struct net_local  *nl = (struct net_local *) dev->priv;
+       struct net_local  *nl = netdev_priv(dev);
 
        if( nl->second  &&  nl->second->flags & IFF_UP ) {
                printk( KERN_NOTICE "Secondary channel (%s) is active!\n",
 static int
 sbni_ioctl( struct net_device  *dev,  struct ifreq  *ifr,  int  cmd )
 {
-       struct net_local  *nl = (struct net_local *) dev->priv; 
+       struct net_local  *nl = netdev_priv(dev);
        struct sbni_flags  flags;
        int  error = 0;
 
 static int
 enslave( struct net_device  *dev,  struct net_device  *slave_dev )
 {
-       struct net_local  *nl  = (struct net_local *) dev->priv;
-       struct net_local  *snl = (struct net_local *) slave_dev->priv;
+       struct net_local  *nl  = netdev_priv(dev);
+       struct net_local  *snl = netdev_priv(slave_dev);
 
        if( nl->state & FL_SLAVE )      /* This isn't master or free device */
                return  -EBUSY;
 static int
 emancipate( struct net_device  *dev )
 {
-       struct net_local   *snl = (struct net_local *) dev->priv;
+       struct net_local   *snl = netdev_priv(dev);
        struct net_device  *p   = snl->master;
-       struct net_local   *nl  = (struct net_local *) p->priv;
+       struct net_local   *nl  = netdev_priv(p);
 
        if( !(snl->state & FL_SLAVE) )
                return  -EINVAL;
 
        /* exclude from list */
        for(;;) {       /* must be in list */
-               struct net_local  *t = (struct net_local *) p->priv;
+               struct net_local  *t = netdev_priv(p);
                if( t->link == dev ) {
                        t->link = snl->link;
                        break;
 static struct net_device_stats *
 sbni_get_stats( struct net_device  *dev )
 {
-       return  &((struct net_local *) dev->priv)->stats;
+       return  &((struct net_local *)netdev_priv(dev))->stats;
 }