aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/irda/ali-ircc.c45
-rw-r--r--drivers/net/irda/ali-ircc.h1
-rw-r--r--drivers/net/irda/au1000_ircc.h1
-rw-r--r--drivers/net/irda/au1k_ir.c9
-rw-r--r--drivers/net/irda/donauboe.h1
-rw-r--r--drivers/net/irda/irda-usb.c28
-rw-r--r--drivers/net/irda/irda-usb.h1
-rw-r--r--drivers/net/irda/kingsun-sir.c20
-rw-r--r--drivers/net/irda/ks959-sir.c22
-rw-r--r--drivers/net/irda/ksdazzle-sir.c26
-rw-r--r--drivers/net/irda/mcs7780.c49
-rw-r--r--drivers/net/irda/mcs7780.h2
-rw-r--r--drivers/net/irda/nsc-ircc.c45
-rw-r--r--drivers/net/irda/nsc-ircc.h1
-rw-r--r--drivers/net/irda/pxaficp_ir.c52
-rw-r--r--drivers/net/irda/sa1100_ir.c46
-rw-r--r--drivers/net/irda/sir-dev.h1
-rw-r--r--drivers/net/irda/sir_dev.c26
-rw-r--r--drivers/net/irda/smsc-ircc2.c38
-rw-r--r--drivers/net/irda/stir4200.c44
-rw-r--r--drivers/net/irda/via-ircc.c47
-rw-r--r--drivers/net/irda/via-ircc.h1
-rw-r--r--drivers/net/irda/vlsi_ir.c78
-rw-r--r--drivers/net/irda/vlsi_ir.h1
-rw-r--r--drivers/net/irda/w83977af_ir.c35
-rw-r--r--drivers/net/irda/w83977af_ir.h1
26 files changed, 230 insertions, 391 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);
diff --git a/drivers/net/irda/ali-ircc.h b/drivers/net/irda/ali-ircc.h
index ed35d99763d5..0c8edb41bd0a 100644
--- a/drivers/net/irda/ali-ircc.h
+++ b/drivers/net/irda/ali-ircc.h
@@ -191,7 +191,6 @@ struct ali_ircc_cb {
191 struct tx_fifo tx_fifo; /* Info about frames to be transmitted */ 191 struct tx_fifo tx_fifo; /* Info about frames to be transmitted */
192 192
193 struct net_device *netdev; /* Yes! we are some kind of netdevice */ 193 struct net_device *netdev; /* Yes! we are some kind of netdevice */
194 struct net_device_stats stats;
195 194
196 struct irlap_cb *irlap; /* The link layer we are binded to */ 195 struct irlap_cb *irlap; /* The link layer we are binded to */
197 struct qos_info qos; /* QoS capabilities for this device */ 196 struct qos_info qos; /* QoS capabilities for this device */
diff --git a/drivers/net/irda/au1000_ircc.h b/drivers/net/irda/au1000_ircc.h
index b4763f24dded..c072c09a8d91 100644
--- a/drivers/net/irda/au1000_ircc.h
+++ b/drivers/net/irda/au1000_ircc.h
@@ -107,7 +107,6 @@ struct au1k_private {
107 iobuff_t rx_buff; 107 iobuff_t rx_buff;
108 108
109 struct net_device *netdev; 109 struct net_device *netdev;
110 struct net_device_stats stats;
111 110
112 struct timeval stamp; 111 struct timeval stamp;
113 struct timeval now; 112 struct timeval now;
diff --git a/drivers/net/irda/au1k_ir.c b/drivers/net/irda/au1k_ir.c
index 6c4b53ffbcac..75a1d0a86dee 100644
--- a/drivers/net/irda/au1k_ir.c
+++ b/drivers/net/irda/au1k_ir.c
@@ -53,7 +53,6 @@ static int au1k_irda_hard_xmit(struct sk_buff *, struct net_device *);
53static int au1k_irda_rx(struct net_device *); 53static int au1k_irda_rx(struct net_device *);
54static void au1k_irda_interrupt(int, void *); 54static void au1k_irda_interrupt(int, void *);
55static void au1k_tx_timeout(struct net_device *); 55static void au1k_tx_timeout(struct net_device *);
56static struct net_device_stats *au1k_irda_stats(struct net_device *);
57static int au1k_irda_ioctl(struct net_device *, struct ifreq *, int); 56static int au1k_irda_ioctl(struct net_device *, struct ifreq *, int);
58static int au1k_irda_set_speed(struct net_device *dev, int speed); 57static int au1k_irda_set_speed(struct net_device *dev, int speed);
59 58
@@ -213,7 +212,6 @@ static int au1k_irda_net_init(struct net_device *dev)
213 dev->open = au1k_irda_start; 212 dev->open = au1k_irda_start;
214 dev->hard_start_xmit = au1k_irda_hard_xmit; 213 dev->hard_start_xmit = au1k_irda_hard_xmit;
215 dev->stop = au1k_irda_stop; 214 dev->stop = au1k_irda_stop;
216 dev->get_stats = au1k_irda_stats;
217 dev->do_ioctl = au1k_irda_ioctl; 215 dev->do_ioctl = au1k_irda_ioctl;
218 dev->tx_timeout = au1k_tx_timeout; 216 dev->tx_timeout = au1k_tx_timeout;
219 217
@@ -832,13 +830,6 @@ au1k_irda_ioctl(struct net_device *dev, struct ifreq *ifreq, int cmd)
832 return ret; 830 return ret;
833} 831}
834 832
835
836static struct net_device_stats *au1k_irda_stats(struct net_device *dev)
837{
838 struct au1k_private *aup = netdev_priv(dev);
839 return &aup->stats;
840}
841
842MODULE_AUTHOR("Pete Popov <ppopov@mvista.com>"); 833MODULE_AUTHOR("Pete Popov <ppopov@mvista.com>");
843MODULE_DESCRIPTION("Au1000 IrDA Device Driver"); 834MODULE_DESCRIPTION("Au1000 IrDA Device Driver");
844 835
diff --git a/drivers/net/irda/donauboe.h b/drivers/net/irda/donauboe.h
index 1e67720f1066..0dbd1932b72f 100644
--- a/drivers/net/irda/donauboe.h
+++ b/drivers/net/irda/donauboe.h
@@ -308,7 +308,6 @@ struct OboeRing
308struct toshoboe_cb 308struct toshoboe_cb
309{ 309{
310 struct net_device *netdev; /* Yes! we are some kind of netdevice */ 310 struct net_device *netdev; /* Yes! we are some kind of netdevice */
311 struct net_device_stats stats;
312 struct tty_driver ttydev; 311 struct tty_driver ttydev;
313 312
314 struct irlap_cb *irlap; /* The link layer we are binded to */ 313 struct irlap_cb *irlap; /* The link layer we are binded to */
diff --git a/drivers/net/irda/irda-usb.c b/drivers/net/irda/irda-usb.c
index 205e4e825a97..29118f58a141 100644
--- a/drivers/net/irda/irda-usb.c
+++ b/drivers/net/irda/irda-usb.c
@@ -122,7 +122,6 @@ static int irda_usb_net_open(struct net_device *dev);
122static int irda_usb_net_close(struct net_device *dev); 122static int irda_usb_net_close(struct net_device *dev);
123static int irda_usb_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); 123static int irda_usb_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
124static void irda_usb_net_timeout(struct net_device *dev); 124static void irda_usb_net_timeout(struct net_device *dev);
125static struct net_device_stats *irda_usb_net_get_stats(struct net_device *dev);
126 125
127/************************ TRANSMIT ROUTINES ************************/ 126/************************ TRANSMIT ROUTINES ************************/
128/* 127/*
@@ -525,13 +524,13 @@ static int irda_usb_hard_xmit(struct sk_buff *skb, struct net_device *netdev)
525 /* Ask USB to send the packet - Irq disabled -> GFP_ATOMIC */ 524 /* Ask USB to send the packet - Irq disabled -> GFP_ATOMIC */
526 if ((res = usb_submit_urb(urb, GFP_ATOMIC))) { 525 if ((res = usb_submit_urb(urb, GFP_ATOMIC))) {
527 IRDA_WARNING("%s(), failed Tx URB\n", __func__); 526 IRDA_WARNING("%s(), failed Tx URB\n", __func__);
528 self->stats.tx_errors++; 527 netdev->stats.tx_errors++;
529 /* Let USB recover : We will catch that in the watchdog */ 528 /* Let USB recover : We will catch that in the watchdog */
530 /*netif_start_queue(netdev);*/ 529 /*netif_start_queue(netdev);*/
531 } else { 530 } else {
532 /* Increment packet stats */ 531 /* Increment packet stats */
533 self->stats.tx_packets++; 532 netdev->stats.tx_packets++;
534 self->stats.tx_bytes += skb->len; 533 netdev->stats.tx_bytes += skb->len;
535 534
536 netdev->trans_start = jiffies; 535 netdev->trans_start = jiffies;
537 } 536 }
@@ -677,7 +676,7 @@ static void irda_usb_net_timeout(struct net_device *netdev)
677 IRDA_DEBUG(0, "%s: Tx timed out, urb->status=%d, urb->transfer_flags=0x%04X\n", netdev->name, urb->status, urb->transfer_flags); 676 IRDA_DEBUG(0, "%s: Tx timed out, urb->status=%d, urb->transfer_flags=0x%04X\n", netdev->name, urb->status, urb->transfer_flags);
678 677
679 /* Increase error count */ 678 /* Increase error count */
680 self->stats.tx_errors++; 679 netdev->stats.tx_errors++;
681 680
682#ifdef IU_BUG_KICK_TIMEOUT 681#ifdef IU_BUG_KICK_TIMEOUT
683 /* Can't be a bad idea to reset the speed ;-) - Jean II */ 682 /* Can't be a bad idea to reset the speed ;-) - Jean II */
@@ -826,7 +825,7 @@ static void irda_usb_receive(struct urb *urb)
826 if (urb->status != 0) { 825 if (urb->status != 0) {
827 switch (urb->status) { 826 switch (urb->status) {
828 case -EILSEQ: 827 case -EILSEQ:
829 self->stats.rx_crc_errors++; 828 self->netdev->stats.rx_crc_errors++;
830 /* Also precursor to a hot-unplug on UHCI. */ 829 /* Also precursor to a hot-unplug on UHCI. */
831 /* Fallthrough... */ 830 /* Fallthrough... */
832 case -ECONNRESET: 831 case -ECONNRESET:
@@ -839,7 +838,7 @@ static void irda_usb_receive(struct urb *urb)
839 case -ETIME: 838 case -ETIME:
840 /* Usually precursor to a hot-unplug on OHCI. */ 839 /* Usually precursor to a hot-unplug on OHCI. */
841 default: 840 default:
842 self->stats.rx_errors++; 841 self->netdev->stats.rx_errors++;
843 IRDA_DEBUG(0, "%s(), RX status %d, transfer_flags 0x%04X \n", __func__, urb->status, urb->transfer_flags); 842 IRDA_DEBUG(0, "%s(), RX status %d, transfer_flags 0x%04X \n", __func__, urb->status, urb->transfer_flags);
844 break; 843 break;
845 } 844 }
@@ -890,7 +889,7 @@ static void irda_usb_receive(struct urb *urb)
890 IRDA_SKB_MAX_MTU); 889 IRDA_SKB_MAX_MTU);
891 890
892 if (!newskb) { 891 if (!newskb) {
893 self->stats.rx_dropped++; 892 self->netdev->stats.rx_dropped++;
894 /* We could deliver the current skb, but this would stall 893 /* We could deliver the current skb, but this would stall
895 * the Rx path. Better drop the packet... Jean II */ 894 * the Rx path. Better drop the packet... Jean II */
896 goto done; 895 goto done;
@@ -927,8 +926,8 @@ static void irda_usb_receive(struct urb *urb)
927 netif_rx(dataskb); 926 netif_rx(dataskb);
928 927
929 /* Keep stats up to date */ 928 /* Keep stats up to date */
930 self->stats.rx_bytes += len; 929 self->netdev->stats.rx_bytes += len;
931 self->stats.rx_packets++; 930 self->netdev->stats.rx_packets++;
932 931
933done: 932done:
934 /* Note : at this point, the URB we've just received (urb) 933 /* Note : at this point, the URB we've just received (urb)
@@ -1342,14 +1341,6 @@ static int irda_usb_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
1342} 1341}
1343 1342
1344/*------------------------------------------------------------------*/ 1343/*------------------------------------------------------------------*/
1345/*
1346 * Get device stats (for /proc/net/dev and ifconfig)
1347 */
1348static struct net_device_stats *irda_usb_net_get_stats(struct net_device *dev)
1349{
1350 struct irda_usb_cb *self = netdev_priv(dev);
1351 return &self->stats;
1352}
1353 1344
1354/********************* IRDA CONFIG SUBROUTINES *********************/ 1345/********************* IRDA CONFIG SUBROUTINES *********************/
1355/* 1346/*
@@ -1428,7 +1419,6 @@ static inline int irda_usb_open(struct irda_usb_cb *self)
1428 netdev->watchdog_timeo = 250*HZ/1000; /* 250 ms > USB timeout */ 1419 netdev->watchdog_timeo = 250*HZ/1000; /* 250 ms > USB timeout */
1429 netdev->open = irda_usb_net_open; 1420 netdev->open = irda_usb_net_open;
1430 netdev->stop = irda_usb_net_close; 1421 netdev->stop = irda_usb_net_close;
1431 netdev->get_stats = irda_usb_net_get_stats;
1432 netdev->do_ioctl = irda_usb_net_ioctl; 1422 netdev->do_ioctl = irda_usb_net_ioctl;
1433 1423
1434 return register_netdev(netdev); 1424 return register_netdev(netdev);
diff --git a/drivers/net/irda/irda-usb.h b/drivers/net/irda/irda-usb.h
index a0ca9c1fe196..ac0443d52e50 100644
--- a/drivers/net/irda/irda-usb.h
+++ b/drivers/net/irda/irda-usb.h
@@ -152,7 +152,6 @@ struct irda_usb_cb {
152 struct urb *speed_urb; /* URB used to send speed commands */ 152 struct urb *speed_urb; /* URB used to send speed commands */
153 153
154 struct net_device *netdev; /* Yes! we are some kind of netdev. */ 154 struct net_device *netdev; /* Yes! we are some kind of netdev. */
155 struct net_device_stats stats;
156 struct irlap_cb *irlap; /* The link layer we are binded to */ 155 struct irlap_cb *irlap; /* The link layer we are binded to */
157 struct qos_info qos; 156 struct qos_info qos;
158 char *speed_buff; /* Buffer for speed changes */ 157 char *speed_buff; /* Buffer for speed changes */
diff --git a/drivers/net/irda/kingsun-sir.c b/drivers/net/irda/kingsun-sir.c
index c747c874d44d..b4a61717254a 100644
--- a/drivers/net/irda/kingsun-sir.c
+++ b/drivers/net/irda/kingsun-sir.c
@@ -105,7 +105,7 @@ struct kingsun_cb {
105 struct usb_device *usbdev; /* init: probe_irda */ 105 struct usb_device *usbdev; /* init: probe_irda */
106 struct net_device *netdev; /* network layer */ 106 struct net_device *netdev; /* network layer */
107 struct irlap_cb *irlap; /* The link layer we are binded to */ 107 struct irlap_cb *irlap; /* The link layer we are binded to */
108 struct net_device_stats stats; /* network statistics */ 108
109 struct qos_info qos; 109 struct qos_info qos;
110 110
111 __u8 *in_buf; /* receive buffer */ 111 __u8 *in_buf; /* receive buffer */
@@ -186,12 +186,12 @@ static int kingsun_hard_xmit(struct sk_buff *skb, struct net_device *netdev)
186 case -EPIPE: 186 case -EPIPE:
187 break; 187 break;
188 default: 188 default:
189 kingsun->stats.tx_errors++; 189 netdev->stats.tx_errors++;
190 netif_start_queue(netdev); 190 netif_start_queue(netdev);
191 } 191 }
192 } else { 192 } else {
193 kingsun->stats.tx_packets++; 193 netdev->stats.tx_packets++;
194 kingsun->stats.tx_bytes += skb->len; 194 netdev->stats.tx_bytes += skb->len;
195 } 195 }
196 196
197 dev_kfree_skb(skb); 197 dev_kfree_skb(skb);
@@ -232,7 +232,7 @@ static void kingsun_rcv_irq(struct urb *urb)
232 if (bytes[0] >= 1 && bytes[0] < kingsun->max_rx) { 232 if (bytes[0] >= 1 && bytes[0] < kingsun->max_rx) {
233 for (i = 1; i <= bytes[0]; i++) { 233 for (i = 1; i <= bytes[0]; i++) {
234 async_unwrap_char(kingsun->netdev, 234 async_unwrap_char(kingsun->netdev,
235 &kingsun->stats, 235 &kingsun->netdev->stats,
236 &kingsun->rx_buff, bytes[i]); 236 &kingsun->rx_buff, bytes[i]);
237 } 237 }
238 do_gettimeofday(&kingsun->rx_time); 238 do_gettimeofday(&kingsun->rx_time);
@@ -418,15 +418,6 @@ static int kingsun_net_ioctl(struct net_device *netdev, struct ifreq *rq,
418 return ret; 418 return ret;
419} 419}
420 420
421/*
422 * Get device stats (for /proc/net/dev and ifconfig)
423 */
424static struct net_device_stats *
425kingsun_net_get_stats(struct net_device *netdev)
426{
427 struct kingsun_cb *kingsun = netdev_priv(netdev);
428 return &kingsun->stats;
429}
430 421
431/* 422/*
432 * This routine is called by the USB subsystem for each new device 423 * This routine is called by the USB subsystem for each new device
@@ -532,7 +523,6 @@ static int kingsun_probe(struct usb_interface *intf,
532 net->hard_start_xmit = kingsun_hard_xmit; 523 net->hard_start_xmit = kingsun_hard_xmit;
533 net->open = kingsun_net_open; 524 net->open = kingsun_net_open;
534 net->stop = kingsun_net_close; 525 net->stop = kingsun_net_close;
535 net->get_stats = kingsun_net_get_stats;
536 net->do_ioctl = kingsun_net_ioctl; 526 net->do_ioctl = kingsun_net_ioctl;
537 527
538 ret = register_netdev(net); 528 ret = register_netdev(net);
diff --git a/drivers/net/irda/ks959-sir.c b/drivers/net/irda/ks959-sir.c
index 600d96f9cdb7..55322fb92cf1 100644
--- a/drivers/net/irda/ks959-sir.c
+++ b/drivers/net/irda/ks959-sir.c
@@ -174,7 +174,7 @@ struct ks959_cb {
174 struct usb_device *usbdev; /* init: probe_irda */ 174 struct usb_device *usbdev; /* init: probe_irda */
175 struct net_device *netdev; /* network layer */ 175 struct net_device *netdev; /* network layer */
176 struct irlap_cb *irlap; /* The link layer we are binded to */ 176 struct irlap_cb *irlap; /* The link layer we are binded to */
177 struct net_device_stats stats; /* network statistics */ 177
178 struct qos_info qos; 178 struct qos_info qos;
179 179
180 struct usb_ctrlrequest *tx_setuprequest; 180 struct usb_ctrlrequest *tx_setuprequest;
@@ -366,7 +366,7 @@ static void ks959_send_irq(struct urb *urb)
366 case -EPIPE: 366 case -EPIPE:
367 break; 367 break;
368 default: 368 default:
369 kingsun->stats.tx_errors++; 369 netdev->stats.tx_errors++;
370 netif_start_queue(netdev); 370 netif_start_queue(netdev);
371 } 371 }
372 } 372 }
@@ -416,12 +416,12 @@ static int ks959_hard_xmit(struct sk_buff *skb, struct net_device *netdev)
416 case -EPIPE: 416 case -EPIPE:
417 break; 417 break;
418 default: 418 default:
419 kingsun->stats.tx_errors++; 419 netdev->stats.tx_errors++;
420 netif_start_queue(netdev); 420 netif_start_queue(netdev);
421 } 421 }
422 } else { 422 } else {
423 kingsun->stats.tx_packets++; 423 netdev->stats.tx_packets++;
424 kingsun->stats.tx_bytes += skb->len; 424 netdev->stats.tx_bytes += skb->len;
425 425
426 } 426 }
427 427
@@ -469,7 +469,7 @@ static void ks959_rcv_irq(struct urb *urb)
469 */ 469 */
470 if (kingsun->rx_variable_xormask != 0) { 470 if (kingsun->rx_variable_xormask != 0) {
471 async_unwrap_char(kingsun->netdev, 471 async_unwrap_char(kingsun->netdev,
472 &kingsun->stats, 472 &kingsun->netdev->stats,
473 &kingsun->rx_unwrap_buff, 473 &kingsun->rx_unwrap_buff,
474 bytes[i]); 474 bytes[i]);
475 } 475 }
@@ -669,15 +669,6 @@ static int ks959_net_ioctl(struct net_device *netdev, struct ifreq *rq, int cmd)
669} 669}
670 670
671/* 671/*
672 * Get device stats (for /proc/net/dev and ifconfig)
673 */
674static struct net_device_stats *ks959_net_get_stats(struct net_device *netdev)
675{
676 struct ks959_cb *kingsun = netdev_priv(netdev);
677 return &kingsun->stats;
678}
679
680/*
681 * This routine is called by the USB subsystem for each new device 672 * This routine is called by the USB subsystem for each new device
682 * in the system. We need to check if the device is ours, and in 673 * in the system. We need to check if the device is ours, and in
683 * this case start handling it. 674 * this case start handling it.
@@ -792,7 +783,6 @@ static int ks959_probe(struct usb_interface *intf,
792 net->hard_start_xmit = ks959_hard_xmit; 783 net->hard_start_xmit = ks959_hard_xmit;
793 net->open = ks959_net_open; 784 net->open = ks959_net_open;
794 net->stop = ks959_net_close; 785 net->stop = ks959_net_close;
795 net->get_stats = ks959_net_get_stats;
796 net->do_ioctl = ks959_net_ioctl; 786 net->do_ioctl = ks959_net_ioctl;
797 787
798 ret = register_netdev(net); 788 ret = register_netdev(net);
diff --git a/drivers/net/irda/ksdazzle-sir.c b/drivers/net/irda/ksdazzle-sir.c
index 0e7f89337b25..5b327b09acd8 100644
--- a/drivers/net/irda/ksdazzle-sir.c
+++ b/drivers/net/irda/ksdazzle-sir.c
@@ -140,7 +140,7 @@ struct ksdazzle_cb {
140 struct usb_device *usbdev; /* init: probe_irda */ 140 struct usb_device *usbdev; /* init: probe_irda */
141 struct net_device *netdev; /* network layer */ 141 struct net_device *netdev; /* network layer */
142 struct irlap_cb *irlap; /* The link layer we are binded to */ 142 struct irlap_cb *irlap; /* The link layer we are binded to */
143 struct net_device_stats stats; /* network statistics */ 143
144 struct qos_info qos; 144 struct qos_info qos;
145 145
146 struct urb *tx_urb; 146 struct urb *tx_urb;
@@ -278,7 +278,7 @@ static void ksdazzle_send_irq(struct urb *urb)
278 case -EPIPE: 278 case -EPIPE:
279 break; 279 break;
280 default: 280 default:
281 kingsun->stats.tx_errors++; 281 netdev->stats.tx_errors++;
282 netif_start_queue(netdev); 282 netif_start_queue(netdev);
283 } 283 }
284 } 284 }
@@ -329,12 +329,12 @@ static int ksdazzle_hard_xmit(struct sk_buff *skb, struct net_device *netdev)
329 case -EPIPE: 329 case -EPIPE:
330 break; 330 break;
331 default: 331 default:
332 kingsun->stats.tx_errors++; 332 netdev->stats.tx_errors++;
333 netif_start_queue(netdev); 333 netif_start_queue(netdev);
334 } 334 }
335 } else { 335 } else {
336 kingsun->stats.tx_packets++; 336 netdev->stats.tx_packets++;
337 kingsun->stats.tx_bytes += skb->len; 337 netdev->stats.tx_bytes += skb->len;
338 338
339 } 339 }
340 340
@@ -348,9 +348,10 @@ static int ksdazzle_hard_xmit(struct sk_buff *skb, struct net_device *netdev)
348static void ksdazzle_rcv_irq(struct urb *urb) 348static void ksdazzle_rcv_irq(struct urb *urb)
349{ 349{
350 struct ksdazzle_cb *kingsun = urb->context; 350 struct ksdazzle_cb *kingsun = urb->context;
351 struct net_device *netdev = kingsun->netdev;
351 352
352 /* in process of stopping, just drop data */ 353 /* in process of stopping, just drop data */
353 if (!netif_running(kingsun->netdev)) { 354 if (!netif_running(netdev)) {
354 kingsun->receiving = 0; 355 kingsun->receiving = 0;
355 return; 356 return;
356 } 357 }
@@ -368,7 +369,7 @@ static void ksdazzle_rcv_irq(struct urb *urb)
368 unsigned int i; 369 unsigned int i;
369 370
370 for (i = 0; i < urb->actual_length; i++) { 371 for (i = 0; i < urb->actual_length; i++) {
371 async_unwrap_char(kingsun->netdev, &kingsun->stats, 372 async_unwrap_char(netdev, &netdev->stats,
372 &kingsun->rx_unwrap_buff, bytes[i]); 373 &kingsun->rx_unwrap_buff, bytes[i]);
373 } 374 }
374 kingsun->receiving = 375 kingsun->receiving =
@@ -562,16 +563,6 @@ static int ksdazzle_net_ioctl(struct net_device *netdev, struct ifreq *rq,
562} 563}
563 564
564/* 565/*
565 * Get device stats (for /proc/net/dev and ifconfig)
566 */
567static struct net_device_stats *ksdazzle_net_get_stats(struct net_device
568 *netdev)
569{
570 struct ksdazzle_cb *kingsun = netdev_priv(netdev);
571 return &kingsun->stats;
572}
573
574/*
575 * This routine is called by the USB subsystem for each new device 566 * This routine is called by the USB subsystem for each new device
576 * in the system. We need to check if the device is ours, and in 567 * in the system. We need to check if the device is ours, and in
577 * this case start handling it. 568 * this case start handling it.
@@ -696,7 +687,6 @@ static int ksdazzle_probe(struct usb_interface *intf,
696 net->hard_start_xmit = ksdazzle_hard_xmit; 687 net->hard_start_xmit = ksdazzle_hard_xmit;
697 net->open = ksdazzle_net_open; 688 net->open = ksdazzle_net_open;
698 net->stop = ksdazzle_net_close; 689 net->stop = ksdazzle_net_close;
699 net->get_stats = ksdazzle_net_get_stats;
700 net->do_ioctl = ksdazzle_net_ioctl; 690 net->do_ioctl = ksdazzle_net_ioctl;
701 691
702 ret = register_netdev(net); 692 ret = register_netdev(net);
diff --git a/drivers/net/irda/mcs7780.c b/drivers/net/irda/mcs7780.c
index 904c9610c0dd..7eafdca19f34 100644
--- a/drivers/net/irda/mcs7780.c
+++ b/drivers/net/irda/mcs7780.c
@@ -403,8 +403,8 @@ static void mcs_unwrap_mir(struct mcs_cb *mcs, __u8 *buf, int len)
403 if(unlikely(new_len <= 0)) { 403 if(unlikely(new_len <= 0)) {
404 IRDA_ERROR("%s short frame length %d\n", 404 IRDA_ERROR("%s short frame length %d\n",
405 mcs->netdev->name, new_len); 405 mcs->netdev->name, new_len);
406 ++mcs->stats.rx_errors; 406 ++mcs->netdev->stats.rx_errors;
407 ++mcs->stats.rx_length_errors; 407 ++mcs->netdev->stats.rx_length_errors;
408 return; 408 return;
409 } 409 }
410 fcs = 0; 410 fcs = 0;
@@ -413,14 +413,14 @@ static void mcs_unwrap_mir(struct mcs_cb *mcs, __u8 *buf, int len)
413 if(fcs != GOOD_FCS) { 413 if(fcs != GOOD_FCS) {
414 IRDA_ERROR("crc error calc 0x%x len %d\n", 414 IRDA_ERROR("crc error calc 0x%x len %d\n",
415 fcs, new_len); 415 fcs, new_len);
416 mcs->stats.rx_errors++; 416 mcs->netdev->stats.rx_errors++;
417 mcs->stats.rx_crc_errors++; 417 mcs->netdev->stats.rx_crc_errors++;
418 return; 418 return;
419 } 419 }
420 420
421 skb = dev_alloc_skb(new_len + 1); 421 skb = dev_alloc_skb(new_len + 1);
422 if(unlikely(!skb)) { 422 if(unlikely(!skb)) {
423 ++mcs->stats.rx_dropped; 423 ++mcs->netdev->stats.rx_dropped;
424 return; 424 return;
425 } 425 }
426 426
@@ -433,8 +433,8 @@ static void mcs_unwrap_mir(struct mcs_cb *mcs, __u8 *buf, int len)
433 433
434 netif_rx(skb); 434 netif_rx(skb);
435 435
436 mcs->stats.rx_packets++; 436 mcs->netdev->stats.rx_packets++;
437 mcs->stats.rx_bytes += new_len; 437 mcs->netdev->stats.rx_bytes += new_len;
438 438
439 return; 439 return;
440} 440}
@@ -458,22 +458,22 @@ static void mcs_unwrap_fir(struct mcs_cb *mcs, __u8 *buf, int len)
458 if(unlikely(new_len <= 0)) { 458 if(unlikely(new_len <= 0)) {
459 IRDA_ERROR("%s short frame length %d\n", 459 IRDA_ERROR("%s short frame length %d\n",
460 mcs->netdev->name, new_len); 460 mcs->netdev->name, new_len);
461 ++mcs->stats.rx_errors; 461 ++mcs->netdev->stats.rx_errors;
462 ++mcs->stats.rx_length_errors; 462 ++mcs->netdev->stats.rx_length_errors;
463 return; 463 return;
464 } 464 }
465 465
466 fcs = ~(crc32_le(~0, buf, new_len)); 466 fcs = ~(crc32_le(~0, buf, new_len));
467 if(fcs != get_unaligned_le32(buf + new_len)) { 467 if(fcs != get_unaligned_le32(buf + new_len)) {
468 IRDA_ERROR("crc error calc 0x%x len %d\n", fcs, new_len); 468 IRDA_ERROR("crc error calc 0x%x len %d\n", fcs, new_len);
469 mcs->stats.rx_errors++; 469 mcs->netdev->stats.rx_errors++;
470 mcs->stats.rx_crc_errors++; 470 mcs->netdev->stats.rx_crc_errors++;
471 return; 471 return;
472 } 472 }
473 473
474 skb = dev_alloc_skb(new_len + 1); 474 skb = dev_alloc_skb(new_len + 1);
475 if(unlikely(!skb)) { 475 if(unlikely(!skb)) {
476 ++mcs->stats.rx_dropped; 476 ++mcs->netdev->stats.rx_dropped;
477 return; 477 return;
478 } 478 }
479 479
@@ -486,8 +486,8 @@ static void mcs_unwrap_fir(struct mcs_cb *mcs, __u8 *buf, int len)
486 486
487 netif_rx(skb); 487 netif_rx(skb);
488 488
489 mcs->stats.rx_packets++; 489 mcs->netdev->stats.rx_packets++;
490 mcs->stats.rx_bytes += new_len; 490 mcs->netdev->stats.rx_bytes += new_len;
491 491
492 return; 492 return;
493} 493}
@@ -756,14 +756,6 @@ static int mcs_net_open(struct net_device *netdev)
756 return ret; 756 return ret;
757} 757}
758 758
759
760/* Get device stats for /proc/net/dev and ifconfig */
761static struct net_device_stats *mcs_net_get_stats(struct net_device *netdev)
762{
763 struct mcs_cb *mcs = netdev_priv(netdev);
764 return &mcs->stats;
765}
766
767/* Receive callback function. */ 759/* Receive callback function. */
768static void mcs_receive_irq(struct urb *urb) 760static void mcs_receive_irq(struct urb *urb)
769{ 761{
@@ -786,14 +778,14 @@ static void mcs_receive_irq(struct urb *urb)
786 */ 778 */
787 /* SIR speed */ 779 /* SIR speed */
788 if(mcs->speed < 576000) { 780 if(mcs->speed < 576000) {
789 async_unwrap_char(mcs->netdev, &mcs->stats, 781 async_unwrap_char(mcs->netdev, &mcs->netdev->stats,
790 &mcs->rx_buff, 0xc0); 782 &mcs->rx_buff, 0xc0);
791 783
792 for (i = 0; i < urb->actual_length; i++) 784 for (i = 0; i < urb->actual_length; i++)
793 async_unwrap_char(mcs->netdev, &mcs->stats, 785 async_unwrap_char(mcs->netdev, &mcs->netdev->stats,
794 &mcs->rx_buff, bytes[i]); 786 &mcs->rx_buff, bytes[i]);
795 787
796 async_unwrap_char(mcs->netdev, &mcs->stats, 788 async_unwrap_char(mcs->netdev, &mcs->netdev->stats,
797 &mcs->rx_buff, 0xc1); 789 &mcs->rx_buff, 0xc1);
798 } 790 }
799 /* MIR speed */ 791 /* MIR speed */
@@ -868,12 +860,12 @@ static int mcs_hard_xmit(struct sk_buff *skb, struct net_device *ndev)
868 case -EPIPE: 860 case -EPIPE:
869 break; 861 break;
870 default: 862 default:
871 mcs->stats.tx_errors++; 863 mcs->netdev->stats.tx_errors++;
872 netif_start_queue(ndev); 864 netif_start_queue(ndev);
873 } 865 }
874 } else { 866 } else {
875 mcs->stats.tx_packets++; 867 mcs->netdev->stats.tx_packets++;
876 mcs->stats.tx_bytes += skb->len; 868 mcs->netdev->stats.tx_bytes += skb->len;
877 } 869 }
878 870
879 dev_kfree_skb(skb); 871 dev_kfree_skb(skb);
@@ -931,7 +923,6 @@ static int mcs_probe(struct usb_interface *intf,
931 ndev->hard_start_xmit = mcs_hard_xmit; 923 ndev->hard_start_xmit = mcs_hard_xmit;
932 ndev->open = mcs_net_open; 924 ndev->open = mcs_net_open;
933 ndev->stop = mcs_net_close; 925 ndev->stop = mcs_net_close;
934 ndev->get_stats = mcs_net_get_stats;
935 ndev->do_ioctl = mcs_net_ioctl; 926 ndev->do_ioctl = mcs_net_ioctl;
936 927
937 if (!intf->cur_altsetting) 928 if (!intf->cur_altsetting)
diff --git a/drivers/net/irda/mcs7780.h b/drivers/net/irda/mcs7780.h
index b18148cee638..6bdc621e67c6 100644
--- a/drivers/net/irda/mcs7780.h
+++ b/drivers/net/irda/mcs7780.h
@@ -104,7 +104,6 @@ struct mcs_cb {
104 struct usb_device *usbdev; /* init: probe_irda */ 104 struct usb_device *usbdev; /* init: probe_irda */
105 struct net_device *netdev; /* network layer */ 105 struct net_device *netdev; /* network layer */
106 struct irlap_cb *irlap; /* The link layer we are binded to */ 106 struct irlap_cb *irlap; /* The link layer we are binded to */
107 struct net_device_stats stats; /* network statistics */
108 struct qos_info qos; 107 struct qos_info qos;
109 unsigned int speed; /* Current speed */ 108 unsigned int speed; /* Current speed */
110 unsigned int new_speed; /* new speed */ 109 unsigned int new_speed; /* new speed */
@@ -154,7 +153,6 @@ static int mcs_speed_change(struct mcs_cb *mcs);
154static int mcs_net_ioctl(struct net_device *netdev, struct ifreq *rq, int cmd); 153static int mcs_net_ioctl(struct net_device *netdev, struct ifreq *rq, int cmd);
155static int mcs_net_close(struct net_device *netdev); 154static int mcs_net_close(struct net_device *netdev);
156static int mcs_net_open(struct net_device *netdev); 155static int mcs_net_open(struct net_device *netdev);
157static struct net_device_stats *mcs_net_get_stats(struct net_device *netdev);
158 156
159static void mcs_receive_irq(struct urb *urb); 157static void mcs_receive_irq(struct urb *urb);
160static void mcs_send_irq(struct urb *urb); 158static void mcs_send_irq(struct urb *urb);
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);
diff --git a/drivers/net/irda/nsc-ircc.h b/drivers/net/irda/nsc-ircc.h
index 71cd3c5a0762..7ba7738759b9 100644
--- a/drivers/net/irda/nsc-ircc.h
+++ b/drivers/net/irda/nsc-ircc.h
@@ -251,7 +251,6 @@ struct nsc_ircc_cb {
251 struct tx_fifo tx_fifo; /* Info about frames to be transmitted */ 251 struct tx_fifo tx_fifo; /* Info about frames to be transmitted */
252 252
253 struct net_device *netdev; /* Yes! we are some kind of netdevice */ 253 struct net_device *netdev; /* Yes! we are some kind of netdevice */
254 struct net_device_stats stats;
255 254
256 struct irlap_cb *irlap; /* The link layer we are binded to */ 255 struct irlap_cb *irlap; /* The link layer we are binded to */
257 struct qos_info qos; /* QoS capabilities for this device */ 256 struct qos_info qos; /* QoS capabilities for this device */
diff --git a/drivers/net/irda/pxaficp_ir.c b/drivers/net/irda/pxaficp_ir.c
index 004a9aab3a50..31794c2363ec 100644
--- a/drivers/net/irda/pxaficp_ir.c
+++ b/drivers/net/irda/pxaficp_ir.c
@@ -108,7 +108,6 @@ struct pxa_irda {
108 int txdma; 108 int txdma;
109 int rxdma; 109 int rxdma;
110 110
111 struct net_device_stats stats;
112 struct irlap_cb *irlap; 111 struct irlap_cb *irlap;
113 struct qos_info qos; 112 struct qos_info qos;
114 113
@@ -258,14 +257,15 @@ static irqreturn_t pxa_irda_sir_irq(int irq, void *dev_id)
258 data = STRBR; 257 data = STRBR;
259 if (lsr & (LSR_OE | LSR_PE | LSR_FE | LSR_BI)) { 258 if (lsr & (LSR_OE | LSR_PE | LSR_FE | LSR_BI)) {
260 printk(KERN_DEBUG "pxa_ir: sir receiving error\n"); 259 printk(KERN_DEBUG "pxa_ir: sir receiving error\n");
261 si->stats.rx_errors++; 260 dev->stats.rx_errors++;
262 if (lsr & LSR_FE) 261 if (lsr & LSR_FE)
263 si->stats.rx_frame_errors++; 262 dev->stats.rx_frame_errors++;
264 if (lsr & LSR_OE) 263 if (lsr & LSR_OE)
265 si->stats.rx_fifo_errors++; 264 dev->stats.rx_fifo_errors++;
266 } else { 265 } else {
267 si->stats.rx_bytes++; 266 dev->stats.rx_bytes++;
268 async_unwrap_char(dev, &si->stats, &si->rx_buff, data); 267 async_unwrap_char(dev, &dev->stats,
268 &si->rx_buff, data);
269 } 269 }
270 lsr = STLSR; 270 lsr = STLSR;
271 } 271 }
@@ -277,8 +277,8 @@ static irqreturn_t pxa_irda_sir_irq(int irq, void *dev_id)
277 277
278 case 0x0C: /* Character Timeout Indication */ 278 case 0x0C: /* Character Timeout Indication */
279 do { 279 do {
280 si->stats.rx_bytes++; 280 dev->stats.rx_bytes++;
281 async_unwrap_char(dev, &si->stats, &si->rx_buff, STRBR); 281 async_unwrap_char(dev, &dev->stats, &si->rx_buff, STRBR);
282 } while (STLSR & LSR_DR); 282 } while (STLSR & LSR_DR);
283 si->last_oscr = OSCR; 283 si->last_oscr = OSCR;
284 break; 284 break;
@@ -290,9 +290,8 @@ static irqreturn_t pxa_irda_sir_irq(int irq, void *dev_id)
290 } 290 }
291 291
292 if (si->tx_buff.len == 0) { 292 if (si->tx_buff.len == 0) {
293 si->stats.tx_packets++; 293 dev->stats.tx_packets++;
294 si->stats.tx_bytes += si->tx_buff.data - 294 dev->stats.tx_bytes += si->tx_buff.data - si->tx_buff.head;
295 si->tx_buff.head;
296 295
297 /* We need to ensure that the transmitter has finished. */ 296 /* We need to ensure that the transmitter has finished. */
298 while ((STLSR & LSR_TEMT) == 0) 297 while ((STLSR & LSR_TEMT) == 0)
@@ -343,10 +342,10 @@ static void pxa_irda_fir_dma_tx_irq(int channel, void *data)
343 DCSR(channel) = dcsr & ~DCSR_RUN; 342 DCSR(channel) = dcsr & ~DCSR_RUN;
344 343
345 if (dcsr & DCSR_ENDINTR) { 344 if (dcsr & DCSR_ENDINTR) {
346 si->stats.tx_packets++; 345 dev->stats.tx_packets++;
347 si->stats.tx_bytes += si->dma_tx_buff_len; 346 dev->stats.tx_bytes += si->dma_tx_buff_len;
348 } else { 347 } else {
349 si->stats.tx_errors++; 348 dev->stats.tx_errors++;
350 } 349 }
351 350
352 while (ICSR1 & ICSR1_TBY) 351 while (ICSR1 & ICSR1_TBY)
@@ -392,14 +391,14 @@ static void pxa_irda_fir_irq_eif(struct pxa_irda *si, struct net_device *dev, in
392 data = ICDR; 391 data = ICDR;
393 392
394 if (stat & (ICSR1_CRE | ICSR1_ROR)) { 393 if (stat & (ICSR1_CRE | ICSR1_ROR)) {
395 si->stats.rx_errors++; 394 dev->stats.rx_errors++;
396 if (stat & ICSR1_CRE) { 395 if (stat & ICSR1_CRE) {
397 printk(KERN_DEBUG "pxa_ir: fir receive CRC error\n"); 396 printk(KERN_DEBUG "pxa_ir: fir receive CRC error\n");
398 si->stats.rx_crc_errors++; 397 dev->stats.rx_crc_errors++;
399 } 398 }
400 if (stat & ICSR1_ROR) { 399 if (stat & ICSR1_ROR) {
401 printk(KERN_DEBUG "pxa_ir: fir receive overrun\n"); 400 printk(KERN_DEBUG "pxa_ir: fir receive overrun\n");
402 si->stats.rx_over_errors++; 401 dev->stats.rx_over_errors++;
403 } 402 }
404 } else { 403 } else {
405 si->dma_rx_buff[len++] = data; 404 si->dma_rx_buff[len++] = data;
@@ -415,14 +414,14 @@ static void pxa_irda_fir_irq_eif(struct pxa_irda *si, struct net_device *dev, in
415 414
416 if (icsr0 & ICSR0_FRE) { 415 if (icsr0 & ICSR0_FRE) {
417 printk(KERN_ERR "pxa_ir: dropping erroneous frame\n"); 416 printk(KERN_ERR "pxa_ir: dropping erroneous frame\n");
418 si->stats.rx_dropped++; 417 dev->stats.rx_dropped++;
419 return; 418 return;
420 } 419 }
421 420
422 skb = alloc_skb(len+1,GFP_ATOMIC); 421 skb = alloc_skb(len+1,GFP_ATOMIC);
423 if (!skb) { 422 if (!skb) {
424 printk(KERN_ERR "pxa_ir: fir out of memory for receive skb\n"); 423 printk(KERN_ERR "pxa_ir: fir out of memory for receive skb\n");
425 si->stats.rx_dropped++; 424 dev->stats.rx_dropped++;
426 return; 425 return;
427 } 426 }
428 427
@@ -437,8 +436,8 @@ static void pxa_irda_fir_irq_eif(struct pxa_irda *si, struct net_device *dev, in
437 skb->protocol = htons(ETH_P_IRDA); 436 skb->protocol = htons(ETH_P_IRDA);
438 netif_rx(skb); 437 netif_rx(skb);
439 438
440 si->stats.rx_packets++; 439 dev->stats.rx_packets++;
441 si->stats.rx_bytes += len; 440 dev->stats.rx_bytes += len;
442 } 441 }
443} 442}
444 443
@@ -457,10 +456,10 @@ static irqreturn_t pxa_irda_fir_irq(int irq, void *dev_id)
457 if (icsr0 & (ICSR0_FRE | ICSR0_RAB)) { 456 if (icsr0 & (ICSR0_FRE | ICSR0_RAB)) {
458 if (icsr0 & ICSR0_FRE) { 457 if (icsr0 & ICSR0_FRE) {
459 printk(KERN_DEBUG "pxa_ir: fir receive frame error\n"); 458 printk(KERN_DEBUG "pxa_ir: fir receive frame error\n");
460 si->stats.rx_frame_errors++; 459 dev->stats.rx_frame_errors++;
461 } else { 460 } else {
462 printk(KERN_DEBUG "pxa_ir: fir receive abort\n"); 461 printk(KERN_DEBUG "pxa_ir: fir receive abort\n");
463 si->stats.rx_errors++; 462 dev->stats.rx_errors++;
464 } 463 }
465 ICSR0 = icsr0 & (ICSR0_FRE | ICSR0_RAB); 464 ICSR0 = icsr0 & (ICSR0_FRE | ICSR0_RAB);
466 } 465 }
@@ -589,12 +588,6 @@ static int pxa_irda_ioctl(struct net_device *dev, struct ifreq *ifreq, int cmd)
589 return ret; 588 return ret;
590} 589}
591 590
592static struct net_device_stats *pxa_irda_stats(struct net_device *dev)
593{
594 struct pxa_irda *si = netdev_priv(dev);
595 return &si->stats;
596}
597
598static void pxa_irda_startup(struct pxa_irda *si) 591static void pxa_irda_startup(struct pxa_irda *si)
599{ 592{
600 /* Disable STUART interrupts */ 593 /* Disable STUART interrupts */
@@ -857,7 +850,6 @@ static int pxa_irda_probe(struct platform_device *pdev)
857 dev->open = pxa_irda_start; 850 dev->open = pxa_irda_start;
858 dev->stop = pxa_irda_stop; 851 dev->stop = pxa_irda_stop;
859 dev->do_ioctl = pxa_irda_ioctl; 852 dev->do_ioctl = pxa_irda_ioctl;
860 dev->get_stats = pxa_irda_stats;
861 853
862 irda_init_max_qos_capabilies(&si->qos); 854 irda_init_max_qos_capabilies(&si->qos);
863 855
diff --git a/drivers/net/irda/sa1100_ir.c b/drivers/net/irda/sa1100_ir.c
index d302bcf4c148..7a2b003954ca 100644
--- a/drivers/net/irda/sa1100_ir.c
+++ b/drivers/net/irda/sa1100_ir.c
@@ -60,7 +60,6 @@ struct sa1100_irda {
60 dma_regs_t *txdma; 60 dma_regs_t *txdma;
61 dma_regs_t *rxdma; 61 dma_regs_t *rxdma;
62 62
63 struct net_device_stats stats;
64 struct device *dev; 63 struct device *dev;
65 struct irda_platform_data *pdata; 64 struct irda_platform_data *pdata;
66 struct irlap_cb *irlap; 65 struct irlap_cb *irlap;
@@ -375,13 +374,13 @@ static void sa1100_irda_hpsir_irq(struct net_device *dev)
375 data = Ser2UTDR; 374 data = Ser2UTDR;
376 375
377 if (stat & (UTSR1_FRE | UTSR1_ROR)) { 376 if (stat & (UTSR1_FRE | UTSR1_ROR)) {
378 si->stats.rx_errors++; 377 dev->stats.rx_errors++;
379 if (stat & UTSR1_FRE) 378 if (stat & UTSR1_FRE)
380 si->stats.rx_frame_errors++; 379 dev->stats.rx_frame_errors++;
381 if (stat & UTSR1_ROR) 380 if (stat & UTSR1_ROR)
382 si->stats.rx_fifo_errors++; 381 dev->stats.rx_fifo_errors++;
383 } else 382 } else
384 async_unwrap_char(dev, &si->stats, &si->rx_buff, data); 383 async_unwrap_char(dev, &dev->stats, &si->rx_buff, data);
385 384
386 status = Ser2UTSR0; 385 status = Ser2UTSR0;
387 } 386 }
@@ -396,9 +395,9 @@ static void sa1100_irda_hpsir_irq(struct net_device *dev)
396 * There are at least 4 bytes in the FIFO. Read 3 bytes 395 * There are at least 4 bytes in the FIFO. Read 3 bytes
397 * and leave the rest to the block below. 396 * and leave the rest to the block below.
398 */ 397 */
399 async_unwrap_char(dev, &si->stats, &si->rx_buff, Ser2UTDR); 398 async_unwrap_char(dev, &dev->stats, &si->rx_buff, Ser2UTDR);
400 async_unwrap_char(dev, &si->stats, &si->rx_buff, Ser2UTDR); 399 async_unwrap_char(dev, &dev->stats, &si->rx_buff, Ser2UTDR);
401 async_unwrap_char(dev, &si->stats, &si->rx_buff, Ser2UTDR); 400 async_unwrap_char(dev, &dev->stats, &si->rx_buff, Ser2UTDR);
402 } 401 }
403 402
404 if (status & (UTSR0_RFS | UTSR0_RID)) { 403 if (status & (UTSR0_RFS | UTSR0_RID)) {
@@ -406,7 +405,7 @@ static void sa1100_irda_hpsir_irq(struct net_device *dev)
406 * Fifo contains more than 1 character. 405 * Fifo contains more than 1 character.
407 */ 406 */
408 do { 407 do {
409 async_unwrap_char(dev, &si->stats, &si->rx_buff, 408 async_unwrap_char(dev, &dev->stats, &si->rx_buff,
410 Ser2UTDR); 409 Ser2UTDR);
411 } while (Ser2UTSR1 & UTSR1_RNE); 410 } while (Ser2UTSR1 & UTSR1_RNE);
412 411
@@ -422,8 +421,8 @@ static void sa1100_irda_hpsir_irq(struct net_device *dev)
422 } while (Ser2UTSR1 & UTSR1_TNF && si->tx_buff.len); 421 } while (Ser2UTSR1 & UTSR1_TNF && si->tx_buff.len);
423 422
424 if (si->tx_buff.len == 0) { 423 if (si->tx_buff.len == 0) {
425 si->stats.tx_packets++; 424 dev->stats.tx_packets++;
426 si->stats.tx_bytes += si->tx_buff.data - 425 dev->stats.tx_bytes += si->tx_buff.data -
427 si->tx_buff.head; 426 si->tx_buff.head;
428 427
429 /* 428 /*
@@ -482,11 +481,11 @@ static void sa1100_irda_fir_error(struct sa1100_irda *si, struct net_device *dev
482 data = Ser2HSDR; 481 data = Ser2HSDR;
483 482
484 if (stat & (HSSR1_CRE | HSSR1_ROR)) { 483 if (stat & (HSSR1_CRE | HSSR1_ROR)) {
485 si->stats.rx_errors++; 484 dev->stats.rx_errors++;
486 if (stat & HSSR1_CRE) 485 if (stat & HSSR1_CRE)
487 si->stats.rx_crc_errors++; 486 dev->stats.rx_crc_errors++;
488 if (stat & HSSR1_ROR) 487 if (stat & HSSR1_ROR)
489 si->stats.rx_frame_errors++; 488 dev->stats.rx_frame_errors++;
490 } else 489 } else
491 skb->data[len++] = data; 490 skb->data[len++] = data;
492 491
@@ -505,8 +504,8 @@ static void sa1100_irda_fir_error(struct sa1100_irda *si, struct net_device *dev
505 skb->dev = dev; 504 skb->dev = dev;
506 skb_reset_mac_header(skb); 505 skb_reset_mac_header(skb);
507 skb->protocol = htons(ETH_P_IRDA); 506 skb->protocol = htons(ETH_P_IRDA);
508 si->stats.rx_packets++; 507 dev->stats.rx_packets++;
509 si->stats.rx_bytes += len; 508 dev->stats.rx_bytes += len;
510 509
511 /* 510 /*
512 * Before we pass the buffer up, allocate a new one. 511 * Before we pass the buffer up, allocate a new one.
@@ -545,10 +544,10 @@ static void sa1100_irda_fir_irq(struct net_device *dev)
545 * from the fifo. 544 * from the fifo.
546 */ 545 */
547 if (Ser2HSSR0 & (HSSR0_FRE | HSSR0_RAB)) { 546 if (Ser2HSSR0 & (HSSR0_FRE | HSSR0_RAB)) {
548 si->stats.rx_errors++; 547 dev->stats.rx_errors++;
549 548
550 if (Ser2HSSR0 & HSSR0_FRE) 549 if (Ser2HSSR0 & HSSR0_FRE)
551 si->stats.rx_frame_errors++; 550 dev->stats.rx_frame_errors++;
552 551
553 /* 552 /*
554 * Clear out the DMA... 553 * Clear out the DMA...
@@ -633,8 +632,8 @@ static void sa1100_irda_txdma_irq(void *id)
633 */ 632 */
634 if (skb) { 633 if (skb) {
635 dma_unmap_single(si->dev, si->txbuf_dma, skb->len, DMA_TO_DEVICE); 634 dma_unmap_single(si->dev, si->txbuf_dma, skb->len, DMA_TO_DEVICE);
636 si->stats.tx_packets ++; 635 dev->stats.tx_packets ++;
637 si->stats.tx_bytes += skb->len; 636 dev->stats.tx_bytes += skb->len;
638 dev_kfree_skb_irq(skb); 637 dev_kfree_skb_irq(skb);
639 } 638 }
640 639
@@ -762,12 +761,6 @@ sa1100_irda_ioctl(struct net_device *dev, struct ifreq *ifreq, int cmd)
762 return ret; 761 return ret;
763} 762}
764 763
765static struct net_device_stats *sa1100_irda_stats(struct net_device *dev)
766{
767 struct sa1100_irda *si = netdev_priv(dev);
768 return &si->stats;
769}
770
771static int sa1100_irda_start(struct net_device *dev) 764static int sa1100_irda_start(struct net_device *dev)
772{ 765{
773 struct sa1100_irda *si = netdev_priv(dev); 766 struct sa1100_irda *si = netdev_priv(dev);
@@ -924,7 +917,6 @@ static int sa1100_irda_probe(struct platform_device *pdev)
924 dev->open = sa1100_irda_start; 917 dev->open = sa1100_irda_start;
925 dev->stop = sa1100_irda_stop; 918 dev->stop = sa1100_irda_stop;
926 dev->do_ioctl = sa1100_irda_ioctl; 919 dev->do_ioctl = sa1100_irda_ioctl;
927 dev->get_stats = sa1100_irda_stats;
928 dev->irq = IRQ_Ser2ICP; 920 dev->irq = IRQ_Ser2ICP;
929 921
930 irda_init_max_qos_capabilies(&si->qos); 922 irda_init_max_qos_capabilies(&si->qos);
diff --git a/drivers/net/irda/sir-dev.h b/drivers/net/irda/sir-dev.h
index 2a57bc67ce35..6d5b1e2b1289 100644
--- a/drivers/net/irda/sir-dev.h
+++ b/drivers/net/irda/sir-dev.h
@@ -160,7 +160,6 @@ static inline int sirdev_schedule_mode(struct sir_dev *dev, int mode)
160 160
161struct sir_dev { 161struct sir_dev {
162 struct net_device *netdev; 162 struct net_device *netdev;
163 struct net_device_stats stats;
164 163
165 struct irlap_cb *irlap; 164 struct irlap_cb *irlap;
166 165
diff --git a/drivers/net/irda/sir_dev.c b/drivers/net/irda/sir_dev.c
index ceef040aa76d..5b5862499def 100644
--- a/drivers/net/irda/sir_dev.c
+++ b/drivers/net/irda/sir_dev.c
@@ -455,8 +455,8 @@ void sirdev_write_complete(struct sir_dev *dev)
455 if ((skb=dev->tx_skb) != NULL) { 455 if ((skb=dev->tx_skb) != NULL) {
456 dev->tx_skb = NULL; 456 dev->tx_skb = NULL;
457 dev_kfree_skb_any(skb); 457 dev_kfree_skb_any(skb);
458 dev->stats.tx_errors++; 458 dev->netdev->stats.tx_errors++;
459 dev->stats.tx_dropped++; 459 dev->netdev->stats.tx_dropped++;
460 } 460 }
461 dev->tx_buff.len = 0; 461 dev->tx_buff.len = 0;
462 } 462 }
@@ -493,8 +493,8 @@ void sirdev_write_complete(struct sir_dev *dev)
493 493
494 if ((skb=dev->tx_skb) != NULL) { 494 if ((skb=dev->tx_skb) != NULL) {
495 dev->tx_skb = NULL; 495 dev->tx_skb = NULL;
496 dev->stats.tx_packets++; 496 dev->netdev->stats.tx_packets++;
497 dev->stats.tx_bytes += skb->len; 497 dev->netdev->stats.tx_bytes += skb->len;
498 dev_kfree_skb_any(skb); 498 dev_kfree_skb_any(skb);
499 } 499 }
500 500
@@ -548,7 +548,7 @@ int sirdev_receive(struct sir_dev *dev, const unsigned char *cp, size_t count)
548 * just update stats and set media busy 548 * just update stats and set media busy
549 */ 549 */
550 irda_device_set_media_busy(dev->netdev, TRUE); 550 irda_device_set_media_busy(dev->netdev, TRUE);
551 dev->stats.rx_dropped++; 551 dev->netdev->stats.rx_dropped++;
552 IRDA_DEBUG(0, "%s; rx-drop: %zd\n", __func__, count); 552 IRDA_DEBUG(0, "%s; rx-drop: %zd\n", __func__, count);
553 return 0; 553 return 0;
554 } 554 }
@@ -557,7 +557,7 @@ int sirdev_receive(struct sir_dev *dev, const unsigned char *cp, size_t count)
557 if (likely(atomic_read(&dev->enable_rx))) { 557 if (likely(atomic_read(&dev->enable_rx))) {
558 while (count--) 558 while (count--)
559 /* Unwrap and destuff one byte */ 559 /* Unwrap and destuff one byte */
560 async_unwrap_char(dev->netdev, &dev->stats, 560 async_unwrap_char(dev->netdev, &dev->netdev->stats,
561 &dev->rx_buff, *cp++); 561 &dev->rx_buff, *cp++);
562 } else { 562 } else {
563 while (count--) { 563 while (count--) {
@@ -582,13 +582,6 @@ EXPORT_SYMBOL(sirdev_receive);
582 582
583/* callbacks from network layer */ 583/* callbacks from network layer */
584 584
585static struct net_device_stats *sirdev_get_stats(struct net_device *ndev)
586{
587 struct sir_dev *dev = netdev_priv(ndev);
588
589 return (dev) ? &dev->stats : NULL;
590}
591
592static int sirdev_hard_xmit(struct sk_buff *skb, struct net_device *ndev) 585static int sirdev_hard_xmit(struct sk_buff *skb, struct net_device *ndev)
593{ 586{
594 struct sir_dev *dev = netdev_priv(ndev); 587 struct sir_dev *dev = netdev_priv(ndev);
@@ -654,7 +647,7 @@ static int sirdev_hard_xmit(struct sk_buff *skb, struct net_device *ndev)
654 */ 647 */
655 atomic_set(&dev->enable_rx, 0); 648 atomic_set(&dev->enable_rx, 0);
656 if (unlikely(sirdev_is_receiving(dev))) 649 if (unlikely(sirdev_is_receiving(dev)))
657 dev->stats.collisions++; 650 dev->netdev->stats.collisions++;
658 651
659 actual = dev->drv->do_write(dev, dev->tx_buff.data, dev->tx_buff.len); 652 actual = dev->drv->do_write(dev, dev->tx_buff.data, dev->tx_buff.len);
660 653
@@ -669,8 +662,8 @@ static int sirdev_hard_xmit(struct sk_buff *skb, struct net_device *ndev)
669 IRDA_ERROR("%s: drv->do_write failed (%d)\n", 662 IRDA_ERROR("%s: drv->do_write failed (%d)\n",
670 __func__, actual); 663 __func__, actual);
671 dev_kfree_skb_any(skb); 664 dev_kfree_skb_any(skb);
672 dev->stats.tx_errors++; 665 dev->netdev->stats.tx_errors++;
673 dev->stats.tx_dropped++; 666 dev->netdev->stats.tx_dropped++;
674 netif_wake_queue(ndev); 667 netif_wake_queue(ndev);
675 } 668 }
676 spin_unlock_irqrestore(&dev->tx_lock, flags); 669 spin_unlock_irqrestore(&dev->tx_lock, flags);
@@ -918,7 +911,6 @@ struct sir_dev * sirdev_get_instance(const struct sir_driver *drv, const char *n
918 ndev->hard_start_xmit = sirdev_hard_xmit; 911 ndev->hard_start_xmit = sirdev_hard_xmit;
919 ndev->open = sirdev_open; 912 ndev->open = sirdev_open;
920 ndev->stop = sirdev_close; 913 ndev->stop = sirdev_close;
921 ndev->get_stats = sirdev_get_stats;
922 ndev->do_ioctl = sirdev_ioctl; 914 ndev->do_ioctl = sirdev_ioctl;
923 915
924 if (register_netdev(ndev)) { 916 if (register_netdev(ndev)) {
diff --git a/drivers/net/irda/smsc-ircc2.c b/drivers/net/irda/smsc-ircc2.c
index 5d09e157e15b..dd73cce10991 100644
--- a/drivers/net/irda/smsc-ircc2.c
+++ b/drivers/net/irda/smsc-ircc2.c
@@ -150,7 +150,6 @@ struct smsc_chip_address {
150/* Private data for each instance */ 150/* Private data for each instance */
151struct smsc_ircc_cb { 151struct smsc_ircc_cb {
152 struct net_device *netdev; /* Yes! we are some kind of netdevice */ 152 struct net_device *netdev; /* Yes! we are some kind of netdevice */
153 struct net_device_stats stats;
154 struct irlap_cb *irlap; /* The link layer we are binded to */ 153 struct irlap_cb *irlap; /* The link layer we are binded to */
155 154
156 chipio_t io; /* IrDA controller information */ 155 chipio_t io; /* IrDA controller information */
@@ -215,7 +214,6 @@ static int smsc_ircc_net_ioctl(struct net_device *dev, struct ifreq *rq, int cm
215#if SMSC_IRCC2_C_NET_TIMEOUT 214#if SMSC_IRCC2_C_NET_TIMEOUT
216static void smsc_ircc_timeout(struct net_device *dev); 215static void smsc_ircc_timeout(struct net_device *dev);
217#endif 216#endif
218static struct net_device_stats *smsc_ircc_net_get_stats(struct net_device *dev);
219static int smsc_ircc_is_receiving(struct smsc_ircc_cb *self); 217static int smsc_ircc_is_receiving(struct smsc_ircc_cb *self);
220static void smsc_ircc_probe_transceiver(struct smsc_ircc_cb *self); 218static void smsc_ircc_probe_transceiver(struct smsc_ircc_cb *self);
221static void smsc_ircc_set_transceiver_for_speed(struct smsc_ircc_cb *self, u32 speed); 219static void smsc_ircc_set_transceiver_for_speed(struct smsc_ircc_cb *self, u32 speed);
@@ -529,7 +527,6 @@ static int __init smsc_ircc_open(unsigned int fir_base, unsigned int sir_base, u
529 dev->open = smsc_ircc_net_open; 527 dev->open = smsc_ircc_net_open;
530 dev->stop = smsc_ircc_net_close; 528 dev->stop = smsc_ircc_net_close;
531 dev->do_ioctl = smsc_ircc_net_ioctl; 529 dev->do_ioctl = smsc_ircc_net_ioctl;
532 dev->get_stats = smsc_ircc_net_get_stats;
533 530
534 self = netdev_priv(dev); 531 self = netdev_priv(dev);
535 self->netdev = dev; 532 self->netdev = dev;
@@ -834,13 +831,6 @@ static int smsc_ircc_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd
834 return ret; 831 return ret;
835} 832}
836 833
837static struct net_device_stats *smsc_ircc_net_get_stats(struct net_device *dev)
838{
839 struct smsc_ircc_cb *self = netdev_priv(dev);
840
841 return &self->stats;
842}
843
844#if SMSC_IRCC2_C_NET_TIMEOUT 834#if SMSC_IRCC2_C_NET_TIMEOUT
845/* 835/*
846 * Function smsc_ircc_timeout (struct net_device *dev) 836 * Function smsc_ircc_timeout (struct net_device *dev)
@@ -920,7 +910,7 @@ static int smsc_ircc_hard_xmit_sir(struct sk_buff *skb, struct net_device *dev)
920 self->tx_buff.len = async_wrap_skb(skb, self->tx_buff.data, 910 self->tx_buff.len = async_wrap_skb(skb, self->tx_buff.data,
921 self->tx_buff.truesize); 911 self->tx_buff.truesize);
922 912
923 self->stats.tx_bytes += self->tx_buff.len; 913 dev->stats.tx_bytes += self->tx_buff.len;
924 914
925 /* Turn on transmit finished interrupt. Will fire immediately! */ 915 /* Turn on transmit finished interrupt. Will fire immediately! */
926 outb(UART_IER_THRI, self->io.sir_base + UART_IER); 916 outb(UART_IER_THRI, self->io.sir_base + UART_IER);
@@ -1320,16 +1310,16 @@ static void smsc_ircc_dma_xmit_complete(struct smsc_ircc_cb *self)
1320 /* Check for underrun! */ 1310 /* Check for underrun! */
1321 register_bank(iobase, 0); 1311 register_bank(iobase, 0);
1322 if (inb(iobase + IRCC_LSR) & IRCC_LSR_UNDERRUN) { 1312 if (inb(iobase + IRCC_LSR) & IRCC_LSR_UNDERRUN) {
1323 self->stats.tx_errors++; 1313 self->netdev->stats.tx_errors++;
1324 self->stats.tx_fifo_errors++; 1314 self->netdev->stats.tx_fifo_errors++;
1325 1315
1326 /* Reset error condition */ 1316 /* Reset error condition */
1327 register_bank(iobase, 0); 1317 register_bank(iobase, 0);
1328 outb(IRCC_MASTER_ERROR_RESET, iobase + IRCC_MASTER); 1318 outb(IRCC_MASTER_ERROR_RESET, iobase + IRCC_MASTER);
1329 outb(0x00, iobase + IRCC_MASTER); 1319 outb(0x00, iobase + IRCC_MASTER);
1330 } else { 1320 } else {
1331 self->stats.tx_packets++; 1321 self->netdev->stats.tx_packets++;
1332 self->stats.tx_bytes += self->tx_buff.len; 1322 self->netdev->stats.tx_bytes += self->tx_buff.len;
1333 } 1323 }
1334 1324
1335 /* Check if it's time to change the speed */ 1325 /* Check if it's time to change the speed */
@@ -1429,15 +1419,15 @@ static void smsc_ircc_dma_receive_complete(struct smsc_ircc_cb *self)
1429 1419
1430 /* Look for errors */ 1420 /* Look for errors */
1431 if (lsr & (IRCC_LSR_FRAME_ERROR | IRCC_LSR_CRC_ERROR | IRCC_LSR_SIZE_ERROR)) { 1421 if (lsr & (IRCC_LSR_FRAME_ERROR | IRCC_LSR_CRC_ERROR | IRCC_LSR_SIZE_ERROR)) {
1432 self->stats.rx_errors++; 1422 self->netdev->stats.rx_errors++;
1433 if (lsr & IRCC_LSR_FRAME_ERROR) 1423 if (lsr & IRCC_LSR_FRAME_ERROR)
1434 self->stats.rx_frame_errors++; 1424 self->netdev->stats.rx_frame_errors++;
1435 if (lsr & IRCC_LSR_CRC_ERROR) 1425 if (lsr & IRCC_LSR_CRC_ERROR)
1436 self->stats.rx_crc_errors++; 1426 self->netdev->stats.rx_crc_errors++;
1437 if (lsr & IRCC_LSR_SIZE_ERROR) 1427 if (lsr & IRCC_LSR_SIZE_ERROR)
1438 self->stats.rx_length_errors++; 1428 self->netdev->stats.rx_length_errors++;
1439 if (lsr & (IRCC_LSR_UNDERRUN | IRCC_LSR_OVERRUN)) 1429 if (lsr & (IRCC_LSR_UNDERRUN | IRCC_LSR_OVERRUN))
1440 self->stats.rx_length_errors++; 1430 self->netdev->stats.rx_length_errors++;
1441 return; 1431 return;
1442 } 1432 }
1443 1433
@@ -1460,8 +1450,8 @@ static void smsc_ircc_dma_receive_complete(struct smsc_ircc_cb *self)
1460 skb_reserve(skb, 1); 1450 skb_reserve(skb, 1);
1461 1451
1462 memcpy(skb_put(skb, len), self->rx_buff.data, len); 1452 memcpy(skb_put(skb, len), self->rx_buff.data, len);
1463 self->stats.rx_packets++; 1453 self->netdev->stats.rx_packets++;
1464 self->stats.rx_bytes += len; 1454 self->netdev->stats.rx_bytes += len;
1465 1455
1466 skb->dev = self->netdev; 1456 skb->dev = self->netdev;
1467 skb_reset_mac_header(skb); 1457 skb_reset_mac_header(skb);
@@ -1489,7 +1479,7 @@ static void smsc_ircc_sir_receive(struct smsc_ircc_cb *self)
1489 * async_unwrap_char will deliver all found frames 1479 * async_unwrap_char will deliver all found frames
1490 */ 1480 */
1491 do { 1481 do {
1492 async_unwrap_char(self->netdev, &self->stats, &self->rx_buff, 1482 async_unwrap_char(self->netdev, &self->netdev->stats, &self->rx_buff,
1493 inb(iobase + UART_RX)); 1483 inb(iobase + UART_RX));
1494 1484
1495 /* Make sure we don't stay here to long */ 1485 /* Make sure we don't stay here to long */
@@ -1992,7 +1982,7 @@ static void smsc_ircc_sir_write_wakeup(struct smsc_ircc_cb *self)
1992 /* Tell network layer that we want more frames */ 1982 /* Tell network layer that we want more frames */
1993 netif_wake_queue(self->netdev); 1983 netif_wake_queue(self->netdev);
1994 } 1984 }
1995 self->stats.tx_packets++; 1985 self->netdev->stats.tx_packets++;
1996 1986
1997 if (self->io.speed <= 115200) { 1987 if (self->io.speed <= 115200) {
1998 /* 1988 /*
diff --git a/drivers/net/irda/stir4200.c b/drivers/net/irda/stir4200.c
index ca4cd9266e55..8b1658c6c925 100644
--- a/drivers/net/irda/stir4200.c
+++ b/drivers/net/irda/stir4200.c
@@ -164,7 +164,7 @@ struct stir_cb {
164 struct usb_device *usbdev; /* init: probe_irda */ 164 struct usb_device *usbdev; /* init: probe_irda */
165 struct net_device *netdev; /* network layer */ 165 struct net_device *netdev; /* network layer */
166 struct irlap_cb *irlap; /* The link layer we are binded to */ 166 struct irlap_cb *irlap; /* The link layer we are binded to */
167 struct net_device_stats stats; /* network statistics */ 167
168 struct qos_info qos; 168 struct qos_info qos;
169 unsigned speed; /* Current speed */ 169 unsigned speed; /* Current speed */
170 170
@@ -323,16 +323,16 @@ static void fir_eof(struct stir_cb *stir)
323 pr_debug("%s: short frame len %d\n", 323 pr_debug("%s: short frame len %d\n",
324 stir->netdev->name, len); 324 stir->netdev->name, len);
325 325
326 ++stir->stats.rx_errors; 326 ++stir->netdev->stats.rx_errors;
327 ++stir->stats.rx_length_errors; 327 ++stir->netdev->stats.rx_length_errors;
328 return; 328 return;
329 } 329 }
330 330
331 fcs = ~(crc32_le(~0, rx_buff->data, len)); 331 fcs = ~(crc32_le(~0, rx_buff->data, len));
332 if (fcs != get_unaligned_le32(rx_buff->data + len)) { 332 if (fcs != get_unaligned_le32(rx_buff->data + len)) {
333 pr_debug("crc error calc 0x%x len %d\n", fcs, len); 333 pr_debug("crc error calc 0x%x len %d\n", fcs, len);
334 stir->stats.rx_errors++; 334 stir->netdev->stats.rx_errors++;
335 stir->stats.rx_crc_errors++; 335 stir->netdev->stats.rx_crc_errors++;
336 return; 336 return;
337 } 337 }
338 338
@@ -340,7 +340,7 @@ static void fir_eof(struct stir_cb *stir)
340 if (len < IRDA_RX_COPY_THRESHOLD) { 340 if (len < IRDA_RX_COPY_THRESHOLD) {
341 nskb = dev_alloc_skb(len + 1); 341 nskb = dev_alloc_skb(len + 1);
342 if (unlikely(!nskb)) { 342 if (unlikely(!nskb)) {
343 ++stir->stats.rx_dropped; 343 ++stir->netdev->stats.rx_dropped;
344 return; 344 return;
345 } 345 }
346 skb_reserve(nskb, 1); 346 skb_reserve(nskb, 1);
@@ -349,7 +349,7 @@ static void fir_eof(struct stir_cb *stir)
349 } else { 349 } else {
350 nskb = dev_alloc_skb(rx_buff->truesize); 350 nskb = dev_alloc_skb(rx_buff->truesize);
351 if (unlikely(!nskb)) { 351 if (unlikely(!nskb)) {
352 ++stir->stats.rx_dropped; 352 ++stir->netdev->stats.rx_dropped;
353 return; 353 return;
354 } 354 }
355 skb_reserve(nskb, 1); 355 skb_reserve(nskb, 1);
@@ -366,8 +366,8 @@ static void fir_eof(struct stir_cb *stir)
366 366
367 netif_rx(skb); 367 netif_rx(skb);
368 368
369 stir->stats.rx_packets++; 369 stir->netdev->stats.rx_packets++;
370 stir->stats.rx_bytes += len; 370 stir->netdev->stats.rx_bytes += len;
371 371
372 rx_buff->data = rx_buff->head; 372 rx_buff->data = rx_buff->head;
373 rx_buff->len = 0; 373 rx_buff->len = 0;
@@ -437,7 +437,7 @@ static void stir_fir_chars(struct stir_cb *stir,
437 if (unlikely(rx_buff->len >= rx_buff->truesize)) { 437 if (unlikely(rx_buff->len >= rx_buff->truesize)) {
438 pr_debug("%s: fir frame exceeds %d\n", 438 pr_debug("%s: fir frame exceeds %d\n",
439 stir->netdev->name, rx_buff->truesize); 439 stir->netdev->name, rx_buff->truesize);
440 ++stir->stats.rx_over_errors; 440 ++stir->netdev->stats.rx_over_errors;
441 goto error_recovery; 441 goto error_recovery;
442 } 442 }
443 443
@@ -445,10 +445,10 @@ static void stir_fir_chars(struct stir_cb *stir,
445 continue; 445 continue;
446 446
447 frame_error: 447 frame_error:
448 ++stir->stats.rx_frame_errors; 448 ++stir->netdev->stats.rx_frame_errors;
449 449
450 error_recovery: 450 error_recovery:
451 ++stir->stats.rx_errors; 451 ++stir->netdev->stats.rx_errors;
452 rx_buff->state = OUTSIDE_FRAME; 452 rx_buff->state = OUTSIDE_FRAME;
453 rx_buff->in_frame = FALSE; 453 rx_buff->in_frame = FALSE;
454 } 454 }
@@ -461,7 +461,7 @@ static void stir_sir_chars(struct stir_cb *stir,
461 int i; 461 int i;
462 462
463 for (i = 0; i < len; i++) 463 for (i = 0; i < len; i++)
464 async_unwrap_char(stir->netdev, &stir->stats, 464 async_unwrap_char(stir->netdev, &stir->netdev->stats,
465 &stir->rx_buff, bytes[i]); 465 &stir->rx_buff, bytes[i]);
466} 466}
467 467
@@ -692,7 +692,7 @@ static void receive_stop(struct stir_cb *stir)
692 usb_kill_urb(stir->rx_urb); 692 usb_kill_urb(stir->rx_urb);
693 693
694 if (stir->rx_buff.in_frame) 694 if (stir->rx_buff.in_frame)
695 stir->stats.collisions++; 695 stir->netdev->stats.collisions++;
696} 696}
697/* 697/*
698 * Wrap data in socket buffer and send it. 698 * Wrap data in socket buffer and send it.
@@ -718,15 +718,15 @@ static void stir_send(struct stir_cb *stir, struct sk_buff *skb)
718 if (!first_frame) 718 if (!first_frame)
719 fifo_txwait(stir, wraplen); 719 fifo_txwait(stir, wraplen);
720 720
721 stir->stats.tx_packets++; 721 stir->netdev->stats.tx_packets++;
722 stir->stats.tx_bytes += skb->len; 722 stir->netdev->stats.tx_bytes += skb->len;
723 stir->netdev->trans_start = jiffies; 723 stir->netdev->trans_start = jiffies;
724 pr_debug("send %d (%d)\n", skb->len, wraplen); 724 pr_debug("send %d (%d)\n", skb->len, wraplen);
725 725
726 if (usb_bulk_msg(stir->usbdev, usb_sndbulkpipe(stir->usbdev, 1), 726 if (usb_bulk_msg(stir->usbdev, usb_sndbulkpipe(stir->usbdev, 1),
727 stir->io_buf, wraplen, 727 stir->io_buf, wraplen,
728 NULL, TRANSMIT_TIMEOUT)) 728 NULL, TRANSMIT_TIMEOUT))
729 stir->stats.tx_errors++; 729 stir->netdev->stats.tx_errors++;
730} 730}
731 731
732/* 732/*
@@ -1008,15 +1008,6 @@ static int stir_net_ioctl(struct net_device *netdev, struct ifreq *rq, int cmd)
1008} 1008}
1009 1009
1010/* 1010/*
1011 * Get device stats (for /proc/net/dev and ifconfig)
1012 */
1013static struct net_device_stats *stir_net_get_stats(struct net_device *netdev)
1014{
1015 struct stir_cb *stir = netdev_priv(netdev);
1016 return &stir->stats;
1017}
1018
1019/*
1020 * This routine is called by the USB subsystem for each new device 1011 * This routine is called by the USB subsystem for each new device
1021 * in the system. We need to check if the device is ours, and in 1012 * in the system. We need to check if the device is ours, and in
1022 * this case start handling it. 1013 * this case start handling it.
@@ -1066,7 +1057,6 @@ static int stir_probe(struct usb_interface *intf,
1066 net->hard_start_xmit = stir_hard_xmit; 1057 net->hard_start_xmit = stir_hard_xmit;
1067 net->open = stir_net_open; 1058 net->open = stir_net_open;
1068 net->stop = stir_net_close; 1059 net->stop = stir_net_close;
1069 net->get_stats = stir_net_get_stats;
1070 net->do_ioctl = stir_net_ioctl; 1060 net->do_ioctl = stir_net_ioctl;
1071 1061
1072 ret = register_netdev(net); 1062 ret = register_netdev(net);
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);
101static int via_ircc_net_close(struct net_device *dev); 101static int via_ircc_net_close(struct net_device *dev);
102static int via_ircc_net_ioctl(struct net_device *dev, struct ifreq *rq, 102static int via_ircc_net_ioctl(struct net_device *dev, struct ifreq *rq,
103 int cmd); 103 int cmd);
104static struct net_device_stats *via_ircc_net_get_stats(struct net_device
105 *dev);
106static void via_ircc_change_dongle_speed(int iobase, int speed, 104static void via_ircc_change_dongle_speed(int iobase, int speed,
107 int dongle_id); 105 int dongle_id);
108static int RxTimerHandler(struct via_ircc_cb *self, int iobase); 106static 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)
434 dev->open = via_ircc_net_open; 432 dev->open = via_ircc_net_open;
435 dev->stop = via_ircc_net_close; 433 dev->stop = via_ircc_net_close;
436 dev->do_ioctl = via_ircc_net_ioctl; 434 dev->do_ioctl = via_ircc_net_ioctl;
437 dev->get_stats = via_ircc_net_get_stats;
438 435
439 err = register_netdev(dev); 436 err = register_netdev(dev);
440 if (err) 437 if (err)
@@ -855,7 +852,7 @@ static int via_ircc_hard_xmit_sir(struct sk_buff *skb,
855 async_wrap_skb(skb, self->tx_buff.data, 852 async_wrap_skb(skb, self->tx_buff.data,
856 self->tx_buff.truesize); 853 self->tx_buff.truesize);
857 854
858 self->stats.tx_bytes += self->tx_buff.len; 855 dev->stats.tx_bytes += self->tx_buff.len;
859 /* Send this frame with old speed */ 856 /* Send this frame with old speed */
860 SetBaudRate(iobase, self->io.speed); 857 SetBaudRate(iobase, self->io.speed);
861 SetPulseWidth(iobase, 12); 858 SetPulseWidth(iobase, 12);
@@ -921,7 +918,7 @@ static int via_ircc_hard_xmit_fir(struct sk_buff *skb,
921 self->tx_fifo.queue[self->tx_fifo.free].len = skb->len; 918 self->tx_fifo.queue[self->tx_fifo.free].len = skb->len;
922 919
923 self->tx_fifo.tail += skb->len; 920 self->tx_fifo.tail += skb->len;
924 self->stats.tx_bytes += skb->len; 921 dev->stats.tx_bytes += skb->len;
925 skb_copy_from_linear_data(skb, 922 skb_copy_from_linear_data(skb,
926 self->tx_fifo.queue[self->tx_fifo.free].start, skb->len); 923 self->tx_fifo.queue[self->tx_fifo.free].start, skb->len);
927 self->tx_fifo.len++; 924 self->tx_fifo.len++;
@@ -990,12 +987,12 @@ static int via_ircc_dma_xmit_complete(struct via_ircc_cb *self)
990 /* Clear bit, by writing 1 into it */ 987 /* Clear bit, by writing 1 into it */
991 Tx_status = GetTXStatus(iobase); 988 Tx_status = GetTXStatus(iobase);
992 if (Tx_status & 0x08) { 989 if (Tx_status & 0x08) {
993 self->stats.tx_errors++; 990 self->netdev->stats.tx_errors++;
994 self->stats.tx_fifo_errors++; 991 self->netdev->stats.tx_fifo_errors++;
995 hwreset(self); 992 hwreset(self);
996// how to clear underrrun ? 993// how to clear underrrun ?
997 } else { 994 } else {
998 self->stats.tx_packets++; 995 self->netdev->stats.tx_packets++;
999 ResetChip(iobase, 3); 996 ResetChip(iobase, 3);
1000 ResetChip(iobase, 4); 997 ResetChip(iobase, 4);
1001 } 998 }
@@ -1119,8 +1116,8 @@ static int via_ircc_dma_receive_complete(struct via_ircc_cb *self,
1119 } 1116 }
1120 // Move to next frame 1117 // Move to next frame
1121 self->rx_buff.data += len; 1118 self->rx_buff.data += len;
1122 self->stats.rx_bytes += len; 1119 self->netdev->stats.rx_bytes += len;
1123 self->stats.rx_packets++; 1120 self->netdev->stats.rx_packets++;
1124 skb->dev = self->netdev; 1121 skb->dev = self->netdev;
1125 skb_reset_mac_header(skb); 1122 skb_reset_mac_header(skb);
1126 skb->protocol = htons(ETH_P_IRDA); 1123 skb->protocol = htons(ETH_P_IRDA);
@@ -1180,7 +1177,7 @@ F01_E */
1180 */ 1177 */
1181 if ((skb == NULL) || (skb->data == NULL) 1178 if ((skb == NULL) || (skb->data == NULL)
1182 || (self->rx_buff.data == NULL) || (len < 6)) { 1179 || (self->rx_buff.data == NULL) || (len < 6)) {
1183 self->stats.rx_dropped++; 1180 self->netdev->stats.rx_dropped++;
1184 return TRUE; 1181 return TRUE;
1185 } 1182 }
1186 skb_reserve(skb, 1); 1183 skb_reserve(skb, 1);
@@ -1192,8 +1189,8 @@ F01_E */
1192 1189
1193 // Move to next frame 1190 // Move to next frame
1194 self->rx_buff.data += len; 1191 self->rx_buff.data += len;
1195 self->stats.rx_bytes += len; 1192 self->netdev->stats.rx_bytes += len;
1196 self->stats.rx_packets++; 1193 self->netdev->stats.rx_packets++;
1197 skb->dev = self->netdev; 1194 skb->dev = self->netdev;
1198 skb_reset_mac_header(skb); 1195 skb_reset_mac_header(skb);
1199 skb->protocol = htons(ETH_P_IRDA); 1196 skb->protocol = htons(ETH_P_IRDA);
@@ -1220,13 +1217,13 @@ static int upload_rxdata(struct via_ircc_cb *self, int iobase)
1220 IRDA_DEBUG(2, "%s(): len=%x\n", __func__, len); 1217 IRDA_DEBUG(2, "%s(): len=%x\n", __func__, len);
1221 1218
1222 if ((len - 4) < 2) { 1219 if ((len - 4) < 2) {
1223 self->stats.rx_dropped++; 1220 self->netdev->stats.rx_dropped++;
1224 return FALSE; 1221 return FALSE;
1225 } 1222 }
1226 1223
1227 skb = dev_alloc_skb(len + 1); 1224 skb = dev_alloc_skb(len + 1);
1228 if (skb == NULL) { 1225 if (skb == NULL) {
1229 self->stats.rx_dropped++; 1226 self->netdev->stats.rx_dropped++;
1230 return FALSE; 1227 return FALSE;
1231 } 1228 }
1232 skb_reserve(skb, 1); 1229 skb_reserve(skb, 1);
@@ -1238,8 +1235,8 @@ static int upload_rxdata(struct via_ircc_cb *self, int iobase)
1238 st_fifo->tail = 0; 1235 st_fifo->tail = 0;
1239 // Move to next frame 1236 // Move to next frame
1240 self->rx_buff.data += len; 1237 self->rx_buff.data += len;
1241 self->stats.rx_bytes += len; 1238 self->netdev->stats.rx_bytes += len;
1242 self->stats.rx_packets++; 1239 self->netdev->stats.rx_packets++;
1243 skb->dev = self->netdev; 1240 skb->dev = self->netdev;
1244 skb_reset_mac_header(skb); 1241 skb_reset_mac_header(skb);
1245 skb->protocol = htons(ETH_P_IRDA); 1242 skb->protocol = htons(ETH_P_IRDA);
@@ -1295,7 +1292,7 @@ static int RxTimerHandler(struct via_ircc_cb *self, int iobase)
1295 */ 1292 */
1296 if ((skb == NULL) || (skb->data == NULL) 1293 if ((skb == NULL) || (skb->data == NULL)
1297 || (self->rx_buff.data == NULL) || (len < 6)) { 1294 || (self->rx_buff.data == NULL) || (len < 6)) {
1298 self->stats.rx_dropped++; 1295 self->netdev->stats.rx_dropped++;
1299 continue; 1296 continue;
1300 } 1297 }
1301 skb_reserve(skb, 1); 1298 skb_reserve(skb, 1);
@@ -1307,8 +1304,8 @@ static int RxTimerHandler(struct via_ircc_cb *self, int iobase)
1307 1304
1308 // Move to next frame 1305 // Move to next frame
1309 self->rx_buff.data += len; 1306 self->rx_buff.data += len;
1310 self->stats.rx_bytes += len; 1307 self->netdev->stats.rx_bytes += len;
1311 self->stats.rx_packets++; 1308 self->netdev->stats.rx_packets++;
1312 skb->dev = self->netdev; 1309 skb->dev = self->netdev;
1313 skb_reset_mac_header(skb); 1310 skb_reset_mac_header(skb);
1314 skb->protocol = htons(ETH_P_IRDA); 1311 skb->protocol = htons(ETH_P_IRDA);
@@ -1523,7 +1520,7 @@ static int via_ircc_net_open(struct net_device *dev)
1523 1520
1524 IRDA_ASSERT(dev != NULL, return -1;); 1521 IRDA_ASSERT(dev != NULL, return -1;);
1525 self = netdev_priv(dev); 1522 self = netdev_priv(dev);
1526 self->stats.rx_packets = 0; 1523 dev->stats.rx_packets = 0;
1527 IRDA_ASSERT(self != NULL, return 0;); 1524 IRDA_ASSERT(self != NULL, return 0;);
1528 iobase = self->io.fir_base; 1525 iobase = self->io.fir_base;
1529 if (request_irq(self->io.irq, via_ircc_interrupt, 0, dev->name, dev)) { 1526 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,
1660 return ret; 1657 return ret;
1661} 1658}
1662 1659
1663static struct net_device_stats *via_ircc_net_get_stats(struct net_device
1664 *dev)
1665{
1666 struct via_ircc_cb *self = netdev_priv(dev);
1667
1668 return &self->stats;
1669}
1670
1671MODULE_AUTHOR("VIA Technologies,inc"); 1660MODULE_AUTHOR("VIA Technologies,inc");
1672MODULE_DESCRIPTION("VIA IrDA Device Driver"); 1661MODULE_DESCRIPTION("VIA IrDA Device Driver");
1673MODULE_LICENSE("GPL"); 1662MODULE_LICENSE("GPL");
diff --git a/drivers/net/irda/via-ircc.h b/drivers/net/irda/via-ircc.h
index 403c3f77634c..d9d1db03fa2d 100644
--- a/drivers/net/irda/via-ircc.h
+++ b/drivers/net/irda/via-ircc.h
@@ -95,7 +95,6 @@ struct via_ircc_cb {
95 struct tx_fifo tx_fifo; /* Info about frames to be transmitted */ 95 struct tx_fifo tx_fifo; /* Info about frames to be transmitted */
96 96
97 struct net_device *netdev; /* Yes! we are some kind of netdevice */ 97 struct net_device *netdev; /* Yes! we are some kind of netdevice */
98 struct net_device_stats stats;
99 98
100 struct irlap_cb *irlap; /* The link layer we are binded to */ 99 struct irlap_cb *irlap; /* The link layer we are binded to */
101 struct qos_info qos; /* QoS capabilities for this device */ 100 struct qos_info qos; /* QoS capabilities for this device */
diff --git a/drivers/net/irda/vlsi_ir.c b/drivers/net/irda/vlsi_ir.c
index 0d30f8d659a1..723c4588c803 100644
--- a/drivers/net/irda/vlsi_ir.c
+++ b/drivers/net/irda/vlsi_ir.c
@@ -291,14 +291,14 @@ static void vlsi_proc_ndev(struct seq_file *seq, struct net_device *ndev)
291 now.tv_sec - idev->last_rx.tv_sec - delta1, delta2); 291 now.tv_sec - idev->last_rx.tv_sec - delta1, delta2);
292 292
293 seq_printf(seq, "RX: packets=%lu / bytes=%lu / errors=%lu / dropped=%lu", 293 seq_printf(seq, "RX: packets=%lu / bytes=%lu / errors=%lu / dropped=%lu",
294 idev->stats.rx_packets, idev->stats.rx_bytes, idev->stats.rx_errors, 294 ndev->stats.rx_packets, ndev->stats.rx_bytes, ndev->stats.rx_errors,
295 idev->stats.rx_dropped); 295 ndev->stats.rx_dropped);
296 seq_printf(seq, " / overrun=%lu / length=%lu / frame=%lu / crc=%lu\n", 296 seq_printf(seq, " / overrun=%lu / length=%lu / frame=%lu / crc=%lu\n",
297 idev->stats.rx_over_errors, idev->stats.rx_length_errors, 297 ndev->stats.rx_over_errors, ndev->stats.rx_length_errors,
298 idev->stats.rx_frame_errors, idev->stats.rx_crc_errors); 298 ndev->stats.rx_frame_errors, ndev->stats.rx_crc_errors);
299 seq_printf(seq, "TX: packets=%lu / bytes=%lu / errors=%lu / dropped=%lu / fifo=%lu\n", 299 seq_printf(seq, "TX: packets=%lu / bytes=%lu / errors=%lu / dropped=%lu / fifo=%lu\n",
300 idev->stats.tx_packets, idev->stats.tx_bytes, idev->stats.tx_errors, 300 ndev->stats.tx_packets, ndev->stats.tx_bytes, ndev->stats.tx_errors,
301 idev->stats.tx_dropped, idev->stats.tx_fifo_errors); 301 ndev->stats.tx_dropped, ndev->stats.tx_fifo_errors);
302 302
303} 303}
304 304
@@ -651,21 +651,21 @@ static void vlsi_rx_interrupt(struct net_device *ndev)
651 651
652 if (ret < 0) { 652 if (ret < 0) {
653 ret = -ret; 653 ret = -ret;
654 idev->stats.rx_errors++; 654 ndev->stats.rx_errors++;
655 if (ret & VLSI_RX_DROP) 655 if (ret & VLSI_RX_DROP)
656 idev->stats.rx_dropped++; 656 ndev->stats.rx_dropped++;
657 if (ret & VLSI_RX_OVER) 657 if (ret & VLSI_RX_OVER)
658 idev->stats.rx_over_errors++; 658 ndev->stats.rx_over_errors++;
659 if (ret & VLSI_RX_LENGTH) 659 if (ret & VLSI_RX_LENGTH)
660 idev->stats.rx_length_errors++; 660 ndev->stats.rx_length_errors++;
661 if (ret & VLSI_RX_FRAME) 661 if (ret & VLSI_RX_FRAME)
662 idev->stats.rx_frame_errors++; 662 ndev->stats.rx_frame_errors++;
663 if (ret & VLSI_RX_CRC) 663 if (ret & VLSI_RX_CRC)
664 idev->stats.rx_crc_errors++; 664 ndev->stats.rx_crc_errors++;
665 } 665 }
666 else if (ret > 0) { 666 else if (ret > 0) {
667 idev->stats.rx_packets++; 667 ndev->stats.rx_packets++;
668 idev->stats.rx_bytes += ret; 668 ndev->stats.rx_bytes += ret;
669 } 669 }
670 } 670 }
671 671
@@ -686,6 +686,7 @@ static void vlsi_rx_interrupt(struct net_device *ndev)
686 686
687static void vlsi_unarm_rx(vlsi_irda_dev_t *idev) 687static void vlsi_unarm_rx(vlsi_irda_dev_t *idev)
688{ 688{
689 struct net_device *ndev = pci_get_drvdata(idev->pdev);
689 struct vlsi_ring *r = idev->rx_ring; 690 struct vlsi_ring *r = idev->rx_ring;
690 struct ring_descr *rd; 691 struct ring_descr *rd;
691 int ret; 692 int ret;
@@ -711,21 +712,21 @@ static void vlsi_unarm_rx(vlsi_irda_dev_t *idev)
711 712
712 if (ret < 0) { 713 if (ret < 0) {
713 ret = -ret; 714 ret = -ret;
714 idev->stats.rx_errors++; 715 ndev->stats.rx_errors++;
715 if (ret & VLSI_RX_DROP) 716 if (ret & VLSI_RX_DROP)
716 idev->stats.rx_dropped++; 717 ndev->stats.rx_dropped++;
717 if (ret & VLSI_RX_OVER) 718 if (ret & VLSI_RX_OVER)
718 idev->stats.rx_over_errors++; 719 ndev->stats.rx_over_errors++;
719 if (ret & VLSI_RX_LENGTH) 720 if (ret & VLSI_RX_LENGTH)
720 idev->stats.rx_length_errors++; 721 ndev->stats.rx_length_errors++;
721 if (ret & VLSI_RX_FRAME) 722 if (ret & VLSI_RX_FRAME)
722 idev->stats.rx_frame_errors++; 723 ndev->stats.rx_frame_errors++;
723 if (ret & VLSI_RX_CRC) 724 if (ret & VLSI_RX_CRC)
724 idev->stats.rx_crc_errors++; 725 ndev->stats.rx_crc_errors++;
725 } 726 }
726 else if (ret > 0) { 727 else if (ret > 0) {
727 idev->stats.rx_packets++; 728 ndev->stats.rx_packets++;
728 idev->stats.rx_bytes += ret; 729 ndev->stats.rx_bytes += ret;
729 } 730 }
730 } 731 }
731} 732}
@@ -1050,8 +1051,8 @@ drop_unlock:
1050drop: 1051drop:
1051 IRDA_WARNING("%s: dropping packet - %s\n", __func__, msg); 1052 IRDA_WARNING("%s: dropping packet - %s\n", __func__, msg);
1052 dev_kfree_skb_any(skb); 1053 dev_kfree_skb_any(skb);
1053 idev->stats.tx_errors++; 1054 ndev->stats.tx_errors++;
1054 idev->stats.tx_dropped++; 1055 ndev->stats.tx_dropped++;
1055 /* Don't even think about returning NET_XMIT_DROP (=1) here! 1056 /* Don't even think about returning NET_XMIT_DROP (=1) here!
1056 * In fact any retval!=0 causes the packet scheduler to requeue the 1057 * In fact any retval!=0 causes the packet scheduler to requeue the
1057 * packet for later retry of transmission - which isn't exactly 1058 * packet for later retry of transmission - which isn't exactly
@@ -1078,15 +1079,15 @@ static void vlsi_tx_interrupt(struct net_device *ndev)
1078 1079
1079 if (ret < 0) { 1080 if (ret < 0) {
1080 ret = -ret; 1081 ret = -ret;
1081 idev->stats.tx_errors++; 1082 ndev->stats.tx_errors++;
1082 if (ret & VLSI_TX_DROP) 1083 if (ret & VLSI_TX_DROP)
1083 idev->stats.tx_dropped++; 1084 ndev->stats.tx_dropped++;
1084 if (ret & VLSI_TX_FIFO) 1085 if (ret & VLSI_TX_FIFO)
1085 idev->stats.tx_fifo_errors++; 1086 ndev->stats.tx_fifo_errors++;
1086 } 1087 }
1087 else if (ret > 0){ 1088 else if (ret > 0){
1088 idev->stats.tx_packets++; 1089 ndev->stats.tx_packets++;
1089 idev->stats.tx_bytes += ret; 1090 ndev->stats.tx_bytes += ret;
1090 } 1091 }
1091 } 1092 }
1092 1093
@@ -1122,6 +1123,7 @@ static void vlsi_tx_interrupt(struct net_device *ndev)
1122 1123
1123static void vlsi_unarm_tx(vlsi_irda_dev_t *idev) 1124static void vlsi_unarm_tx(vlsi_irda_dev_t *idev)
1124{ 1125{
1126 struct net_device *ndev = pci_get_drvdata(idev->pdev);
1125 struct vlsi_ring *r = idev->tx_ring; 1127 struct vlsi_ring *r = idev->tx_ring;
1126 struct ring_descr *rd; 1128 struct ring_descr *rd;
1127 int ret; 1129 int ret;
@@ -1145,15 +1147,15 @@ static void vlsi_unarm_tx(vlsi_irda_dev_t *idev)
1145 1147
1146 if (ret < 0) { 1148 if (ret < 0) {
1147 ret = -ret; 1149 ret = -ret;
1148 idev->stats.tx_errors++; 1150 ndev->stats.tx_errors++;
1149 if (ret & VLSI_TX_DROP) 1151 if (ret & VLSI_TX_DROP)
1150 idev->stats.tx_dropped++; 1152 ndev->stats.tx_dropped++;
1151 if (ret & VLSI_TX_FIFO) 1153 if (ret & VLSI_TX_FIFO)
1152 idev->stats.tx_fifo_errors++; 1154 ndev->stats.tx_fifo_errors++;
1153 } 1155 }
1154 else if (ret > 0){ 1156 else if (ret > 0){
1155 idev->stats.tx_packets++; 1157 ndev->stats.tx_packets++;
1156 idev->stats.tx_bytes += ret; 1158 ndev->stats.tx_bytes += ret;
1157 } 1159 }
1158 } 1160 }
1159 1161
@@ -1373,13 +1375,6 @@ static int vlsi_stop_hw(vlsi_irda_dev_t *idev)
1373 1375
1374/**************************************************************/ 1376/**************************************************************/
1375 1377
1376static struct net_device_stats * vlsi_get_stats(struct net_device *ndev)
1377{
1378 vlsi_irda_dev_t *idev = netdev_priv(ndev);
1379
1380 return &idev->stats;
1381}
1382
1383static void vlsi_tx_timeout(struct net_device *ndev) 1378static void vlsi_tx_timeout(struct net_device *ndev)
1384{ 1379{
1385 vlsi_irda_dev_t *idev = netdev_priv(ndev); 1380 vlsi_irda_dev_t *idev = netdev_priv(ndev);
@@ -1615,7 +1610,6 @@ static int vlsi_irda_init(struct net_device *ndev)
1615 1610
1616 ndev->open = vlsi_open; 1611 ndev->open = vlsi_open;
1617 ndev->stop = vlsi_close; 1612 ndev->stop = vlsi_close;
1618 ndev->get_stats = vlsi_get_stats;
1619 ndev->hard_start_xmit = vlsi_hard_start_xmit; 1613 ndev->hard_start_xmit = vlsi_hard_start_xmit;
1620 ndev->do_ioctl = vlsi_ioctl; 1614 ndev->do_ioctl = vlsi_ioctl;
1621 ndev->tx_timeout = vlsi_tx_timeout; 1615 ndev->tx_timeout = vlsi_tx_timeout;
diff --git a/drivers/net/irda/vlsi_ir.h b/drivers/net/irda/vlsi_ir.h
index 9b1884329fba..3050d1a0cccf 100644
--- a/drivers/net/irda/vlsi_ir.h
+++ b/drivers/net/irda/vlsi_ir.h
@@ -712,7 +712,6 @@ static inline struct ring_descr *ring_get(struct vlsi_ring *r)
712 712
713typedef struct vlsi_irda_dev { 713typedef struct vlsi_irda_dev {
714 struct pci_dev *pdev; 714 struct pci_dev *pdev;
715 struct net_device_stats stats;
716 715
717 struct irlap_cb *irlap; 716 struct irlap_cb *irlap;
718 717
diff --git a/drivers/net/irda/w83977af_ir.c b/drivers/net/irda/w83977af_ir.c
index 30ec9131c5ce..dc0a2e4d830f 100644
--- a/drivers/net/irda/w83977af_ir.c
+++ b/drivers/net/irda/w83977af_ir.c
@@ -102,7 +102,6 @@ static int w83977af_is_receiving(struct w83977af_ir *self);
102static int w83977af_net_open(struct net_device *dev); 102static int w83977af_net_open(struct net_device *dev);
103static int w83977af_net_close(struct net_device *dev); 103static int w83977af_net_close(struct net_device *dev);
104static int w83977af_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); 104static int w83977af_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
105static struct net_device_stats *w83977af_net_get_stats(struct net_device *dev);
106 105
107/* 106/*
108 * Function w83977af_init () 107 * Function w83977af_init ()
@@ -237,7 +236,6 @@ static int w83977af_open(int i, unsigned int iobase, unsigned int irq,
237 dev->open = w83977af_net_open; 236 dev->open = w83977af_net_open;
238 dev->stop = w83977af_net_close; 237 dev->stop = w83977af_net_close;
239 dev->do_ioctl = w83977af_net_ioctl; 238 dev->do_ioctl = w83977af_net_ioctl;
240 dev->get_stats = w83977af_net_get_stats;
241 239
242 err = register_netdev(dev); 240 err = register_netdev(dev);
243 if (err) { 241 if (err) {
@@ -702,13 +700,13 @@ static void w83977af_dma_xmit_complete(struct w83977af_ir *self)
702 if (inb(iobase+AUDR) & AUDR_UNDR) { 700 if (inb(iobase+AUDR) & AUDR_UNDR) {
703 IRDA_DEBUG(0, "%s(), Transmit underrun!\n", __func__ ); 701 IRDA_DEBUG(0, "%s(), Transmit underrun!\n", __func__ );
704 702
705 self->stats.tx_errors++; 703 self->netdev->stats.tx_errors++;
706 self->stats.tx_fifo_errors++; 704 self->netdev->stats.tx_fifo_errors++;
707 705
708 /* Clear bit, by writing 1 to it */ 706 /* Clear bit, by writing 1 to it */
709 outb(AUDR_UNDR, iobase+AUDR); 707 outb(AUDR_UNDR, iobase+AUDR);
710 } else 708 } else
711 self->stats.tx_packets++; 709 self->netdev->stats.tx_packets++;
712 710
713 711
714 if (self->new_speed) { 712 if (self->new_speed) {
@@ -846,28 +844,28 @@ static int w83977af_dma_receive_complete(struct w83977af_ir *self)
846 if (status & FS_FO_ERR_MSK) { 844 if (status & FS_FO_ERR_MSK) {
847 if (status & FS_FO_LST_FR) { 845 if (status & FS_FO_LST_FR) {
848 /* Add number of lost frames to stats */ 846 /* Add number of lost frames to stats */
849 self->stats.rx_errors += len; 847 self->netdev->stats.rx_errors += len;
850 } else { 848 } else {
851 /* Skip frame */ 849 /* Skip frame */
852 self->stats.rx_errors++; 850 self->netdev->stats.rx_errors++;
853 851
854 self->rx_buff.data += len; 852 self->rx_buff.data += len;
855 853
856 if (status & FS_FO_MX_LEX) 854 if (status & FS_FO_MX_LEX)
857 self->stats.rx_length_errors++; 855 self->netdev->stats.rx_length_errors++;
858 856
859 if (status & FS_FO_PHY_ERR) 857 if (status & FS_FO_PHY_ERR)
860 self->stats.rx_frame_errors++; 858 self->netdev->stats.rx_frame_errors++;
861 859
862 if (status & FS_FO_CRC_ERR) 860 if (status & FS_FO_CRC_ERR)
863 self->stats.rx_crc_errors++; 861 self->netdev->stats.rx_crc_errors++;
864 } 862 }
865 /* The errors below can be reported in both cases */ 863 /* The errors below can be reported in both cases */
866 if (status & FS_FO_RX_OV) 864 if (status & FS_FO_RX_OV)
867 self->stats.rx_fifo_errors++; 865 self->netdev->stats.rx_fifo_errors++;
868 866
869 if (status & FS_FO_FSF_OV) 867 if (status & FS_FO_FSF_OV)
870 self->stats.rx_fifo_errors++; 868 self->netdev->stats.rx_fifo_errors++;
871 869
872 } else { 870 } else {
873 /* Check if we have transferred all data to memory */ 871 /* Check if we have transferred all data to memory */
@@ -917,7 +915,7 @@ static int w83977af_dma_receive_complete(struct w83977af_ir *self)
917 915
918 /* Move to next frame */ 916 /* Move to next frame */
919 self->rx_buff.data += len; 917 self->rx_buff.data += len;
920 self->stats.rx_packets++; 918 self->netdev->stats.rx_packets++;
921 919
922 skb->dev = self->netdev; 920 skb->dev = self->netdev;
923 skb_reset_mac_header(skb); 921 skb_reset_mac_header(skb);
@@ -951,7 +949,7 @@ static void w83977af_pio_receive(struct w83977af_ir *self)
951 /* Receive all characters in Rx FIFO */ 949 /* Receive all characters in Rx FIFO */
952 do { 950 do {
953 byte = inb(iobase+RBR); 951 byte = inb(iobase+RBR);
954 async_unwrap_char(self->netdev, &self->stats, &self->rx_buff, 952 async_unwrap_char(self->netdev, &self->netdev->stats, &self->rx_buff,
955 byte); 953 byte);
956 } while (inb(iobase+USR) & USR_RDR); /* Data available */ 954 } while (inb(iobase+USR) & USR_RDR); /* Data available */
957} 955}
@@ -994,7 +992,7 @@ static __u8 w83977af_sir_interrupt(struct w83977af_ir *self, int isr)
994 outb(AUDR_SFEND, iobase+AUDR); 992 outb(AUDR_SFEND, iobase+AUDR);
995 outb(set, iobase+SSR); 993 outb(set, iobase+SSR);
996 994
997 self->stats.tx_packets++; 995 self->netdev->stats.tx_packets++;
998 996
999 /* Feed me more packets */ 997 /* Feed me more packets */
1000 netif_wake_queue(self->netdev); 998 netif_wake_queue(self->netdev);
@@ -1336,13 +1334,6 @@ out:
1336 return ret; 1334 return ret;
1337} 1335}
1338 1336
1339static struct net_device_stats *w83977af_net_get_stats(struct net_device *dev)
1340{
1341 struct w83977af_ir *self = netdev_priv(dev);
1342
1343 return &self->stats;
1344}
1345
1346MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no>"); 1337MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no>");
1347MODULE_DESCRIPTION("Winbond W83977AF IrDA Device Driver"); 1338MODULE_DESCRIPTION("Winbond W83977AF IrDA Device Driver");
1348MODULE_LICENSE("GPL"); 1339MODULE_LICENSE("GPL");
diff --git a/drivers/net/irda/w83977af_ir.h b/drivers/net/irda/w83977af_ir.h
index 87c3975baf62..fefe9b11e200 100644
--- a/drivers/net/irda/w83977af_ir.h
+++ b/drivers/net/irda/w83977af_ir.h
@@ -172,7 +172,6 @@ struct w83977af_ir {
172 int tx_len; /* Number of frames in tx_buff */ 172 int tx_len; /* Number of frames in tx_buff */
173 173
174 struct net_device *netdev; /* Yes! we are some kind of netdevice */ 174 struct net_device *netdev; /* Yes! we are some kind of netdevice */
175 struct net_device_stats stats;
176 175
177 struct irlap_cb *irlap; /* The link layer we are binded to */ 176 struct irlap_cb *irlap; /* The link layer we are binded to */
178 struct qos_info qos; /* QoS capabilities for this device */ 177 struct qos_info qos; /* QoS capabilities for this device */