]> nv-tegra.nvidia Code Review - linux-2.6.git/blobdiff - drivers/net/fealnx.c
bcmdhd: use the wiphy from private data structure (i.e., wl_priv)
[linux-2.6.git] / drivers / net / fealnx.c
index 51b738dd65475bb604362cc7d759455f696f12d8..fa8677c323848ee4f9f0a0d6fee670dc05c64dc3 100644 (file)
@@ -382,8 +382,6 @@ struct netdev_private {
 
        spinlock_t lock;
 
-       struct net_device_stats stats;
-
        /* Media monitoring timer. */
        struct timer_list timer;
 
@@ -568,7 +566,7 @@ static int __devinit fealnx_init_one(struct pci_dev *pdev,
                err = -ENOMEM;
                goto err_out_free_dev;
        }
-       np->rx_ring = (struct fealnx_desc *)ring_space;
+       np->rx_ring = ring_space;
        np->rx_ring_dma = ring_dma;
 
        ring_space = pci_alloc_consistent(pdev, TX_TOTAL_SIZE, &ring_dma);
@@ -576,7 +574,7 @@ static int __devinit fealnx_init_one(struct pci_dev *pdev,
                err = -ENOMEM;
                goto err_out_free_rx;
        }
-       np->tx_ring = (struct fealnx_desc *)ring_space;
+       np->tx_ring = ring_space;
        np->tx_ring_dma = ring_dma;
 
        /* find the connected MII xcvrs */
@@ -917,14 +915,14 @@ static int netdev_open(struct net_device *dev)
        init_timer(&np->timer);
        np->timer.expires = RUN_AT(3 * HZ);
        np->timer.data = (unsigned long) dev;
-       np->timer.function = &netdev_timer;
+       np->timer.function = netdev_timer;
 
        /* timer handler */
        add_timer(&np->timer);
 
        init_timer(&np->reset_timer);
        np->reset_timer.data = (unsigned long) dev;
-       np->reset_timer.function = &reset_timer;
+       np->reset_timer.function = reset_timer;
        np->reset_timer_armed = 0;
 
        return 0;
@@ -1233,8 +1231,8 @@ static void fealnx_tx_timeout(struct net_device *dev)
 
        spin_unlock_irqrestore(&np->lock, flags);
 
-       dev->trans_start = jiffies;
-       np->stats.tx_errors++;
+       dev->trans_start = jiffies; /* prevent tx timeout */
+       dev->stats.tx_errors++;
        netif_wake_queue(dev); /* or .._start_.. ?? */
 }
 
@@ -1374,7 +1372,6 @@ static netdev_tx_t start_tx(struct sk_buff *skb, struct net_device *dev)
                netif_stop_queue(dev);
        ++np->really_tx_count;
        iowrite32(0, np->mem + TXPDR);
-       dev->trans_start = jiffies;
 
        spin_unlock_irqrestore(&np->lock, flags);
        return NETDEV_TX_OK;
@@ -1480,10 +1477,11 @@ static irqreturn_t intr_handler(int irq, void *dev_instance)
 
                if (intr_status & CNTOVF) {
                        /* missed pkts */
-                       np->stats.rx_missed_errors += ioread32(ioaddr + TALLY) & 0x7fff;
+                       dev->stats.rx_missed_errors +=
+                               ioread32(ioaddr + TALLY) & 0x7fff;
 
                        /* crc error */
-                       np->stats.rx_crc_errors +=
+                       dev->stats.rx_crc_errors +=
                            (ioread32(ioaddr + TALLY) & 0x7fff0000) >> 16;
                }
 
@@ -1514,30 +1512,30 @@ static irqreturn_t intr_handler(int irq, void *dev_instance)
 
                        if (!(np->crvalue & CR_W_ENH)) {
                                if (tx_status & (CSL | LC | EC | UDF | HF)) {
-                                       np->stats.tx_errors++;
+                                       dev->stats.tx_errors++;
                                        if (tx_status & EC)
-                                               np->stats.tx_aborted_errors++;
+                                               dev->stats.tx_aborted_errors++;
                                        if (tx_status & CSL)
-                                               np->stats.tx_carrier_errors++;
+                                               dev->stats.tx_carrier_errors++;
                                        if (tx_status & LC)
-                                               np->stats.tx_window_errors++;
+                                               dev->stats.tx_window_errors++;
                                        if (tx_status & UDF)
-                                               np->stats.tx_fifo_errors++;
+                                               dev->stats.tx_fifo_errors++;
                                        if ((tx_status & HF) && np->mii.full_duplex == 0)
-                                               np->stats.tx_heartbeat_errors++;
+                                               dev->stats.tx_heartbeat_errors++;
 
                                } else {
-                                       np->stats.tx_bytes +=
+                                       dev->stats.tx_bytes +=
                                            ((tx_control & PKTSMask) >> PKTSShift);
 
-                                       np->stats.collisions +=
+                                       dev->stats.collisions +=
                                            ((tx_status & NCRMask) >> NCRShift);
-                                       np->stats.tx_packets++;
+                                       dev->stats.tx_packets++;
                                }
                        } else {
-                               np->stats.tx_bytes +=
+                               dev->stats.tx_bytes +=
                                    ((tx_control & PKTSMask) >> PKTSShift);
-                               np->stats.tx_packets++;
+                               dev->stats.tx_packets++;
                        }
 
                        /* Free the original skb. */
@@ -1565,10 +1563,12 @@ static irqreturn_t intr_handler(int irq, void *dev_instance)
                        long data;
 
                        data = ioread32(ioaddr + TSR);
-                       np->stats.tx_errors += (data & 0xff000000) >> 24;
-                       np->stats.tx_aborted_errors += (data & 0xff000000) >> 24;
-                       np->stats.tx_window_errors += (data & 0x00ff0000) >> 16;
-                       np->stats.collisions += (data & 0x0000ffff);
+                       dev->stats.tx_errors += (data & 0xff000000) >> 24;
+                       dev->stats.tx_aborted_errors +=
+                               (data & 0xff000000) >> 24;
+                       dev->stats.tx_window_errors +=
+                               (data & 0x00ff0000) >> 16;
+                       dev->stats.collisions += (data & 0x0000ffff);
                }
 
                if (--boguscnt < 0) {
@@ -1594,10 +1594,11 @@ static irqreturn_t intr_handler(int irq, void *dev_instance)
 
        /* read the tally counters */
        /* missed pkts */
-       np->stats.rx_missed_errors += ioread32(ioaddr + TALLY) & 0x7fff;
+       dev->stats.rx_missed_errors += ioread32(ioaddr + TALLY) & 0x7fff;
 
        /* crc error */
-       np->stats.rx_crc_errors += (ioread32(ioaddr + TALLY) & 0x7fff0000) >> 16;
+       dev->stats.rx_crc_errors +=
+               (ioread32(ioaddr + TALLY) & 0x7fff0000) >> 16;
 
        if (debug)
                printk(KERN_DEBUG "%s: exiting interrupt, status=%#4.4x.\n",
@@ -1636,13 +1637,13 @@ static int netdev_rx(struct net_device *dev)
                                               "%s: Receive error, Rx status %8.8x.\n",
                                               dev->name, rx_status);
 
-                               np->stats.rx_errors++;  /* end of a packet. */
+                               dev->stats.rx_errors++; /* end of a packet. */
                                if (rx_status & (LONG | RUNT))
-                                       np->stats.rx_length_errors++;
+                                       dev->stats.rx_length_errors++;
                                if (rx_status & RXER)
-                                       np->stats.rx_frame_errors++;
+                                       dev->stats.rx_frame_errors++;
                                if (rx_status & CRC)
-                                       np->stats.rx_crc_errors++;
+                                       dev->stats.rx_crc_errors++;
                        } else {
                                int need_to_reset = 0;
                                int desno = 0;
@@ -1668,7 +1669,7 @@ static int netdev_rx(struct net_device *dev)
                                if (need_to_reset == 0) {
                                        int i;
 
-                                       np->stats.rx_length_errors++;
+                                       dev->stats.rx_length_errors++;
 
                                        /* free all rx descriptors related this long pkt */
                                        for (i = 0; i < desno; ++i) {
@@ -1734,8 +1735,8 @@ static int netdev_rx(struct net_device *dev)
                        }
                        skb->protocol = eth_type_trans(skb, dev);
                        netif_rx(skb);
-                       np->stats.rx_packets++;
-                       np->stats.rx_bytes += pkt_len;
+                       dev->stats.rx_packets++;
+                       dev->stats.rx_bytes += pkt_len;
                }
 
                np->cur_rx = np->cur_rx->next_desc_logical;
@@ -1755,11 +1756,13 @@ static struct net_device_stats *get_stats(struct net_device *dev)
 
        /* The chip only need report frame silently dropped. */
        if (netif_running(dev)) {
-               np->stats.rx_missed_errors += ioread32(ioaddr + TALLY) & 0x7fff;
-               np->stats.rx_crc_errors += (ioread32(ioaddr + TALLY) & 0x7fff0000) >> 16;
+               dev->stats.rx_missed_errors +=
+                       ioread32(ioaddr + TALLY) & 0x7fff;
+               dev->stats.rx_crc_errors +=
+                       (ioread32(ioaddr + TALLY) & 0x7fff0000) >> 16;
        }
 
-       return &np->stats;
+       return &dev->stats;
 }