diff options
author | Stephen Hemminger <shemminger@vyatta.com> | 2009-01-06 21:40:43 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-01-06 21:40:43 +0300 |
commit | af0490810cfa159b4894ddecfc5eb2e4432fb976 (patch) | |
tree | 7c5074c11633b5c9cfa1489859d015974be5fe32 /drivers/net/irda/via-ircc.c | |
parent | 46377bb311a7682f6240c954c48e81a1e4f51e66 (diff) | |
download | linux-af0490810cfa159b4894ddecfc5eb2e4432fb976.tar.xz |
irda: convert to internal stats
Convert IRDA drivers to use already existing net_device_stats structure
in network device. This is a pre-cursor to conversion to net_device
ops. Compile tested only.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/irda/via-ircc.c')
-rw-r--r-- | drivers/net/irda/via-ircc.c | 47 |
1 files changed, 18 insertions, 29 deletions
diff --git a/drivers/net/irda/via-ircc.c b/drivers/net/irda/via-ircc.c index 74c78cf7a333..8b3e545924cc 100644 --- a/drivers/net/irda/via-ircc.c +++ b/drivers/net/irda/via-ircc.c @@ -101,8 +101,6 @@ static int via_ircc_net_open(struct net_device *dev); static int via_ircc_net_close(struct net_device *dev); static int via_ircc_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); -static struct net_device_stats *via_ircc_net_get_stats(struct net_device - *dev); static void via_ircc_change_dongle_speed(int iobase, int speed, int dongle_id); static int RxTimerHandler(struct via_ircc_cb *self, int iobase); @@ -434,7 +432,6 @@ static __devinit int via_ircc_open(int i, chipio_t * info, unsigned int id) dev->open = via_ircc_net_open; dev->stop = via_ircc_net_close; dev->do_ioctl = via_ircc_net_ioctl; - dev->get_stats = via_ircc_net_get_stats; err = register_netdev(dev); if (err) @@ -855,7 +852,7 @@ static int via_ircc_hard_xmit_sir(struct sk_buff *skb, async_wrap_skb(skb, self->tx_buff.data, self->tx_buff.truesize); - self->stats.tx_bytes += self->tx_buff.len; + dev->stats.tx_bytes += self->tx_buff.len; /* Send this frame with old speed */ SetBaudRate(iobase, self->io.speed); SetPulseWidth(iobase, 12); @@ -921,7 +918,7 @@ static int via_ircc_hard_xmit_fir(struct sk_buff *skb, self->tx_fifo.queue[self->tx_fifo.free].len = skb->len; self->tx_fifo.tail += skb->len; - self->stats.tx_bytes += skb->len; + dev->stats.tx_bytes += skb->len; skb_copy_from_linear_data(skb, self->tx_fifo.queue[self->tx_fifo.free].start, skb->len); self->tx_fifo.len++; @@ -990,12 +987,12 @@ static int via_ircc_dma_xmit_complete(struct via_ircc_cb *self) /* Clear bit, by writing 1 into it */ Tx_status = GetTXStatus(iobase); if (Tx_status & 0x08) { - self->stats.tx_errors++; - self->stats.tx_fifo_errors++; + self->netdev->stats.tx_errors++; + self->netdev->stats.tx_fifo_errors++; hwreset(self); // how to clear underrrun ? } else { - self->stats.tx_packets++; + self->netdev->stats.tx_packets++; ResetChip(iobase, 3); ResetChip(iobase, 4); } @@ -1119,8 +1116,8 @@ static int via_ircc_dma_receive_complete(struct via_ircc_cb *self, } // Move to next frame self->rx_buff.data += len; - self->stats.rx_bytes += len; - self->stats.rx_packets++; + self->netdev->stats.rx_bytes += len; + self->netdev->stats.rx_packets++; skb->dev = self->netdev; skb_reset_mac_header(skb); skb->protocol = htons(ETH_P_IRDA); @@ -1180,7 +1177,7 @@ F01_E */ */ if ((skb == NULL) || (skb->data == NULL) || (self->rx_buff.data == NULL) || (len < 6)) { - self->stats.rx_dropped++; + self->netdev->stats.rx_dropped++; return TRUE; } skb_reserve(skb, 1); @@ -1192,8 +1189,8 @@ F01_E */ // Move to next frame self->rx_buff.data += len; - self->stats.rx_bytes += len; - self->stats.rx_packets++; + self->netdev->stats.rx_bytes += len; + self->netdev->stats.rx_packets++; skb->dev = self->netdev; skb_reset_mac_header(skb); skb->protocol = htons(ETH_P_IRDA); @@ -1220,13 +1217,13 @@ static int upload_rxdata(struct via_ircc_cb *self, int iobase) IRDA_DEBUG(2, "%s(): len=%x\n", __func__, len); if ((len - 4) < 2) { - self->stats.rx_dropped++; + self->netdev->stats.rx_dropped++; return FALSE; } skb = dev_alloc_skb(len + 1); if (skb == NULL) { - self->stats.rx_dropped++; + self->netdev->stats.rx_dropped++; return FALSE; } skb_reserve(skb, 1); @@ -1238,8 +1235,8 @@ static int upload_rxdata(struct via_ircc_cb *self, int iobase) st_fifo->tail = 0; // Move to next frame self->rx_buff.data += len; - self->stats.rx_bytes += len; - self->stats.rx_packets++; + self->netdev->stats.rx_bytes += len; + self->netdev->stats.rx_packets++; skb->dev = self->netdev; skb_reset_mac_header(skb); skb->protocol = htons(ETH_P_IRDA); @@ -1295,7 +1292,7 @@ static int RxTimerHandler(struct via_ircc_cb *self, int iobase) */ if ((skb == NULL) || (skb->data == NULL) || (self->rx_buff.data == NULL) || (len < 6)) { - self->stats.rx_dropped++; + self->netdev->stats.rx_dropped++; continue; } skb_reserve(skb, 1); @@ -1307,8 +1304,8 @@ static int RxTimerHandler(struct via_ircc_cb *self, int iobase) // Move to next frame self->rx_buff.data += len; - self->stats.rx_bytes += len; - self->stats.rx_packets++; + self->netdev->stats.rx_bytes += len; + self->netdev->stats.rx_packets++; skb->dev = self->netdev; skb_reset_mac_header(skb); skb->protocol = htons(ETH_P_IRDA); @@ -1523,7 +1520,7 @@ static int via_ircc_net_open(struct net_device *dev) IRDA_ASSERT(dev != NULL, return -1;); self = netdev_priv(dev); - self->stats.rx_packets = 0; + dev->stats.rx_packets = 0; IRDA_ASSERT(self != NULL, return 0;); iobase = self->io.fir_base; if (request_irq(self->io.irq, via_ircc_interrupt, 0, dev->name, dev)) { @@ -1660,14 +1657,6 @@ static int via_ircc_net_ioctl(struct net_device *dev, struct ifreq *rq, return ret; } -static struct net_device_stats *via_ircc_net_get_stats(struct net_device - *dev) -{ - struct via_ircc_cb *self = netdev_priv(dev); - - return &self->stats; -} - MODULE_AUTHOR("VIA Technologies,inc"); MODULE_DESCRIPTION("VIA IrDA Device Driver"); MODULE_LICENSE("GPL"); |