headers: remove sched.h from interrupt.h
[safe/jmp/linux-2.6] / drivers / net / depca.c
index e946c43..7a3bdac 100644 (file)
@@ -4,9 +4,9 @@
 
 
                       Copyright 1994 David C. Davies
-                                  and 
+                                  and
                         United States Government
-        (as represented by the Director, National Security Agency).  
+        (as represented by the Director, National Security Agency).
 
                Copyright 1995  Digital Equipment Corporation.
 
@@ -61,7 +61,7 @@
        Digital Equipment Corporation, 1989
     8) "DEC EtherWORKS Turbo_(TP BNC) Ethernet Controller Owners Manual",
        Digital Equipment corporation, 1991, Pub. #EK-DE202-OM.001
-    
+
 
     Peter Bauer's depca.c (V0.5) was referred to when debugging V0.1 of this
     driver.
        [Alan Cox: Changed the code to allow command line irq/io assignments]
        [Dave Davies: Changed the code to allow command line mem/name
                                                                 assignments]
-    6) run the net startup bits for your eth?? interface manually 
-    (usually /etc/rc.inet[12] at boot time). 
+    6) run the net startup bits for your eth?? interface manually
+    (usually /etc/rc.inet[12] at boot time).
     7) enjoy!
 
     Note that autoprobing is not allowed in loadable modules - the system is
     already up and running and you're messing with interrupts.
 
-    To unload a module, turn off the associated interface 
+    To unload a module, turn off the associated interface
     'ifconfig eth?? down' then 'rmmod depca'.
 
     To assign a base memory address for the shared memory  when running as a
     loadable module, see 5 above.  To include the adapter  name (if you have
     no PROM  but know the card name)  also see 5  above. Note that this last
-    option  will not work  with kernel  built-in  depca's. 
+    option  will not work  with kernel  built-in  depca's.
 
     The shared memory assignment for a loadable module  makes sense to avoid
     the 'memory autoprobe' picking the wrong shared memory  (for the case of
     ************************************************************************
     Support for MCA EtherWORKS cards added 11-3-98.
     Verified to work with up to 2 DE212 cards in a system (although not
-      fully stress-tested).  
+      fully stress-tested).
 
     Currently known bugs/limitations:
 
     ----------------
 
     Version   Date        Description
-  
+
       0.1     25-jan-94   Initial writing.
       0.2     27-jan-94   Added LANCE TX hardware buffer chaining.
       0.3      1-feb-94   Added multiple DEPCA support.
       0.351   30-apr-94   Added EISA support. Added DE422 recognition.
       0.36    16-may-94   DE422 fix released.
       0.37    22-jul-94   Added MODULE support
-      0.38    15-aug-94   Added DBR ROM switch in depca_close(). 
+      0.38    15-aug-94   Added DBR ROM switch in depca_close().
                           Multi DEPCA bug fix.
       0.38axp 15-sep-94   Special version for Alpha AXP Linux V1.0.
       0.381   12-dec-94   Added DE101 recognition, fix multicast bug.
       0.383   22-feb-95   Fix for conflict with VESA SCSI reported by
                           <stromain@alf.dec.com>
       0.384   17-mar-95   Fix a ring full bug reported by <bkm@star.rl.ac.uk>
-      0.385    3-apr-95   Fix a recognition bug reported by 
+      0.385    3-apr-95   Fix a recognition bug reported by
                                                 <ryan.niemi@lastfrontier.com>
       0.386   21-apr-95   Fix the last fix...sorry, must be galloping senility
       0.40    25-May-95   Rewrite for portability & updated.
                           ALPHA support from <jestabro@amt.tay1.dec.com>
       0.41    26-Jun-95   Added verify_area() calls in depca_ioctl() from
                           suggestion by <heiko@colossus.escape.de>
-      0.42    27-Dec-95   Add 'mem' shared memory assignment for loadable 
+      0.42    27-Dec-95   Add 'mem' shared memory assignment for loadable
                           modules.
                           Add 'adapter_name' for loadable modules when no PROM.
-                         Both above from a suggestion by 
+                         Both above from a suggestion by
                          <pchen@woodruffs121.residence.gatech.edu>.
                          Add new multicasting code.
       0.421   22-Apr-96          Fix alloc_device() bug <jari@markkus2.fimr.fi>
       0.44     1-Sep-97   Fix *_probe() to test check_region() first - bug
                            reported by <mmogilvi@elbert.uccs.edu>
       0.45     3-Nov-98   Added support for MCA EtherWORKS (DE210/DE212) cards
-                           by <tymm@computer.org> 
+                           by <tymm@computer.org>
       0.451    5-Nov-98   Fixed mca stuff cuz I'm a dummy. <tymm@computer.org>
       0.5     14-Nov-98   Re-spin for 2.1.x kernels.
       0.51    27-Jun-99   Correct received packet length for CRC from
     =========================================================================
 */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
+#include <linux/sched.h>
 #include <linux/string.h>
 #include <linux/errno.h>
 #include <linux/ioport.h>
@@ -412,7 +412,7 @@ static struct platform_driver depca_isa_driver = {
                .name   = depca_string,
        },
 };
-       
+
 /*
 ** Miscellaneous info...
 */
@@ -422,14 +422,14 @@ static struct platform_driver depca_isa_driver = {
 ** Memory Alignment. Each descriptor is 4 longwords long. To force a
 ** particular alignment on the TX descriptor, adjust DESC_SKIP_LEN and
 ** DESC_ALIGN. DEPCA_ALIGN aligns the start address of the private memory area
-** and hence the RX descriptor ring's first entry. 
+** and hence the RX descriptor ring's first entry.
 */
 #define DEPCA_ALIGN4      ((u_long)4 - 1)      /* 1 longword align */
 #define DEPCA_ALIGN8      ((u_long)8 - 1)      /* 2 longword (quadword) align */
 #define DEPCA_ALIGN         DEPCA_ALIGN8       /* Keep the LANCE happy... */
 
 /*
-** The DEPCA Rx and Tx ring descriptors. 
+** The DEPCA Rx and Tx ring descriptors.
 */
 struct depca_rx_desc {
        volatile s32 base;
@@ -486,7 +486,6 @@ struct depca_private {
 /* Kernel-only (not device) fields */
        int rx_new, tx_new;     /* The next free ring entry               */
        int rx_old, tx_old;     /* The ring entries to be free()ed.       */
-       struct net_device_stats stats;
        spinlock_t lock;
        struct {                /* Private stats counters                 */
                u32 bins[DEPCA_PKT_STAT_SZ];
@@ -518,12 +517,12 @@ struct depca_private {
 ** Public Functions
 */
 static int depca_open(struct net_device *dev);
-static int depca_start_xmit(struct sk_buff *skb, struct net_device *dev);
-static irqreturn_t depca_interrupt(int irq, void *dev_id, struct pt_regs *regs);
+static netdev_tx_t depca_start_xmit(struct sk_buff *skb,
+                                   struct net_device *dev);
+static irqreturn_t depca_interrupt(int irq, void *dev_id);
 static int depca_close(struct net_device *dev);
 static int depca_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
 static void depca_tx_timeout(struct net_device *dev);
-static struct net_device_stats *depca_get_stats(struct net_device *dev);
 static void set_multicast_list(struct net_device *dev);
 
 /*
@@ -569,6 +568,18 @@ MODULE_LICENSE("GPL");
     outw(CSR0, DEPCA_ADDR);\
     outw(STOP, DEPCA_DATA)
 
+static const struct net_device_ops depca_netdev_ops = {
+       .ndo_open               = depca_open,
+       .ndo_start_xmit         = depca_start_xmit,
+       .ndo_stop               = depca_close,
+       .ndo_set_multicast_list = set_multicast_list,
+       .ndo_do_ioctl           = depca_ioctl,
+       .ndo_tx_timeout         = depca_tx_timeout,
+       .ndo_change_mtu         = eth_change_mtu,
+       .ndo_set_mac_address    = eth_mac_addr,
+       .ndo_validate_addr      = eth_validate_addr,
+};
+
 static int __init depca_hw_init (struct net_device *dev, struct device *device)
 {
        struct depca_private *lp;
@@ -592,7 +603,7 @@ static int __init depca_hw_init (struct net_device *dev, struct device *device)
         */
 
        ioaddr = dev->base_addr;
-       
+
        STOP_DEPCA;
 
        nicsr = inb(DEPCA_NICSR);
@@ -603,15 +614,15 @@ static int __init depca_hw_init (struct net_device *dev, struct device *device)
                return -ENXIO;
        }
 
-       lp = (struct depca_private *) dev->priv;
+       lp = netdev_priv(dev);
        mem_start = lp->mem_start;
 
        if (!mem_start || lp->adapter < DEPCA || lp->adapter >=unknown)
                return -ENXIO;
 
-       printk ("%s: %s at 0x%04lx",
-               device->bus_id, depca_signature[lp->adapter], ioaddr);
-       
+       printk("%s: %s at 0x%04lx",
+              dev_name(device), depca_signature[lp->adapter], ioaddr);
+
        switch (lp->depca_bus) {
 #ifdef CONFIG_MCA
        case DEPCA_BUS_MCA:
@@ -635,14 +646,11 @@ static int __init depca_hw_init (struct net_device *dev, struct device *device)
 
        printk(", h/w address ");
        status = get_hw_addr(dev);
+       printk("%pM", dev->dev_addr);
        if (status != 0) {
                printk("      which has an Ethernet PROM CRC error.\n");
                return -ENXIO;
        }
-       for (i = 0; i < ETH_ALEN - 1; i++) {    /* get the ethernet address */
-               printk("%2.2x:", dev->dev_addr[i]);
-       }
-       printk("%2.2x", dev->dev_addr[i]);
 
        /* Set up the maximum amount of network RAM(kB) */
        netRAM = ((lp->adapter != DEPCA) ? 64 : 48);
@@ -658,7 +666,7 @@ static int __init depca_hw_init (struct net_device *dev, struct device *device)
                if (lp->depca_bus != DEPCA_BUS_MCA)
                        mem_start += 0x8000;
        }
-       
+
        if ((mem_len = (NUM_RX_DESC * (sizeof(struct depca_rx_desc) + RX_BUFF_SZ) + NUM_TX_DESC * (sizeof(struct depca_tx_desc) + TX_BUFF_SZ) + sizeof(struct depca_init)))
            > (netRAM << 10)) {
                printk(",\n       requests %dkB RAM: only %dkB is available!\n", (mem_len >> 10), netRAM);
@@ -675,7 +683,7 @@ static int __init depca_hw_init (struct net_device *dev, struct device *device)
 
        spin_lock_init(&lp->lock);
        sprintf(lp->adapter_name, "%s (%s)",
-               depca_signature[lp->adapter], device->bus_id);
+               depca_signature[lp->adapter], dev_name(device));
        status = -EBUSY;
 
        /* Initialisation Block */
@@ -683,7 +691,7 @@ static int __init depca_hw_init (struct net_device *dev, struct device *device)
                printk(KERN_ERR "depca: cannot request ISA memory, aborting\n");
                goto out_priv;
        }
-               
+
        status = -EIO;
        lp->sh_mem = ioremap(mem_start, mem_len);
        if (lp->sh_mem == NULL) {
@@ -799,20 +807,14 @@ static int __init depca_hw_init (struct net_device *dev, struct device *device)
        }
 
        /* The DEPCA-specific entries in the device structure. */
-       dev->open = &depca_open;
-       dev->hard_start_xmit = &depca_start_xmit;
-       dev->stop = &depca_close;
-       dev->get_stats = &depca_get_stats;
-       dev->set_multicast_list = &set_multicast_list;
-       dev->do_ioctl = &depca_ioctl;
-       dev->tx_timeout = depca_tx_timeout;
+       dev->netdev_ops = &depca_netdev_ops;
        dev->watchdog_timeo = TX_TIMEOUT;
 
        dev->mem_start = 0;
 
-       device->driver_data = dev;
+       dev_set_drvdata(device, dev);
        SET_NETDEV_DEV (dev, device);
-       
+
        status = register_netdev(dev);
        if (status == 0)
                return 0;
@@ -823,11 +825,11 @@ out1:
 out_priv:
        return status;
 }
-\f
+
 
 static int depca_open(struct net_device *dev)
 {
-       struct depca_private *lp = (struct depca_private *) dev->priv;
+       struct depca_private *lp = netdev_priv(dev);
        u_long ioaddr = dev->base_addr;
        s16 nicsr;
        int status = 0;
@@ -872,7 +874,7 @@ static int depca_open(struct net_device *dev)
 /* Initialize the lance Rx and Tx descriptor rings. */
 static void depca_init_ring(struct net_device *dev)
 {
-       struct depca_private *lp = (struct depca_private *) dev->priv;
+       struct depca_private *lp = netdev_priv(dev);
        u_int i;
        u_long offset;
 
@@ -925,12 +927,13 @@ static void depca_tx_timeout(struct net_device *dev)
 }
 
 
-/* 
-** Writes a socket buffer to TX descriptor ring and starts transmission 
+/*
+** Writes a socket buffer to TX descriptor ring and starts transmission
 */
-static int depca_start_xmit(struct sk_buff *skb, struct net_device *dev)
+static netdev_tx_t depca_start_xmit(struct sk_buff *skb,
+                                   struct net_device *dev)
 {
-       struct depca_private *lp = (struct depca_private *) dev->priv;
+       struct depca_private *lp = netdev_priv(dev);
        u_long ioaddr = dev->base_addr;
        int status = 0;
 
@@ -940,7 +943,7 @@ static int depca_start_xmit(struct sk_buff *skb, struct net_device *dev)
 
        if (skb_padto(skb, ETH_ZLEN))
                goto out;
-       
+
        netif_stop_queue(dev);
 
        if (TX_BUFFS_AVAIL) {   /* Fill in a Tx ring entry */
@@ -957,16 +960,16 @@ static int depca_start_xmit(struct sk_buff *skb, struct net_device *dev)
                if (TX_BUFFS_AVAIL)
                        netif_start_queue(dev);
        } else
-               status = -1;
+               status = NETDEV_TX_LOCKED;
 
       out:
        return status;
 }
 
 /*
-** The DEPCA interrupt handler. 
+** The DEPCA interrupt handler.
 */
-static irqreturn_t depca_interrupt(int irq, void *dev_id, struct pt_regs *regs)
+static irqreturn_t depca_interrupt(int irq, void *dev_id)
 {
        struct net_device *dev = dev_id;
        struct depca_private *lp;
@@ -978,7 +981,7 @@ static irqreturn_t depca_interrupt(int irq, void *dev_id, struct pt_regs *regs)
                return IRQ_NONE;
        }
 
-       lp = (struct depca_private *) dev->priv;
+       lp = netdev_priv(dev);
        ioaddr = dev->base_addr;
 
        spin_lock(&lp->lock);
@@ -1016,7 +1019,7 @@ static irqreturn_t depca_interrupt(int irq, void *dev_id, struct pt_regs *regs)
 /* Called with lp->lock held */
 static int depca_rx(struct net_device *dev)
 {
-       struct depca_private *lp = (struct depca_private *) dev->priv;
+       struct depca_private *lp = netdev_priv(dev);
        int i, entry;
        s32 status;
 
@@ -1027,15 +1030,15 @@ static int depca_rx(struct net_device *dev)
                }
                if (status & R_ENP) {   /* Valid frame status */
                        if (status & R_ERR) {   /* There was an error. */
-                               lp->stats.rx_errors++;  /* Update the error stats. */
+                               dev->stats.rx_errors++; /* Update the error stats. */
                                if (status & R_FRAM)
-                                       lp->stats.rx_frame_errors++;
+                                       dev->stats.rx_frame_errors++;
                                if (status & R_OFLO)
-                                       lp->stats.rx_over_errors++;
+                                       dev->stats.rx_over_errors++;
                                if (status & R_CRC)
-                                       lp->stats.rx_crc_errors++;
+                                       dev->stats.rx_crc_errors++;
                                if (status & R_BUFF)
-                                       lp->stats.rx_fifo_errors++;
+                                       dev->stats.rx_fifo_errors++;
                        } else {
                                short len, pkt_len = readw(&lp->rx_ring[entry].msg_length) - 4;
                                struct sk_buff *skb;
@@ -1045,7 +1048,6 @@ static int depca_rx(struct net_device *dev)
                                        unsigned char *buf;
                                        skb_reserve(skb, 2);    /* 16 byte align the IP header */
                                        buf = skb_put(skb, pkt_len);
-                                       skb->dev = dev;
                                        if (entry < lp->rx_old) {       /* Wrapped buffer */
                                                len = (lp->rxRingMask - lp->rx_old + 1) * RX_BUFF_SZ;
                                                memcpy_fromio(buf, lp->rx_buff[lp->rx_old], len);
@@ -1054,8 +1056,8 @@ static int depca_rx(struct net_device *dev)
                                                memcpy_fromio(buf, lp->rx_buff[lp->rx_old], pkt_len);
                                        }
 
-                                       /* 
-                                          ** Notify the upper protocol layers that there is another 
+                                       /*
+                                          ** Notify the upper protocol layers that there is another
                                           ** packet to handle
                                         */
                                        skb->protocol = eth_type_trans(skb, dev);
@@ -1064,9 +1066,8 @@ static int depca_rx(struct net_device *dev)
                                        /*
                                           ** Update stats
                                         */
-                                       dev->last_rx = jiffies;
-                                       lp->stats.rx_packets++;
-                                       lp->stats.rx_bytes += pkt_len;
+                                       dev->stats.rx_packets++;
+                                       dev->stats.rx_bytes += pkt_len;
                                        for (i = 1; i < DEPCA_PKT_STAT_SZ - 1; i++) {
                                                if (pkt_len < (i * DEPCA_PKT_BIN_SZ)) {
                                                        lp->pktStats.bins[i]++;
@@ -1089,7 +1090,7 @@ static int depca_rx(struct net_device *dev)
                                        }
                                } else {
                                        printk("%s: Memory squeeze, deferring packet.\n", dev->name);
-                                       lp->stats.rx_dropped++; /* Really, deferred. */
+                                       dev->stats.rx_dropped++;        /* Really, deferred. */
                                        break;
                                }
                        }
@@ -1115,7 +1116,7 @@ static int depca_rx(struct net_device *dev)
 */
 static int depca_tx(struct net_device *dev)
 {
-       struct depca_private *lp = (struct depca_private *) dev->priv;
+       struct depca_private *lp = netdev_priv(dev);
        int entry;
        s32 status;
        u_long ioaddr = dev->base_addr;
@@ -1127,24 +1128,24 @@ static int depca_tx(struct net_device *dev)
                        break;
                } else if (status & T_ERR) {    /* An error occurred. */
                        status = readl(&lp->tx_ring[entry].misc);
-                       lp->stats.tx_errors++;
+                       dev->stats.tx_errors++;
                        if (status & TMD3_RTRY)
-                               lp->stats.tx_aborted_errors++;
+                               dev->stats.tx_aborted_errors++;
                        if (status & TMD3_LCAR)
-                               lp->stats.tx_carrier_errors++;
+                               dev->stats.tx_carrier_errors++;
                        if (status & TMD3_LCOL)
-                               lp->stats.tx_window_errors++;
+                               dev->stats.tx_window_errors++;
                        if (status & TMD3_UFLO)
-                               lp->stats.tx_fifo_errors++;
+                               dev->stats.tx_fifo_errors++;
                        if (status & (TMD3_BUFF | TMD3_UFLO)) {
                                /* Trigger an immediate send demand. */
                                outw(CSR0, DEPCA_ADDR);
                                outw(INEA | TDMD, DEPCA_DATA);
                        }
                } else if (status & (T_MORE | T_ONE)) {
-                       lp->stats.collisions++;
+                       dev->stats.collisions++;
                } else {
-                       lp->stats.tx_packets++;
+                       dev->stats.tx_packets++;
                }
 
                /* Update all the pointers */
@@ -1156,7 +1157,7 @@ static int depca_tx(struct net_device *dev)
 
 static int depca_close(struct net_device *dev)
 {
-       struct depca_private *lp = (struct depca_private *) dev->priv;
+       struct depca_private *lp = netdev_priv(dev);
        s16 nicsr;
        u_long ioaddr = dev->base_addr;
 
@@ -1168,9 +1169,9 @@ static int depca_close(struct net_device *dev)
                printk("%s: Shutting down ethercard, status was %2.2x.\n", dev->name, inw(DEPCA_DATA));
        }
 
-       /* 
+       /*
           ** We stop the DEPCA here -- it occasionally polls
-          ** memory if we don't. 
+          ** memory if we don't.
         */
        outw(STOP, DEPCA_DATA);
 
@@ -1192,7 +1193,7 @@ static int depca_close(struct net_device *dev)
 
 static void LoadCSRs(struct net_device *dev)
 {
-       struct depca_private *lp = (struct depca_private *) dev->priv;
+       struct depca_private *lp = netdev_priv(dev);
        u_long ioaddr = dev->base_addr;
 
        outw(CSR1, DEPCA_ADDR); /* initialisation block address LSW */
@@ -1209,7 +1210,7 @@ static void LoadCSRs(struct net_device *dev)
 
 static int InitRestartDepca(struct net_device *dev)
 {
-       struct depca_private *lp = (struct depca_private *) dev->priv;
+       struct depca_private *lp = netdev_priv(dev);
        u_long ioaddr = dev->base_addr;
        int i, status = 0;
 
@@ -1236,41 +1237,30 @@ static int InitRestartDepca(struct net_device *dev)
        return status;
 }
 
-static struct net_device_stats *depca_get_stats(struct net_device *dev)
-{
-       struct depca_private *lp = (struct depca_private *) dev->priv;
-
-       /* Null body since there is no framing error counter */
-
-       return &lp->stats;
-}
-
 /*
 ** Set or clear the multicast filter for this adaptor.
 */
 static void set_multicast_list(struct net_device *dev)
 {
-       struct depca_private *lp = (struct depca_private *) dev->priv;
+       struct depca_private *lp = netdev_priv(dev);
        u_long ioaddr = dev->base_addr;
 
-       if (dev) {
-               netif_stop_queue(dev);
-               while (lp->tx_old != lp->tx_new);       /* Wait for the ring to empty */
-
-               STOP_DEPCA;     /* Temporarily stop the depca.  */
-               depca_init_ring(dev);   /* Initialize the descriptor rings */
+       netif_stop_queue(dev);
+       while (lp->tx_old != lp->tx_new);       /* Wait for the ring to empty */
 
-               if (dev->flags & IFF_PROMISC) { /* Set promiscuous mode */
-                       lp->init_block.mode |= PROM;
-               } else {
-                       SetMulticastFilter(dev);
-                       lp->init_block.mode &= ~PROM;   /* Unset promiscuous mode */
-               }
+       STOP_DEPCA;     /* Temporarily stop the depca.  */
+       depca_init_ring(dev);   /* Initialize the descriptor rings */
 
-               LoadCSRs(dev);  /* Reload CSR3 */
-               InitRestartDepca(dev);  /* Resume normal operation. */
-               netif_start_queue(dev); /* Unlock the TX ring */
+       if (dev->flags & IFF_PROMISC) { /* Set promiscuous mode */
+               lp->init_block.mode |= PROM;
+       } else {
+               SetMulticastFilter(dev);
+               lp->init_block.mode &= ~PROM;   /* Unset promiscuous mode */
        }
+
+       LoadCSRs(dev);  /* Reload CSR3 */
+       InitRestartDepca(dev);  /* Resume normal operation. */
+       netif_start_queue(dev); /* Unlock the TX ring */
 }
 
 /*
@@ -1281,7 +1271,7 @@ static void set_multicast_list(struct net_device *dev)
 */
 static void SetMulticastFilter(struct net_device *dev)
 {
-       struct depca_private *lp = (struct depca_private *) dev->priv;
+       struct depca_private *lp = netdev_priv(dev);
        struct dev_mc_list *dmi = dev->mc_list;
        char *addrs;
        int i, j, bit, byte;
@@ -1321,12 +1311,12 @@ static void SetMulticastFilter(struct net_device *dev)
 static int __init depca_common_init (u_long ioaddr, struct net_device **devp)
 {
        int status = 0;
-       
+
        if (!request_region (ioaddr, DEPCA_TOTAL_SIZE, depca_string)) {
                status = -EBUSY;
                goto out;
        }
-       
+
        if (DevicePresent(ioaddr)) {
                status = -ENODEV;
                goto out_release;
@@ -1338,7 +1328,7 @@ static int __init depca_common_init (u_long ioaddr, struct net_device **devp)
        }
 
        return 0;
-       
+
  out_release:
        release_region (ioaddr, DEPCA_TOTAL_SIZE);
  out:
@@ -1360,16 +1350,16 @@ static int __init depca_mca_probe(struct device *device)
        struct depca_private *lp;
 
        /*
-       ** Search for the adapter.  If an address has been given, search 
+       ** Search for the adapter.  If an address has been given, search
        ** specifically for the card at that address.  Otherwise find the
        ** first card in the system.
        */
-       
+
        pos[0] = mca_device_read_stored_pos(mdev, 2);
        pos[1] = mca_device_read_stored_pos(mdev, 3);
 
        /*
-       ** IO of card is handled by bits 1 and 2 of pos0.    
+       ** IO of card is handled by bits 1 and 2 of pos0.
        **
        **    bit2 bit1    IO
        **       0    0    0x2c00
@@ -1382,12 +1372,12 @@ static int __init depca_mca_probe(struct device *device)
 
        /*
        ** Found the adapter we were looking for. Now start setting it up.
-       ** 
+       **
        ** First work on decoding the IRQ.  It's stored in the lower 4 bits
        ** of pos1.  Bits are as follows (from the ADF file):
        **
-       **      Bits           
-       **   3   2   1   0    IRQ 
+       **      Bits
+       **   3   2   1   0    IRQ
        **   --------------------
        **   0   0   1   0     5
        **   0   0   0   1     9
@@ -1436,7 +1426,7 @@ static int __init depca_mca_probe(struct device *device)
        strncpy(mdev->name, depca_mca_adapter_name[mdev->index],
                sizeof(mdev->name));
        mca_device_set_claim(mdev, 1);
-       
+
         /*
        ** Get everything allocated and initialized...  (almost just
        ** like the ISA and EISA probes)
@@ -1449,14 +1439,14 @@ static int __init depca_mca_probe(struct device *device)
 
        dev->irq = irq;
        dev->base_addr = iobase;
-       lp = dev->priv;
+       lp = netdev_priv(dev);
        lp->depca_bus = DEPCA_BUS_MCA;
        lp->adapter = depca_mca_adapter_type[mdev->index];
        lp->mem_start = mem_start;
-       
+
        if ((err = depca_hw_init(dev, device)))
                goto out_free;
-                       
+
        return 0;
 
  out_free:
@@ -1480,7 +1470,7 @@ static void __init depca_platform_probe (void)
 
        for (i = 0; depca_io_ports[i].iobase; i++) {
                depca_io_ports[i].device = NULL;
-               
+
                /* if an address has been specified on the command
                 * line, use it (if valid) */
                if (io && io != depca_io_ports[i].iobase)
@@ -1494,8 +1484,9 @@ static void __init depca_platform_probe (void)
                depca_io_ports[i].device = pldev;
 
                if (platform_device_add(pldev)) {
-                       platform_device_put(pldev);
                        depca_io_ports[i].device = NULL;
+                       pldev->dev.platform_data = NULL;
+                       platform_device_put(pldev);
                        continue;
                }
 
@@ -1504,7 +1495,7 @@ static void __init depca_platform_probe (void)
                 * no hardware at this address. Unregister it, as the
                 * release fuction will take care of freeing the
                 * allocated structure */
-                       
+
                        depca_io_ports[i].device = NULL;
                        pldev->dev.platform_data = NULL;
                        platform_device_unregister (pldev);
@@ -1542,7 +1533,7 @@ static int __init depca_isa_probe (struct platform_device *device)
                goto out;
 
        adapter = depca_shmem_probe (&mem_start);
-       
+
        if (adapter == unknown) {
                status = -ENODEV;
                goto out_free;
@@ -1551,14 +1542,14 @@ static int __init depca_isa_probe (struct platform_device *device)
        dev->base_addr = ioaddr;
        dev->irq = irq;         /* Use whatever value the user gave
                                 * us, and 0 if he didn't. */
-       lp = dev->priv;
+       lp = netdev_priv(dev);
        lp->depca_bus = DEPCA_BUS_ISA;
        lp->adapter = adapter;
        lp->mem_start = mem_start;
-       
+
        if ((status = depca_hw_init(dev, &device->dev)))
                goto out_free;
-       
+
        return 0;
 
  out_free:
@@ -1575,6 +1566,7 @@ static int __init depca_isa_probe (struct platform_device *device)
 #ifdef CONFIG_EISA
 static int __init depca_eisa_probe (struct device *device)
 {
+       enum depca_type adapter = unknown;
        struct eisa_device *edev;
        struct net_device *dev;
        struct depca_private *lp;
@@ -1592,19 +1584,23 @@ static int __init depca_eisa_probe (struct device *device)
         * it's address with the ethernet prom)... As we don't parse
         * the EISA configuration structures (yet... :-), just rely on
         * the ISA probing to sort it out... */
-       
-       depca_shmem_probe (&mem_start);
+
+       adapter = depca_shmem_probe (&mem_start);
+       if (adapter == unknown) {
+               status = -ENODEV;
+               goto out_free;
+       }
 
        dev->base_addr = ioaddr;
        dev->irq = irq;
-       lp = dev->priv;
+       lp = netdev_priv(dev);
        lp->depca_bus = DEPCA_BUS_EISA;
        lp->adapter = edev->id.driver_data;
        lp->mem_start = mem_start;
-       
+
        if ((status = depca_hw_init(dev, device)))
                goto out_free;
-       
+
        return 0;
 
  out_free:
@@ -1621,8 +1617,8 @@ static int __devexit depca_device_remove (struct device *device)
        struct depca_private *lp;
        int bus;
 
-       dev  = device->driver_data;
-       lp   = dev->priv;
+       dev  = dev_get_drvdata(device);
+       lp   = netdev_priv(dev);
 
        unregister_netdev (dev);
        iounmap (lp->sh_mem);
@@ -1651,7 +1647,7 @@ static int __init DepcaSignature(char *name, u_long base_addr)
         * used, at least on x86. Instead, reserve a memory region a
         * board would certainly use. If it works, go ahead. If not,
         * run like hell... */
-       
+
        if (!request_mem_region (mem_addr, 16, depca_string))
                return unknown;
 
@@ -1700,7 +1696,7 @@ static int __init DepcaSignature(char *name, u_long base_addr)
 ** if the first address octet is a 0x08 - this minimises the chances of
 ** messing around with some other hardware, but it assumes that this DEPCA
 ** card initialized itself correctly.
-** 
+**
 ** Search the Ethernet address ROM for the signature. Since the ROM address
 ** counter can start at an arbitrary point, the search must include the entire
 ** probe sequence length plus the (length_of_the_signature - 1).
@@ -1764,7 +1760,7 @@ static int __init DevicePresent(u_long ioaddr)
 static int __init get_hw_addr(struct net_device *dev)
 {
        u_long ioaddr = dev->base_addr;
-       struct depca_private *lp = dev->priv;
+       struct depca_private *lp = netdev_priv(dev);
        int i, k, tmp, status = 0;
        u_short j, x, chksum;
 
@@ -1799,13 +1795,13 @@ static int __init get_hw_addr(struct net_device *dev)
 */
 static int load_packet(struct net_device *dev, struct sk_buff *skb)
 {
-       struct depca_private *lp = (struct depca_private *) dev->priv;
-       int i, entry, end, len, status = 0;
+       struct depca_private *lp = netdev_priv(dev);
+       int i, entry, end, len, status = NETDEV_TX_OK;
 
        entry = lp->tx_new;     /* Ring around buffer number. */
        end = (entry + (skb->len - 1) / TX_BUFF_SZ) & lp->txRingMask;
        if (!(readl(&lp->tx_ring[end].base) & T_OWN)) { /* Enough room? */
-               /* 
+               /*
                   ** Caution: the write order is important here... don't set up the
                   ** ownership rights until all the other information is in place.
                 */
@@ -1846,7 +1842,7 @@ static int load_packet(struct net_device *dev, struct sk_buff *skb)
 
                lp->tx_new = (++end) & lp->txRingMask;  /* update current pointers */
        } else {
-               status = -1;
+               status = NETDEV_TX_LOCKED;
        }
 
        return status;
@@ -1854,7 +1850,7 @@ static int load_packet(struct net_device *dev, struct sk_buff *skb)
 
 static void depca_dbg_open(struct net_device *dev)
 {
-       struct depca_private *lp = (struct depca_private *) dev->priv;
+       struct depca_private *lp = netdev_priv(dev);
        u_long ioaddr = dev->base_addr;
        struct depca_init *p = &lp->init_block;
        int i;
@@ -1896,11 +1892,7 @@ static void depca_dbg_open(struct net_device *dev)
                printk("...0x%8.8x\n", readl(&lp->tx_ring[i].base));
                printk("Initialisation block at 0x%8.8lx(Phys)\n", lp->mem_start);
                printk("        mode: 0x%4.4x\n", p->mode);
-               printk("        physical address: ");
-               for (i = 0; i < ETH_ALEN - 1; i++) {
-                       printk("%2.2x:", p->phys_addr[i]);
-               }
-               printk("%2.2x\n", p->phys_addr[i]);
+               printk("        physical address: %pM\n", p->phys_addr);
                printk("        multicast hash table: ");
                for (i = 0; i < (HASH_TABLE_LEN >> 3) - 1; i++) {
                        printk("%2.2x:", p->mcast_table[i]);
@@ -1929,7 +1921,7 @@ static void depca_dbg_open(struct net_device *dev)
 */
 static int depca_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 {
-       struct depca_private *lp = (struct depca_private *) dev->priv;
+       struct depca_private *lp = netdev_priv(dev);
        struct depca_ioctl *ioc = (struct depca_ioctl *) &rq->ifr_ifru;
        int i, status = 0;
        u_long ioaddr = dev->base_addr;
@@ -2087,7 +2079,7 @@ static int __init depca_module_init (void)
 #endif
        err |= platform_driver_register (&depca_isa_driver);
        depca_platform_probe ();
-       
+
         return err;
 }