aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/irda/ali-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/ali-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/ali-ircc.c')
-rw-r--r--drivers/net/irda/ali-ircc.c45
1 files changed, 16 insertions, 29 deletions
diff --git a/drivers/net/irda/ali-ircc.c b/drivers/net/irda/ali-ircc.c
index 3c58e67ef1e4..17779f9bffc4 100644
--- a/drivers/net/irda/ali-ircc.c
+++ b/drivers/net/irda/ali-ircc.c
@@ -109,7 +109,6 @@ static int ali_ircc_net_open(struct net_device *dev);
109static int ali_ircc_net_close(struct net_device *dev); 109static int ali_ircc_net_close(struct net_device *dev);
110static int ali_ircc_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); 110static int ali_ircc_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
111static void ali_ircc_change_speed(struct ali_ircc_cb *self, __u32 baud); 111static void ali_ircc_change_speed(struct ali_ircc_cb *self, __u32 baud);
112static struct net_device_stats *ali_ircc_net_get_stats(struct net_device *dev);
113 112
114/* SIR function */ 113/* SIR function */
115static int ali_ircc_sir_hard_xmit(struct sk_buff *skb, struct net_device *dev); 114static int ali_ircc_sir_hard_xmit(struct sk_buff *skb, struct net_device *dev);
@@ -366,7 +365,6 @@ static int ali_ircc_open(int i, chipio_t *info)
366 dev->open = ali_ircc_net_open; 365 dev->open = ali_ircc_net_open;
367 dev->stop = ali_ircc_net_close; 366 dev->stop = ali_ircc_net_close;
368 dev->do_ioctl = ali_ircc_net_ioctl; 367 dev->do_ioctl = ali_ircc_net_ioctl;
369 dev->get_stats = ali_ircc_net_get_stats;
370 368
371 err = register_netdev(dev); 369 err = register_netdev(dev);
372 if (err) { 370 if (err) {
@@ -876,7 +874,7 @@ static void ali_ircc_sir_receive(struct ali_ircc_cb *self)
876 * async_unwrap_char will deliver all found frames 874 * async_unwrap_char will deliver all found frames
877 */ 875 */
878 do { 876 do {
879 async_unwrap_char(self->netdev, &self->stats, &self->rx_buff, 877 async_unwrap_char(self->netdev, &self->netdev->stats, &self->rx_buff,
880 inb(iobase+UART_RX)); 878 inb(iobase+UART_RX));
881 879
882 /* Make sure we don't stay here too long */ 880 /* Make sure we don't stay here too long */
@@ -943,7 +941,7 @@ static void ali_ircc_sir_write_wakeup(struct ali_ircc_cb *self)
943 netif_wake_queue(self->netdev); 941 netif_wake_queue(self->netdev);
944 } 942 }
945 943
946 self->stats.tx_packets++; 944 self->netdev->stats.tx_packets++;
947 945
948 /* Turn on receive interrupts */ 946 /* Turn on receive interrupts */
949 outb(UART_IER_RDI, iobase+UART_IER); 947 outb(UART_IER_RDI, iobase+UART_IER);
@@ -1467,7 +1465,7 @@ static int ali_ircc_fir_hard_xmit(struct sk_buff *skb, struct net_device *dev)
1467 self->tx_fifo.queue[self->tx_fifo.free].len = skb->len; 1465 self->tx_fifo.queue[self->tx_fifo.free].len = skb->len;
1468 self->tx_fifo.tail += skb->len; 1466 self->tx_fifo.tail += skb->len;
1469 1467
1470 self->stats.tx_bytes += skb->len; 1468 dev->stats.tx_bytes += skb->len;
1471 1469
1472 skb_copy_from_linear_data(skb, self->tx_fifo.queue[self->tx_fifo.free].start, 1470 skb_copy_from_linear_data(skb, self->tx_fifo.queue[self->tx_fifo.free].start,
1473 skb->len); 1471 skb->len);
@@ -1661,12 +1659,12 @@ static int ali_ircc_dma_xmit_complete(struct ali_ircc_cb *self)
1661 1659
1662 { 1660 {
1663 IRDA_ERROR("%s(), ********* LSR_FRAME_ABORT *********\n", __func__); 1661 IRDA_ERROR("%s(), ********* LSR_FRAME_ABORT *********\n", __func__);
1664 self->stats.tx_errors++; 1662 self->netdev->stats.tx_errors++;
1665 self->stats.tx_fifo_errors++; 1663 self->netdev->stats.tx_fifo_errors++;
1666 } 1664 }
1667 else 1665 else
1668 { 1666 {
1669 self->stats.tx_packets++; 1667 self->netdev->stats.tx_packets++;
1670 } 1668 }
1671 1669
1672 /* Check if we need to change the speed */ 1670 /* Check if we need to change the speed */
@@ -1831,35 +1829,35 @@ static int ali_ircc_dma_receive_complete(struct ali_ircc_cb *self)
1831 IRDA_DEBUG(0,"%s(), ************* RX Errors ************ \n", __func__ ); 1829 IRDA_DEBUG(0,"%s(), ************* RX Errors ************ \n", __func__ );
1832 1830
1833 /* Skip frame */ 1831 /* Skip frame */
1834 self->stats.rx_errors++; 1832 self->netdev->stats.rx_errors++;
1835 1833
1836 self->rx_buff.data += len; 1834 self->rx_buff.data += len;
1837 1835
1838 if (status & LSR_FIFO_UR) 1836 if (status & LSR_FIFO_UR)
1839 { 1837 {
1840 self->stats.rx_frame_errors++; 1838 self->netdev->stats.rx_frame_errors++;
1841 IRDA_DEBUG(0,"%s(), ************* FIFO Errors ************ \n", __func__ ); 1839 IRDA_DEBUG(0,"%s(), ************* FIFO Errors ************ \n", __func__ );
1842 } 1840 }
1843 if (status & LSR_FRAME_ERROR) 1841 if (status & LSR_FRAME_ERROR)
1844 { 1842 {
1845 self->stats.rx_frame_errors++; 1843 self->netdev->stats.rx_frame_errors++;
1846 IRDA_DEBUG(0,"%s(), ************* FRAME Errors ************ \n", __func__ ); 1844 IRDA_DEBUG(0,"%s(), ************* FRAME Errors ************ \n", __func__ );
1847 } 1845 }
1848 1846
1849 if (status & LSR_CRC_ERROR) 1847 if (status & LSR_CRC_ERROR)
1850 { 1848 {
1851 self->stats.rx_crc_errors++; 1849 self->netdev->stats.rx_crc_errors++;
1852 IRDA_DEBUG(0,"%s(), ************* CRC Errors ************ \n", __func__ ); 1850 IRDA_DEBUG(0,"%s(), ************* CRC Errors ************ \n", __func__ );
1853 } 1851 }
1854 1852
1855 if(self->rcvFramesOverflow) 1853 if(self->rcvFramesOverflow)
1856 { 1854 {
1857 self->stats.rx_frame_errors++; 1855 self->netdev->stats.rx_frame_errors++;
1858 IRDA_DEBUG(0,"%s(), ************* Overran DMA buffer ************ \n", __func__ ); 1856 IRDA_DEBUG(0,"%s(), ************* Overran DMA buffer ************ \n", __func__ );
1859 } 1857 }
1860 if(len == 0) 1858 if(len == 0)
1861 { 1859 {
1862 self->stats.rx_frame_errors++; 1860 self->netdev->stats.rx_frame_errors++;
1863 IRDA_DEBUG(0,"%s(), ********** Receive Frame Size = 0 ********* \n", __func__ ); 1861 IRDA_DEBUG(0,"%s(), ********** Receive Frame Size = 0 ********* \n", __func__ );
1864 } 1862 }
1865 } 1863 }
@@ -1910,7 +1908,7 @@ static int ali_ircc_dma_receive_complete(struct ali_ircc_cb *self)
1910 IRDA_WARNING("%s(), memory squeeze, " 1908 IRDA_WARNING("%s(), memory squeeze, "
1911 "dropping frame.\n", 1909 "dropping frame.\n",
1912 __func__); 1910 __func__);
1913 self->stats.rx_dropped++; 1911 self->netdev->stats.rx_dropped++;
1914 1912
1915 return FALSE; 1913 return FALSE;
1916 } 1914 }
@@ -1924,8 +1922,8 @@ static int ali_ircc_dma_receive_complete(struct ali_ircc_cb *self)
1924 1922
1925 /* Move to next frame */ 1923 /* Move to next frame */
1926 self->rx_buff.data += len; 1924 self->rx_buff.data += len;
1927 self->stats.rx_bytes += len; 1925 self->netdev->stats.rx_bytes += len;
1928 self->stats.rx_packets++; 1926 self->netdev->stats.rx_packets++;
1929 1927
1930 skb->dev = self->netdev; 1928 skb->dev = self->netdev;
1931 skb_reset_mac_header(skb); 1929 skb_reset_mac_header(skb);
@@ -1994,7 +1992,7 @@ static int ali_ircc_sir_hard_xmit(struct sk_buff *skb, struct net_device *dev)
1994 self->tx_buff.len = async_wrap_skb(skb, self->tx_buff.data, 1992 self->tx_buff.len = async_wrap_skb(skb, self->tx_buff.data,
1995 self->tx_buff.truesize); 1993 self->tx_buff.truesize);
1996 1994
1997 self->stats.tx_bytes += self->tx_buff.len; 1995 self->netdev->stats.tx_bytes += self->tx_buff.len;
1998 1996
1999 /* Turn on transmit finished interrupt. Will fire immediately! */ 1997 /* Turn on transmit finished interrupt. Will fire immediately! */
2000 outb(UART_IER_THRI, iobase+UART_IER); 1998 outb(UART_IER_THRI, iobase+UART_IER);
@@ -2111,17 +2109,6 @@ static int ali_ircc_is_receiving(struct ali_ircc_cb *self)
2111 return status; 2109 return status;
2112} 2110}
2113 2111
2114static struct net_device_stats *ali_ircc_net_get_stats(struct net_device *dev)
2115{
2116 struct ali_ircc_cb *self = netdev_priv(dev);
2117
2118 IRDA_DEBUG(2, "%s(), ---------------- Start ----------------\n", __func__ );
2119
2120 IRDA_DEBUG(2, "%s(), ----------------- End ------------------\n", __func__ );
2121
2122 return &self->stats;
2123}
2124
2125static int ali_ircc_suspend(struct platform_device *dev, pm_message_t state) 2112static int ali_ircc_suspend(struct platform_device *dev, pm_message_t state)
2126{ 2113{
2127 struct ali_ircc_cb *self = platform_get_drvdata(dev); 2114 struct ali_ircc_cb *self = platform_get_drvdata(dev);