]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/net/dm9000.c
[NET] drivers/net: statistics cleanup #1 -- save memory and shrink code
[karo-tx-linux.git] / drivers / net / dm9000.c
index 857eb366bb115c153d676c914e03b0d62d0ea607..f691ef61b2d3ed2778a2083d321dec8f6d9768fc 100644 (file)
@@ -148,7 +148,6 @@ typedef struct board_info {
        struct resource *irq_res;
 
        struct timer_list timer;
-       struct net_device_stats stats;
        unsigned char srom[128];
        spinlock_t lock;
 
@@ -166,8 +165,6 @@ static int dm9000_stop(struct net_device *);
 static void dm9000_timer(unsigned long);
 static void dm9000_init_dm9000(struct net_device *);
 
-static struct net_device_stats *dm9000_get_stats(struct net_device *);
-
 static irqreturn_t dm9000_interrupt(int, void *);
 
 static int dm9000_phy_read(struct net_device *dev, int phyaddr_unsused, int reg);
@@ -558,7 +555,6 @@ dm9000_probe(struct platform_device *pdev)
        ndev->tx_timeout         = &dm9000_timeout;
        ndev->watchdog_timeo = msecs_to_jiffies(watchdog);
        ndev->stop               = &dm9000_stop;
-       ndev->get_stats          = &dm9000_get_stats;
        ndev->set_multicast_list = &dm9000_hash_table;
 #ifdef CONFIG_NET_POLL_CONTROLLER
        ndev->poll_controller    = &dm9000_poll_controller;
@@ -713,7 +709,7 @@ dm9000_start_xmit(struct sk_buff *skb, struct net_device *dev)
        writeb(DM9000_MWCMD, db->io_addr);
 
        (db->outblk)(db->io_data, skb->data, skb->len);
-       db->stats.tx_bytes += skb->len;
+       dev->stats.tx_bytes += skb->len;
 
        db->tx_pkt_cnt++;
        /* TX control: First packet immediately send, second packet queue */
@@ -790,7 +786,7 @@ dm9000_tx_done(struct net_device *dev, board_info_t * db)
        if (tx_status & (NSR_TX2END | NSR_TX1END)) {
                /* One packet sent complete */
                db->tx_pkt_cnt--;
-               db->stats.tx_packets++;
+               dev->stats.tx_packets++;
 
                /* Queue packet check & send */
                if (db->tx_pkt_cnt > 0) {
@@ -851,17 +847,6 @@ dm9000_interrupt(int irq, void *dev_id)
        return IRQ_HANDLED;
 }
 
-/*
- *  Get statistics from driver.
- */
-static struct net_device_stats *
-dm9000_get_stats(struct net_device *dev)
-{
-       board_info_t *db = (board_info_t *) dev->priv;
-       return &db->stats;
-}
-
-
 /*
  *  A periodic timer routine
  *  Dynamic media sense, allocated Rx buffer...
@@ -939,15 +924,15 @@ dm9000_rx(struct net_device *dev)
                        GoodPacket = false;
                        if (rxhdr.RxStatus & 0x100) {
                                PRINTK1("fifo error\n");
-                               db->stats.rx_fifo_errors++;
+                               dev->stats.rx_fifo_errors++;
                        }
                        if (rxhdr.RxStatus & 0x200) {
                                PRINTK1("crc error\n");
-                               db->stats.rx_crc_errors++;
+                               dev->stats.rx_crc_errors++;
                        }
                        if (rxhdr.RxStatus & 0x8000) {
                                PRINTK1("length error\n");
-                               db->stats.rx_length_errors++;
+                               dev->stats.rx_length_errors++;
                        }
                }
 
@@ -960,12 +945,12 @@ dm9000_rx(struct net_device *dev)
                        /* Read received packet from RX SRAM */
 
                        (db->inblk)(db->io_data, rdptr, RxLen);
-                       db->stats.rx_bytes += RxLen;
+                       dev->stats.rx_bytes += RxLen;
 
                        /* Pass to upper layer */
                        skb->protocol = eth_type_trans(skb, dev);
                        netif_rx(skb);
-                       db->stats.rx_packets++;
+                       dev->stats.rx_packets++;
 
                } else {
                        /* need to dump the packet's data */