Merge master.kernel.org:/home/rmk/linux-2.6-arm
[safe/jmp/linux-2.6] / drivers / net / seeq8005.c
index 4bce7c4..374832c 100644 (file)
@@ -37,7 +37,6 @@ static const char version[] =
 #include <linux/interrupt.h>
 #include <linux/ioport.h>
 #include <linux/in.h>
-#include <linux/slab.h>
 #include <linux/string.h>
 #include <linux/init.h>
 #include <linux/delay.h>
@@ -67,7 +66,6 @@ static unsigned int net_debug = NET_DEBUG;
 
 /* Information that need to be kept for each board. */
 struct net_local {
-       struct net_device_stats stats;
        unsigned short receive_ptr;             /* What address in packet memory do we expect a recv_pkt_header? */
        long open_time;                         /* Useless example local info. */
 };
@@ -82,11 +80,11 @@ struct net_local {
 static int seeq8005_probe1(struct net_device *dev, int ioaddr);
 static int seeq8005_open(struct net_device *dev);
 static void seeq8005_timeout(struct net_device *dev);
-static int seeq8005_send_packet(struct sk_buff *skb, struct net_device *dev);
+static netdev_tx_t seeq8005_send_packet(struct sk_buff *skb,
+                                       struct net_device *dev);
 static irqreturn_t seeq8005_interrupt(int irq, void *dev_id);
 static void seeq8005_rx(struct net_device *dev);
 static int seeq8005_close(struct net_device *dev);
-static struct net_device_stats *seeq8005_get_stats(struct net_device *dev);
 static void set_multicast_list(struct net_device *dev);
 
 /* Example routines you must write ;->. */
@@ -145,6 +143,17 @@ out:
        return ERR_PTR(err);
 }
 
+static const struct net_device_ops seeq8005_netdev_ops = {
+       .ndo_open               = seeq8005_open,
+       .ndo_stop               = seeq8005_close,
+       .ndo_start_xmit         = seeq8005_send_packet,
+       .ndo_tx_timeout         = seeq8005_timeout,
+       .ndo_set_multicast_list = set_multicast_list,
+       .ndo_change_mtu         = eth_change_mtu,
+       .ndo_set_mac_address    = eth_mac_addr,
+       .ndo_validate_addr      = eth_validate_addr,
+};
+
 /* This is the real probe routine.  Linux has a history of friendly device
    probes on the ISA bus.  A good device probes avoids doing writes, and
    verifies that the correct device exists and functions.  */
@@ -303,7 +312,8 @@ static int __init seeq8005_probe1(struct net_device *dev, int ioaddr)
 
        /* Retrieve and print the ethernet address. */
        for (i = 0; i < 6; i++)
-               printk(" %2.2x", dev->dev_addr[i] = SA_prom[i+6]);
+               dev->dev_addr[i] = SA_prom[i+6];
+       printk("%pM", dev->dev_addr);
 
        if (dev->irq == 0xff)
                ;                       /* Do nothing: a user-level program will set it. */
@@ -324,7 +334,7 @@ static int __init seeq8005_probe1(struct net_device *dev, int ioaddr)
 
 #if 0
        {
-                int irqval = request_irq(dev->irq, &seeq8005_interrupt, 0, "seeq8005", dev);
+                int irqval = request_irq(dev->irq, seeq8005_interrupt, 0, "seeq8005", dev);
                 if (irqval) {
                         printk ("%s: unable to get IRQ %d (irqval=%d).\n", dev->name,
                                         dev->irq, irqval);
@@ -333,13 +343,8 @@ static int __init seeq8005_probe1(struct net_device *dev, int ioaddr)
                 }
        }
 #endif
-       dev->open               = seeq8005_open;
-       dev->stop               = seeq8005_close;
-       dev->hard_start_xmit    = seeq8005_send_packet;
-       dev->tx_timeout         = seeq8005_timeout;
+       dev->netdev_ops = &seeq8005_netdev_ops;
        dev->watchdog_timeo     = HZ/20;
-       dev->get_stats          = seeq8005_get_stats;
-       dev->set_multicast_list = set_multicast_list;
        dev->flags &= ~IFF_MULTICAST;
 
        return 0;
@@ -361,7 +366,7 @@ static int seeq8005_open(struct net_device *dev)
        struct net_local *lp = netdev_priv(dev);
 
        {
-                int irqval = request_irq(dev->irq, &seeq8005_interrupt, 0, "seeq8005", dev);
+                int irqval = request_irq(dev->irq, seeq8005_interrupt, 0, "seeq8005", dev);
                 if (irqval) {
                         printk ("%s: unable to get IRQ %d (irqval=%d).\n", dev->name,
                                         dev->irq, irqval);
@@ -389,15 +394,15 @@ static void seeq8005_timeout(struct net_device *dev)
        netif_wake_queue(dev);
 }
 
-static int seeq8005_send_packet(struct sk_buff *skb, struct net_device *dev)
+static netdev_tx_t seeq8005_send_packet(struct sk_buff *skb,
+                                       struct net_device *dev)
 {
-       struct net_local *lp = netdev_priv(dev);
        short length = skb->len;
        unsigned char *buf;
 
        if (length < ETH_ZLEN) {
                if (skb_padto(skb, ETH_ZLEN))
-                       return 0;
+                       return NETDEV_TX_OK;
                length = ETH_ZLEN;
        }
        buf = skb->data;
@@ -407,11 +412,11 @@ static int seeq8005_send_packet(struct sk_buff *skb, struct net_device *dev)
 
        hardware_send_packet(dev, buf, length);
        dev->trans_start = jiffies;
-       lp->stats.tx_bytes += length;
+       dev->stats.tx_bytes += length;
        dev_kfree_skb (skb);
        /* You might need to clean up and record Tx statistics here. */
 
-       return 0;
+       return NETDEV_TX_OK;
 }
 
 /*
@@ -463,7 +468,7 @@ static irqreturn_t seeq8005_interrupt(int irq, void *dev_id)
                if (status & SEEQSTAT_TX_INT) {
                        handled = 1;
                        outw( SEEQCMD_TX_INT_ACK | (status & SEEQCMD_INT_MASK), SEEQ_CMD);
-                       lp->stats.tx_packets++;
+                       dev->stats.tx_packets++;
                        netif_wake_queue(dev);  /* Inform upper layers. */
                }
                if (status & SEEQSTAT_RX_INT) {
@@ -531,11 +536,11 @@ static void seeq8005_rx(struct net_device *dev)
                }
 
                if (pkt_hdr & SEEQPKTS_ANY_ERROR) {                             /* There was an error. */
-                       lp->stats.rx_errors++;
-                       if (pkt_hdr & SEEQPKTS_SHORT) lp->stats.rx_frame_errors++;
-                       if (pkt_hdr & SEEQPKTS_DRIB) lp->stats.rx_frame_errors++;
-                       if (pkt_hdr & SEEQPKTS_OVERSIZE) lp->stats.rx_over_errors++;
-                       if (pkt_hdr & SEEQPKTS_CRC_ERR) lp->stats.rx_crc_errors++;
+                       dev->stats.rx_errors++;
+                       if (pkt_hdr & SEEQPKTS_SHORT) dev->stats.rx_frame_errors++;
+                       if (pkt_hdr & SEEQPKTS_DRIB) dev->stats.rx_frame_errors++;
+                       if (pkt_hdr & SEEQPKTS_OVERSIZE) dev->stats.rx_over_errors++;
+                       if (pkt_hdr & SEEQPKTS_CRC_ERR) dev->stats.rx_crc_errors++;
                        /* skip over this packet */
                        outw( SEEQCMD_FIFO_WRITE | SEEQCMD_DMA_INT_ACK | (status & SEEQCMD_INT_MASK), SEEQ_CMD);
                        outw( (lp->receive_ptr & 0xff00)>>8, SEEQ_REA);
@@ -547,7 +552,7 @@ static void seeq8005_rx(struct net_device *dev)
                        skb = dev_alloc_skb(pkt_len);
                        if (skb == NULL) {
                                printk("%s: Memory squeeze, dropping packet.\n", dev->name);
-                               lp->stats.rx_dropped++;
+                               dev->stats.rx_dropped++;
                                break;
                        }
                        skb_reserve(skb, 2);    /* align data on 16 byte */
@@ -566,9 +571,8 @@ static void seeq8005_rx(struct net_device *dev)
 
                        skb->protocol=eth_type_trans(skb,dev);
                        netif_rx(skb);
-                       dev->last_rx = jiffies;
-                       lp->stats.rx_packets++;
-                       lp->stats.rx_bytes += pkt_len;
+                       dev->stats.rx_packets++;
+                       dev->stats.rx_bytes += pkt_len;
                }
        } while ((--boguscount) && (pkt_hdr & SEEQPKTH_CHAIN));
 
@@ -599,15 +603,6 @@ static int seeq8005_close(struct net_device *dev)
 
 }
 
-/* Get the current statistics. This may be called with the card open or
-   closed. */
-static struct net_device_stats *seeq8005_get_stats(struct net_device *dev)
-{
-       struct net_local *lp = netdev_priv(dev);
-
-       return &lp->stats;
-}
-
 /* Set or clear the multicast filter for this adaptor.
    num_addrs == -1     Promiscuous mode, receive all packets
    num_addrs == 0      Normal mode, clear multicast list
@@ -757,12 +752,3 @@ void __exit cleanup_module(void)
 }
 
 #endif /* MODULE */
-
-/*
- * Local variables:
- *  compile-command: "gcc -D__KERNEL__ -I/usr/src/linux/net/inet -Wall -Wstrict-prototypes -O6 -m486 -c skeleton.c"
- *  version-control: t
- *  kept-new-versions: 5
- *  tab-width: 4
- * End:
- */