aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/irda/nsc-ircc.c
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@vyatta.com>2009-01-06 13:40:43 -0500
committerDavid S. Miller <davem@davemloft.net>2009-01-06 13:40:43 -0500
commitaf0490810cfa159b4894ddecfc5eb2e4432fb976 (patch)
tree7c5074c11633b5c9cfa1489859d015974be5fe32 /drivers/net/irda/nsc-ircc.c
parent46377bb311a7682f6240c954c48e81a1e4f51e66 (diff)
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/nsc-ircc.c')
-rw-r--r--drivers/net/irda/nsc-ircc.c45
1 files changed, 18 insertions, 27 deletions
diff --git a/drivers/net/irda/nsc-ircc.c b/drivers/net/irda/nsc-ircc.c
index 2c6bf2d11bb1..61e509cb712a 100644
--- a/drivers/net/irda/nsc-ircc.c
+++ b/drivers/net/irda/nsc-ircc.c
@@ -185,7 +185,6 @@ static void nsc_ircc_init_dongle_interface (int iobase, int dongle_id);
185static int nsc_ircc_net_open(struct net_device *dev); 185static int nsc_ircc_net_open(struct net_device *dev);
186static int nsc_ircc_net_close(struct net_device *dev); 186static int nsc_ircc_net_close(struct net_device *dev);
187static int nsc_ircc_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); 187static int nsc_ircc_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
188static struct net_device_stats *nsc_ircc_net_get_stats(struct net_device *dev);
189 188
190/* Globals */ 189/* Globals */
191static int pnp_registered; 190static int pnp_registered;
@@ -446,7 +445,6 @@ static int __init nsc_ircc_open(chipio_t *info)
446 dev->open = nsc_ircc_net_open; 445 dev->open = nsc_ircc_net_open;
447 dev->stop = nsc_ircc_net_close; 446 dev->stop = nsc_ircc_net_close;
448 dev->do_ioctl = nsc_ircc_net_ioctl; 447 dev->do_ioctl = nsc_ircc_net_ioctl;
449 dev->get_stats = nsc_ircc_net_get_stats;
450 448
451 err = register_netdev(dev); 449 err = register_netdev(dev);
452 if (err) { 450 if (err) {
@@ -1401,7 +1399,7 @@ static int nsc_ircc_hard_xmit_sir(struct sk_buff *skb, struct net_device *dev)
1401 self->tx_buff.len = async_wrap_skb(skb, self->tx_buff.data, 1399 self->tx_buff.len = async_wrap_skb(skb, self->tx_buff.data,
1402 self->tx_buff.truesize); 1400 self->tx_buff.truesize);
1403 1401
1404 self->stats.tx_bytes += self->tx_buff.len; 1402 dev->stats.tx_bytes += self->tx_buff.len;
1405 1403
1406 /* Add interrupt on tx low level (will fire immediately) */ 1404 /* Add interrupt on tx low level (will fire immediately) */
1407 switch_bank(iobase, BANK0); 1405 switch_bank(iobase, BANK0);
@@ -1473,7 +1471,7 @@ static int nsc_ircc_hard_xmit_fir(struct sk_buff *skb, struct net_device *dev)
1473 self->tx_fifo.queue[self->tx_fifo.free].len = skb->len; 1471 self->tx_fifo.queue[self->tx_fifo.free].len = skb->len;
1474 self->tx_fifo.tail += skb->len; 1472 self->tx_fifo.tail += skb->len;
1475 1473
1476 self->stats.tx_bytes += skb->len; 1474 dev->stats.tx_bytes += skb->len;
1477 1475
1478 skb_copy_from_linear_data(skb, self->tx_fifo.queue[self->tx_fifo.free].start, 1476 skb_copy_from_linear_data(skb, self->tx_fifo.queue[self->tx_fifo.free].start,
1479 skb->len); 1477 skb->len);
@@ -1652,13 +1650,13 @@ static int nsc_ircc_dma_xmit_complete(struct nsc_ircc_cb *self)
1652 1650
1653 /* Check for underrrun! */ 1651 /* Check for underrrun! */
1654 if (inb(iobase+ASCR) & ASCR_TXUR) { 1652 if (inb(iobase+ASCR) & ASCR_TXUR) {
1655 self->stats.tx_errors++; 1653 self->netdev->stats.tx_errors++;
1656 self->stats.tx_fifo_errors++; 1654 self->netdev->stats.tx_fifo_errors++;
1657 1655
1658 /* Clear bit, by writing 1 into it */ 1656 /* Clear bit, by writing 1 into it */
1659 outb(ASCR_TXUR, iobase+ASCR); 1657 outb(ASCR_TXUR, iobase+ASCR);
1660 } else { 1658 } else {
1661 self->stats.tx_packets++; 1659 self->netdev->stats.tx_packets++;
1662 } 1660 }
1663 1661
1664 /* Finished with this frame, so prepare for next */ 1662 /* Finished with this frame, so prepare for next */
@@ -1793,28 +1791,28 @@ static int nsc_ircc_dma_receive_complete(struct nsc_ircc_cb *self, int iobase)
1793 if (status & FRM_ST_ERR_MSK) { 1791 if (status & FRM_ST_ERR_MSK) {
1794 if (status & FRM_ST_LOST_FR) { 1792 if (status & FRM_ST_LOST_FR) {
1795 /* Add number of lost frames to stats */ 1793 /* Add number of lost frames to stats */
1796 self->stats.rx_errors += len; 1794 self->netdev->stats.rx_errors += len;
1797 } else { 1795 } else {
1798 /* Skip frame */ 1796 /* Skip frame */
1799 self->stats.rx_errors++; 1797 self->netdev->stats.rx_errors++;
1800 1798
1801 self->rx_buff.data += len; 1799 self->rx_buff.data += len;
1802 1800
1803 if (status & FRM_ST_MAX_LEN) 1801 if (status & FRM_ST_MAX_LEN)
1804 self->stats.rx_length_errors++; 1802 self->netdev->stats.rx_length_errors++;
1805 1803
1806 if (status & FRM_ST_PHY_ERR) 1804 if (status & FRM_ST_PHY_ERR)
1807 self->stats.rx_frame_errors++; 1805 self->netdev->stats.rx_frame_errors++;
1808 1806
1809 if (status & FRM_ST_BAD_CRC) 1807 if (status & FRM_ST_BAD_CRC)
1810 self->stats.rx_crc_errors++; 1808 self->netdev->stats.rx_crc_errors++;
1811 } 1809 }
1812 /* The errors below can be reported in both cases */ 1810 /* The errors below can be reported in both cases */
1813 if (status & FRM_ST_OVR1) 1811 if (status & FRM_ST_OVR1)
1814 self->stats.rx_fifo_errors++; 1812 self->netdev->stats.rx_fifo_errors++;
1815 1813
1816 if (status & FRM_ST_OVR2) 1814 if (status & FRM_ST_OVR2)
1817 self->stats.rx_fifo_errors++; 1815 self->netdev->stats.rx_fifo_errors++;
1818 } else { 1816 } else {
1819 /* 1817 /*
1820 * First we must make sure that the frame we 1818 * First we must make sure that the frame we
@@ -1863,7 +1861,7 @@ static int nsc_ircc_dma_receive_complete(struct nsc_ircc_cb *self, int iobase)
1863 IRDA_WARNING("%s(), memory squeeze, " 1861 IRDA_WARNING("%s(), memory squeeze, "
1864 "dropping frame.\n", 1862 "dropping frame.\n",
1865 __func__); 1863 __func__);
1866 self->stats.rx_dropped++; 1864 self->netdev->stats.rx_dropped++;
1867 1865
1868 /* Restore bank register */ 1866 /* Restore bank register */
1869 outb(bank, iobase+BSR); 1867 outb(bank, iobase+BSR);
@@ -1889,8 +1887,8 @@ static int nsc_ircc_dma_receive_complete(struct nsc_ircc_cb *self, int iobase)
1889 1887
1890 /* Move to next frame */ 1888 /* Move to next frame */
1891 self->rx_buff.data += len; 1889 self->rx_buff.data += len;
1892 self->stats.rx_bytes += len; 1890 self->netdev->stats.rx_bytes += len;
1893 self->stats.rx_packets++; 1891 self->netdev->stats.rx_packets++;
1894 1892
1895 skb->dev = self->netdev; 1893 skb->dev = self->netdev;
1896 skb_reset_mac_header(skb); 1894 skb_reset_mac_header(skb);
@@ -1920,8 +1918,8 @@ static void nsc_ircc_pio_receive(struct nsc_ircc_cb *self)
1920 /* Receive all characters in Rx FIFO */ 1918 /* Receive all characters in Rx FIFO */
1921 do { 1919 do {
1922 byte = inb(iobase+RXD); 1920 byte = inb(iobase+RXD);
1923 async_unwrap_char(self->netdev, &self->stats, &self->rx_buff, 1921 async_unwrap_char(self->netdev, &self->netdev->stats,
1924 byte); 1922 &self->rx_buff, byte);
1925 } while (inb(iobase+LSR) & LSR_RXDA); /* Data available */ 1923 } while (inb(iobase+LSR) & LSR_RXDA); /* Data available */
1926} 1924}
1927 1925
@@ -1952,7 +1950,7 @@ static void nsc_ircc_sir_interrupt(struct nsc_ircc_cb *self, int eir)
1952 self->ier = IER_TXLDL_IE; 1950 self->ier = IER_TXLDL_IE;
1953 else { 1951 else {
1954 1952
1955 self->stats.tx_packets++; 1953 self->netdev->stats.tx_packets++;
1956 netif_wake_queue(self->netdev); 1954 netif_wake_queue(self->netdev);
1957 self->ier = IER_TXEMP_IE; 1955 self->ier = IER_TXEMP_IE;
1958 } 1956 }
@@ -2307,13 +2305,6 @@ static int nsc_ircc_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
2307 return ret; 2305 return ret;
2308} 2306}
2309 2307
2310static struct net_device_stats *nsc_ircc_net_get_stats(struct net_device *dev)
2311{
2312 struct nsc_ircc_cb *self = netdev_priv(dev);
2313
2314 return &self->stats;
2315}
2316
2317static int nsc_ircc_suspend(struct platform_device *dev, pm_message_t state) 2308static int nsc_ircc_suspend(struct platform_device *dev, pm_message_t state)
2318{ 2309{
2319 struct nsc_ircc_cb *self = platform_get_drvdata(dev); 2310 struct nsc_ircc_cb *self = platform_get_drvdata(dev);