fbdev: intelfb: add support for the Intel Integrated Graphics Controller 965G/965GM
[safe/jmp/linux-2.6] / drivers / net / yellowfin.c
index ecec8e5..2464072 100644 (file)
 
        Support and updates available at
        http://www.scyld.com/network/yellowfin.html
+       [link no longer provides useful info -jgarzik]
 
-
-       Linux kernel changelog:
-       -----------------------
-
-       LK1.1.1 (jgarzik): Port to 2.4 kernel
-
-       LK1.1.2 (jgarzik):
-       * Merge in becker version 1.05
-
-       LK1.1.3 (jgarzik):
-       * Various cleanups
-       * Update yellowfin_timer to correctly calculate duplex.
-       (suggested by Manfred Spraul)
-
-       LK1.1.4 (val@nmt.edu):
-       * Fix three endian-ness bugs
-       * Support dual function SYM53C885E ethernet chip
-       
-       LK1.1.5 (val@nmt.edu):
-       * Fix forced full-duplex bug I introduced
-
-       LK1.1.6 (val@nmt.edu):
-       * Only print warning on truly "oversized" packets
-       * Fix theoretical bug on gigabit cards - return to 1.1.3 behavior
-       
 */
 
 #define DRV_NAME       "yellowfin"
-#define DRV_VERSION    "1.05+LK1.1.6"
-#define DRV_RELDATE    "Feb 11, 2002"
+#define DRV_VERSION    "2.1"
+#define DRV_RELDATE    "Sep 11, 2006"
 
 #define PFX DRV_NAME ": "
 
@@ -133,7 +109,6 @@ static int gx_fix;
 /* These identify the driver base version and may not be removed. */
 static char version[] __devinitdata =
 KERN_INFO DRV_NAME ".c:v1.05  1/09/2001  Written by Donald Becker <becker@scyld.com>\n"
-KERN_INFO "  http://www.scyld.com/network/yellowfin.html\n"
 KERN_INFO "  (unofficial 2.4.x port, " DRV_VERSION ", " DRV_RELDATE ")\n";
 
 MODULE_AUTHOR("Donald Becker <becker@scyld.com>");
@@ -161,7 +136,7 @@ MODULE_PARM_DESC(gx_fix, "G-NIC: enable GX server chipset bug workaround (0-1)")
 I. Board Compatibility
 
 This device driver is designed for the Packet Engines "Yellowfin" Gigabit
-Ethernet adapter.  The G-NIC 64-bit PCI card is supported, as well as the 
+Ethernet adapter.  The G-NIC 64-bit PCI card is supported, as well as the
 Symbios 53C885E dual function chip.
 
 II. Board-specific settings
@@ -232,28 +207,18 @@ IVc. Errata
 See Packet Engines confidential appendix (prototype chips only).
 */
 
-\f
 
-enum pci_id_flags_bits {
-       /* Set PCI command register bits before calling probe1(). */
-       PCI_USES_IO=1, PCI_USES_MEM=2, PCI_USES_MASTER=4,
-       /* Read and map the single following PCI BAR. */
-       PCI_ADDR0=0<<4, PCI_ADDR1=1<<4, PCI_ADDR2=2<<4, PCI_ADDR3=3<<4,
-       PCI_ADDR_64BITS=0x100, PCI_NO_ACPI_WAKE=0x200, PCI_NO_MIN_LATENCY=0x400,
-       PCI_UNUSED_IRQ=0x800,
-};
+
 enum capability_flags {
        HasMII=1, FullTxStatus=2, IsGigabit=4, HasMulticastBug=8, FullRxStatus=16,
        HasMACAddrBug=32, /* Only on early revs.  */
        DontUseEeprom=64, /* Don't read the MAC from the EEPROm. */
 };
+
 /* The PCI I/O space extent. */
-#define YELLOWFIN_SIZE 0x100
-#ifdef USE_IO_OPS
-#define PCI_IOTYPE (PCI_USES_MASTER | PCI_USES_IO  | PCI_ADDR0)
-#else
-#define PCI_IOTYPE (PCI_USES_MASTER | PCI_USES_MEM | PCI_ADDR1)
-#endif
+enum {
+       YELLOWFIN_SIZE  = 0x100,
+};
 
 struct pci_id_info {
         const char *name;
@@ -261,24 +226,21 @@ struct pci_id_info {
                 int     pci, pci_mask, subsystem, subsystem_mask;
                 int revision, revision_mask;                            /* Only 8 bits. */
         } id;
-        enum pci_id_flags_bits pci_flags;
-        int io_size;                            /* Needed for I/O region check or ioremap(). */
         int drv_flags;                          /* Driver use, intended as capability flags. */
 };
 
 static const struct pci_id_info pci_id_tbl[] = {
        {"Yellowfin G-NIC Gigabit Ethernet", { 0x07021000, 0xffffffff},
-        PCI_IOTYPE, YELLOWFIN_SIZE,
         FullTxStatus | IsGigabit | HasMulticastBug | HasMACAddrBug | DontUseEeprom},
        {"Symbios SYM83C885", { 0x07011000, 0xffffffff},
-        PCI_IOTYPE, YELLOWFIN_SIZE, HasMII | DontUseEeprom },
-       {NULL,},
+         HasMII | DontUseEeprom },
+       { }
 };
 
-static struct pci_device_id yellowfin_pci_tbl[] = {
+static const struct pci_device_id yellowfin_pci_tbl[] = {
        { 0x1000, 0x0702, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
        { 0x1000, 0x0701, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1 },
-       { 0, }
+       { }
 };
 MODULE_DEVICE_TABLE (pci, yellowfin_pci_tbl);
 
@@ -303,10 +265,10 @@ enum yellowfin_offsets {
 /* The Yellowfin Rx and Tx buffer descriptors.
    Elements are written as 32 bit for endian portability. */
 struct yellowfin_desc {
-       u32 dbdma_cmd;
-       u32 addr;
-       u32 branch_addr;
-       u32 result_status;
+       __le32 dbdma_cmd;
+       __le32 addr;
+       __le32 branch_addr;
+       __le32 result_status;
 };
 
 struct tx_status_words {
@@ -356,7 +318,6 @@ struct yellowfin_private {
        dma_addr_t tx_status_dma;
 
        struct timer_list timer;        /* Media selection timer. */
-       struct net_device_stats stats;
        /* Frequently used and paired value: keep adjacent for cache effect. */
        int chip_id, drv_flags;
        struct pci_dev *pci_dev;
@@ -387,13 +348,12 @@ static void yellowfin_timer(unsigned long data);
 static void yellowfin_tx_timeout(struct net_device *dev);
 static void yellowfin_init_ring(struct net_device *dev);
 static int yellowfin_start_xmit(struct sk_buff *skb, struct net_device *dev);
-static irqreturn_t yellowfin_interrupt(int irq, void *dev_instance, struct pt_regs *regs);
+static irqreturn_t yellowfin_interrupt(int irq, void *dev_instance);
 static int yellowfin_rx(struct net_device *dev);
 static void yellowfin_error(struct net_device *dev, int intr_status);
 static int yellowfin_close(struct net_device *dev);
-static struct net_device_stats *yellowfin_get_stats(struct net_device *dev);
 static void set_rx_mode(struct net_device *dev);
-static struct ethtool_ops ethtool_ops;
+static const struct ethtool_ops ethtool_ops;
 
 
 static int __devinit yellowfin_init_one(struct pci_dev *pdev,
@@ -414,7 +374,8 @@ static int __devinit yellowfin_init_one(struct pci_dev *pdev,
 #else
        int bar = 1;
 #endif
-       
+       DECLARE_MAC_BUF(mac);
+
 /* when built into the kernel, we only print version if device is found */
 #ifndef MODULE
        static int printed_version;
@@ -430,7 +391,6 @@ static int __devinit yellowfin_init_one(struct pci_dev *pdev,
                printk (KERN_ERR PFX "cannot allocate ethernet device\n");
                return -ENOMEM;
        }
-       SET_MODULE_OWNER(dev);
        SET_NETDEV_DEV(dev, &pdev->dev);
 
        np = netdev_priv(dev);
@@ -508,7 +468,6 @@ static int __devinit yellowfin_init_one(struct pci_dev *pdev,
        dev->open = &yellowfin_open;
        dev->hard_start_xmit = &yellowfin_start_xmit;
        dev->stop = &yellowfin_close;
-       dev->get_stats = &yellowfin_get_stats;
        dev->set_multicast_list = &set_rx_mode;
        dev->do_ioctl = &netdev_ioctl;
        SET_ETHTOOL_OPS(dev, &ethtool_ops);
@@ -522,12 +481,10 @@ static int __devinit yellowfin_init_one(struct pci_dev *pdev,
        if (i)
                goto err_out_unmap_status;
 
-       printk(KERN_INFO "%s: %s type %8x at %p, ",
+       printk(KERN_INFO "%s: %s type %8x at %p, %s, IRQ %d.\n",
                   dev->name, pci_id_tbl[chip_idx].name,
-                  ioread32(ioaddr + ChipRev), ioaddr);
-       for (i = 0; i < 5; i++)
-                       printk("%2.2x:", dev->dev_addr[i]);
-       printk("%2.2x, IRQ %d.\n", dev->dev_addr[i], irq);
+                  ioread32(ioaddr + ChipRev), ioaddr,
+                  print_mac(mac, dev->dev_addr), irq);
 
        if (np->drv_flags & HasMII) {
                int phy, phy_idx = 0;
@@ -545,11 +502,11 @@ static int __devinit yellowfin_init_one(struct pci_dev *pdev,
        }
 
        find_cnt++;
-       
+
        return 0;
 
 err_out_unmap_status:
-        pci_free_consistent(pdev, STATUS_TOTAL_SIZE, np->tx_status, 
+        pci_free_consistent(pdev, STATUS_TOTAL_SIZE, np->tx_status,
                np->tx_status_dma);
 err_out_unmap_rx:
         pci_free_consistent(pdev, RX_TOTAL_SIZE, np->rx_ring, np->rx_ring_dma);
@@ -606,7 +563,7 @@ static void mdio_write(void __iomem *ioaddr, int phy_id, int location, int value
        return;
 }
 
-\f
+
 static int yellowfin_open(struct net_device *dev)
 {
        struct yellowfin_private *yp = netdev_priv(dev);
@@ -616,7 +573,7 @@ static int yellowfin_open(struct net_device *dev)
        /* Reset the chip. */
        iowrite32(0x80000000, ioaddr + DMACtrl);
 
-       i = request_irq(dev->irq, &yellowfin_interrupt, SA_SHIRQ, dev->name, dev);
+       i = request_irq(dev->irq, &yellowfin_interrupt, IRQF_SHARED, dev->name, dev);
        if (i) return i;
 
        if (yellowfin_debug > 1)
@@ -710,7 +667,7 @@ static void yellowfin_timer(unsigned long data)
                                   dev->name, yp->phys[0], bmsr, lpa);
 
                yp->full_duplex = mii_duplex(yp->duplex_lock, negotiated);
-                       
+
                iowrite16(0x101C | (yp->full_duplex ? 2 : 0), ioaddr + Cnfg);
 
                if (bmsr & BMSR_LSTATUS)
@@ -756,7 +713,7 @@ static void yellowfin_tx_timeout(struct net_device *dev)
                netif_wake_queue (dev);         /* Typical path */
 
        dev->trans_start = jiffies;
-       yp->stats.tx_errors++;
+       dev->stats.tx_errors++;
 }
 
 /* Initialize the Rx and Tx rings, along with various 'dev' bits. */
@@ -813,14 +770,14 @@ static void yellowfin_init_ring(struct net_device *dev)
                /* Branch on Tx error. */
                yp->tx_ring[j].dbdma_cmd = cpu_to_le32(CMD_STOP);
                yp->tx_ring[j].branch_addr = cpu_to_le32(yp->tx_ring_dma +
-                       (j+1)*sizeof(struct yellowfin_desc);
+                       (j+1)*sizeof(struct yellowfin_desc));
                j++;
                if (yp->flags & FullTxStatus) {
                        yp->tx_ring[j].dbdma_cmd =
                                cpu_to_le32(CMD_TXSTATUS | sizeof(*yp->tx_status));
                        yp->tx_ring[j].request_cnt = sizeof(*yp->tx_status);
                        yp->tx_ring[j].addr = cpu_to_le32(yp->tx_status_dma +
-                               i*sizeof(struct tx_status_words);
+                               i*sizeof(struct tx_status_words));
                } else {
                        /* Symbios chips write only tx_errs word. */
                        yp->tx_ring[j].dbdma_cmd =
@@ -829,10 +786,10 @@ static void yellowfin_init_ring(struct net_device *dev)
                        /* Om pade ummmmm... */
                        yp->tx_ring[j].addr = cpu_to_le32(yp->tx_status_dma +
                                i*sizeof(struct tx_status_words) +
-                               &(yp->tx_status[0].tx_errs) - 
+                               &(yp->tx_status[0].tx_errs) -
                                &(yp->tx_status[0]));
                }
-               yp->tx_ring[j].branch_addr = cpu_to_le32(yp->tx_ring_dma + 
+               yp->tx_ring[j].branch_addr = cpu_to_le32(yp->tx_ring_dma +
                        ((j+1)%(2*TX_RING_SIZE))*sizeof(struct yellowfin_desc));
        }
        /* Wrap ring */
@@ -872,7 +829,7 @@ static int yellowfin_start_xmit(struct sk_buff *skb, struct net_device *dev)
        yp->tx_skbuff[entry] = skb;
 
 #ifdef NO_TXSTATS
-       yp->tx_ring[entry].addr = cpu_to_le32(pci_map_single(yp->pci_dev, 
+       yp->tx_ring[entry].addr = cpu_to_le32(pci_map_single(yp->pci_dev,
                skb->data, len, PCI_DMA_TODEVICE));
        yp->tx_ring[entry].result_status = 0;
        if (entry >= TX_RING_SIZE-1) {
@@ -888,9 +845,9 @@ static int yellowfin_start_xmit(struct sk_buff *skb, struct net_device *dev)
        yp->cur_tx++;
 #else
        yp->tx_ring[entry<<1].request_cnt = len;
-       yp->tx_ring[entry<<1].addr = cpu_to_le32(pci_map_single(yp->pci_dev, 
+       yp->tx_ring[entry<<1].addr = cpu_to_le32(pci_map_single(yp->pci_dev,
                skb->data, len, PCI_DMA_TODEVICE));
-       /* The input_last (status-write) command is constant, but we must 
+       /* The input_last (status-write) command is constant, but we must
           rewrite the subsequent 'stop' command. */
 
        yp->cur_tx++;
@@ -925,7 +882,7 @@ static int yellowfin_start_xmit(struct sk_buff *skb, struct net_device *dev)
 
 /* The interrupt handler does all of the Rx thread work and cleans up
    after the Tx thread. */
-static irqreturn_t yellowfin_interrupt(int irq, void *dev_instance, struct pt_regs *regs)
+static irqreturn_t yellowfin_interrupt(int irq, void *dev_instance)
 {
        struct net_device *dev = dev_instance;
        struct yellowfin_private *yp;
@@ -933,16 +890,9 @@ static irqreturn_t yellowfin_interrupt(int irq, void *dev_instance, struct pt_re
        int boguscnt = max_interrupt_work;
        unsigned int handled = 0;
 
-#ifndef final_version                  /* Can never occur. */
-       if (dev == NULL) {
-               printk (KERN_ERR "yellowfin_interrupt(): irq %d for unknown device.\n", irq);
-               return IRQ_NONE;
-       }
-#endif
-
        yp = netdev_priv(dev);
        ioaddr = yp->base;
-       
+
        spin_lock (&yp->lock);
 
        do {
@@ -969,10 +919,10 @@ static irqreturn_t yellowfin_interrupt(int irq, void *dev_instance, struct pt_re
                        if (yp->tx_ring[entry].result_status == 0)
                                break;
                        skb = yp->tx_skbuff[entry];
-                       yp->stats.tx_packets++;
-                       yp->stats.tx_bytes += skb->len;
+                       dev->stats.tx_packets++;
+                       dev->stats.tx_bytes += skb->len;
                        /* Free the original skb. */
-                       pci_unmap_single(yp->pci_dev, yp->tx_ring[entry].addr,
+                       pci_unmap_single(yp->pci_dev, le32_to_cpu(yp->tx_ring[entry].addr),
                                skb->len, PCI_DMA_TODEVICE);
                        dev_kfree_skb_irq(skb);
                        yp->tx_skbuff[entry] = NULL;
@@ -1014,24 +964,24 @@ static irqreturn_t yellowfin_interrupt(int irq, void *dev_instance, struct pt_re
                                                printk(KERN_DEBUG "%s: Transmit error, Tx status %4.4x.\n",
                                                           dev->name, tx_errs);
 #endif
-                                       yp->stats.tx_errors++;
-                                       if (tx_errs & 0xF800) yp->stats.tx_aborted_errors++;
-                                       if (tx_errs & 0x0800) yp->stats.tx_carrier_errors++;
-                                       if (tx_errs & 0x2000) yp->stats.tx_window_errors++;
-                                       if (tx_errs & 0x8000) yp->stats.tx_fifo_errors++;
+                                       dev->stats.tx_errors++;
+                                       if (tx_errs & 0xF800) dev->stats.tx_aborted_errors++;
+                                       if (tx_errs & 0x0800) dev->stats.tx_carrier_errors++;
+                                       if (tx_errs & 0x2000) dev->stats.tx_window_errors++;
+                                       if (tx_errs & 0x8000) dev->stats.tx_fifo_errors++;
                                } else {
 #ifndef final_version
                                        if (yellowfin_debug > 4)
                                                printk(KERN_DEBUG "%s: Normal transmit, Tx status %4.4x.\n",
                                                           dev->name, tx_errs);
 #endif
-                                       yp->stats.tx_bytes += skb->len;
-                                       yp->stats.collisions += tx_errs & 15;
-                                       yp->stats.tx_packets++;
+                                       dev->stats.tx_bytes += skb->len;
+                                       dev->stats.collisions += tx_errs & 15;
+                                       dev->stats.tx_packets++;
                                }
                                /* Free the original skb. */
-                               pci_unmap_single(yp->pci_dev, 
-                                       yp->tx_ring[entry<<1].addr, skb->len, 
+                               pci_unmap_single(yp->pci_dev,
+                                       yp->tx_ring[entry<<1].addr, skb->len,
                                        PCI_DMA_TODEVICE);
                                dev_kfree_skb_irq(skb);
                                yp->tx_skbuff[entry] = 0;
@@ -1106,13 +1056,13 @@ static int yellowfin_rx(struct net_device *dev)
 
                if(!desc->result_status)
                        break;
-               pci_dma_sync_single_for_cpu(yp->pci_dev, desc->addr,
+               pci_dma_sync_single_for_cpu(yp->pci_dev, le32_to_cpu(desc->addr),
                        yp->rx_buf_sz, PCI_DMA_FROMDEVICE);
                desc_status = le32_to_cpu(desc->result_status) >> 16;
                buf_addr = rx_skb->data;
-               data_size = (le32_to_cpu(desc->dbdma_cmd) - 
+               data_size = (le32_to_cpu(desc->dbdma_cmd) -
                        le32_to_cpu(desc->result_status)) & 0xffff;
-               frame_status = le16_to_cpu(get_unaligned((s16*)&(buf_addr[data_size - 2])));
+               frame_status = le16_to_cpu(get_unaligned((__le16*)&(buf_addr[data_size - 2])));
                if (yellowfin_debug > 4)
                        printk(KERN_DEBUG "  yellowfin_rx() status was %4.4x.\n",
                                   frame_status);
@@ -1122,39 +1072,39 @@ static int yellowfin_rx(struct net_device *dev)
                        if (data_size != 0)
                                printk(KERN_WARNING "%s: Oversized Ethernet frame spanned multiple buffers,"
                                           " status %4.4x, data_size %d!\n", dev->name, desc_status, data_size);
-                       yp->stats.rx_length_errors++;
+                       dev->stats.rx_length_errors++;
                } else if ((yp->drv_flags & IsGigabit)  &&  (frame_status & 0x0038)) {
                        /* There was a error. */
                        if (yellowfin_debug > 3)
                                printk(KERN_DEBUG "  yellowfin_rx() Rx error was %4.4x.\n",
                                           frame_status);
-                       yp->stats.rx_errors++;
-                       if (frame_status & 0x0060) yp->stats.rx_length_errors++;
-                       if (frame_status & 0x0008) yp->stats.rx_frame_errors++;
-                       if (frame_status & 0x0010) yp->stats.rx_crc_errors++;
-                       if (frame_status < 0) yp->stats.rx_dropped++;
+                       dev->stats.rx_errors++;
+                       if (frame_status & 0x0060) dev->stats.rx_length_errors++;
+                       if (frame_status & 0x0008) dev->stats.rx_frame_errors++;
+                       if (frame_status & 0x0010) dev->stats.rx_crc_errors++;
+                       if (frame_status < 0) dev->stats.rx_dropped++;
                } else if ( !(yp->drv_flags & IsGigabit)  &&
                                   ((buf_addr[data_size-1] & 0x85) || buf_addr[data_size-2] & 0xC0)) {
                        u8 status1 = buf_addr[data_size-2];
                        u8 status2 = buf_addr[data_size-1];
-                       yp->stats.rx_errors++;
-                       if (status1 & 0xC0) yp->stats.rx_length_errors++;
-                       if (status2 & 0x03) yp->stats.rx_frame_errors++;
-                       if (status2 & 0x04) yp->stats.rx_crc_errors++;
-                       if (status2 & 0x80) yp->stats.rx_dropped++;
+                       dev->stats.rx_errors++;
+                       if (status1 & 0xC0) dev->stats.rx_length_errors++;
+                       if (status2 & 0x03) dev->stats.rx_frame_errors++;
+                       if (status2 & 0x04) dev->stats.rx_crc_errors++;
+                       if (status2 & 0x80) dev->stats.rx_dropped++;
 #ifdef YF_PROTOTYPE            /* Support for prototype hardware errata. */
                } else if ((yp->flags & HasMACAddrBug)  &&
                        memcmp(le32_to_cpu(yp->rx_ring_dma +
                                entry*sizeof(struct yellowfin_desc)),
-                               dev->dev_addr, 6) != 0 && 
+                               dev->dev_addr, 6) != 0 &&
                        memcmp(le32_to_cpu(yp->rx_ring_dma +
                                entry*sizeof(struct yellowfin_desc)),
                                "\377\377\377\377\377\377", 6) != 0) {
-                       if (bogus_rx++ == 0)
-                               printk(KERN_WARNING "%s: Bad frame to %2.2x:%2.2x:%2.2x:%2.2x:"
-                                          "%2.2x:%2.2x.\n",
-                                          dev->name, buf_addr[0], buf_addr[1], buf_addr[2],
-                                          buf_addr[3], buf_addr[4], buf_addr[5]);
+                       if (bogus_rx++ == 0) {
+                               DECLARE_MAC_BUF(mac);
+                               printk(KERN_WARNING "%s: Bad frame to %s\n",
+                                          dev->name, print_mac(mac, buf_addr));
+                       }
 #endif
                } else {
                        struct sk_buff *skb;
@@ -1172,28 +1122,28 @@ static int yellowfin_rx(struct net_device *dev)
                           without copying to a properly sized skbuff. */
                        if (pkt_len > rx_copybreak) {
                                skb_put(skb = rx_skb, pkt_len);
-                               pci_unmap_single(yp->pci_dev, 
-                                       yp->rx_ring[entry].addr, 
-                                       yp->rx_buf_sz, 
+                               pci_unmap_single(yp->pci_dev,
+                                       le32_to_cpu(yp->rx_ring[entry].addr),
+                                       yp->rx_buf_sz,
                                        PCI_DMA_FROMDEVICE);
                                yp->rx_skbuff[entry] = NULL;
                        } else {
                                skb = dev_alloc_skb(pkt_len + 2);
                                if (skb == NULL)
                                        break;
-                               skb->dev = dev;
                                skb_reserve(skb, 2);    /* 16 byte align the IP header */
-                               eth_copy_and_sum(skb, rx_skb->data, pkt_len, 0);
+                               skb_copy_to_linear_data(skb, rx_skb->data, pkt_len);
                                skb_put(skb, pkt_len);
-                               pci_dma_sync_single_for_device(yp->pci_dev, desc->addr,
-                                                                                          yp->rx_buf_sz,
-                                                                                          PCI_DMA_FROMDEVICE);
+                               pci_dma_sync_single_for_device(yp->pci_dev,
+                                                               le32_to_cpu(desc->addr),
+                                                               yp->rx_buf_sz,
+                                                               PCI_DMA_FROMDEVICE);
                        }
                        skb->protocol = eth_type_trans(skb, dev);
                        netif_rx(skb);
                        dev->last_rx = jiffies;
-                       yp->stats.rx_packets++;
-                       yp->stats.rx_bytes += pkt_len;
+                       dev->stats.rx_packets++;
+                       dev->stats.rx_bytes += pkt_len;
                }
                entry = (++yp->cur_rx) % RX_RING_SIZE;
        }
@@ -1227,15 +1177,13 @@ static int yellowfin_rx(struct net_device *dev)
 
 static void yellowfin_error(struct net_device *dev, int intr_status)
 {
-       struct yellowfin_private *yp = netdev_priv(dev);
-
        printk(KERN_ERR "%s: Something Wicked happened! %4.4x.\n",
                   dev->name, intr_status);
        /* Hmmmmm, it's not clear what to do here. */
        if (intr_status & (IntrTxPCIErr | IntrTxPCIFault))
-               yp->stats.tx_errors++;
+               dev->stats.tx_errors++;
        if (intr_status & (IntrRxPCIErr | IntrRxPCIFault))
-               yp->stats.rx_errors++;
+               dev->stats.rx_errors++;
 }
 
 static int yellowfin_close(struct net_device *dev)
@@ -1305,7 +1253,7 @@ static int yellowfin_close(struct net_device *dev)
        /* Free all the skbuffs in the Rx queue. */
        for (i = 0; i < RX_RING_SIZE; i++) {
                yp->rx_ring[i].dbdma_cmd = cpu_to_le32(CMD_STOP);
-               yp->rx_ring[i].addr = 0xBADF00D0; /* An invalid address. */
+               yp->rx_ring[i].addr = cpu_to_le32(0xBADF00D0); /* An invalid address. */
                if (yp->rx_skbuff[i]) {
                        dev_kfree_skb(yp->rx_skbuff[i]);
                }
@@ -1327,12 +1275,6 @@ static int yellowfin_close(struct net_device *dev)
        return 0;
 }
 
-static struct net_device_stats *yellowfin_get_stats(struct net_device *dev)
-{
-       struct yellowfin_private *yp = netdev_priv(dev);
-       return &yp->stats;
-}
-
 /* Set or clear the multicast filter for this adaptor. */
 
 static void set_rx_mode(struct net_device *dev)
@@ -1344,8 +1286,6 @@ static void set_rx_mode(struct net_device *dev)
        /* Stop the Rx process to change any value. */
        iowrite16(cfg_value & ~0x1000, ioaddr + Cnfg);
        if (dev->flags & IFF_PROMISC) {                 /* Set promiscuous. */
-               /* Unconditionally log net taps. */
-               printk(KERN_NOTICE "%s: Promiscuous mode enabled.\n", dev->name);
                iowrite16(0x000F, ioaddr + AddrMode);
        } else if ((dev->mc_count > 64)  ||  (dev->flags & IFF_ALLMULTI)) {
                /* Too many to filter well, or accept all multicasts. */
@@ -1391,7 +1331,7 @@ static void yellowfin_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo
        strcpy(info->bus_info, pci_name(np->pci_dev));
 }
 
-static struct ethtool_ops ethtool_ops = {
+static const struct ethtool_ops ethtool_ops = {
        .get_drvinfo = yellowfin_get_drvinfo
 };
 
@@ -1442,7 +1382,7 @@ static void __devexit yellowfin_remove_one (struct pci_dev *pdev)
        BUG_ON(!dev);
        np = netdev_priv(dev);
 
-        pci_free_consistent(pdev, STATUS_TOTAL_SIZE, np->tx_status, 
+        pci_free_consistent(pdev, STATUS_TOTAL_SIZE, np->tx_status,
                np->tx_status_dma);
        pci_free_consistent(pdev, RX_TOTAL_SIZE, np->rx_ring, np->rx_ring_dma);
        pci_free_consistent(pdev, TX_TOTAL_SIZE, np->tx_ring, np->tx_ring_dma);
@@ -1471,7 +1411,7 @@ static int __init yellowfin_init (void)
 #ifdef MODULE
        printk(version);
 #endif
-       return pci_module_init (&yellowfin_driver);
+       return pci_register_driver(&yellowfin_driver);
 }
 
 
@@ -1483,7 +1423,7 @@ static void __exit yellowfin_cleanup (void)
 
 module_init(yellowfin_init);
 module_exit(yellowfin_cleanup);
-\f
+
 /*
  * Local variables:
  *  compile-command: "gcc -DMODULE -Wall -Wstrict-prototypes -O6 -c yellowfin.c"