aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/irda/w83977af_ir.c
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@vyatta.com>2009-01-06 13:40:43 -0500
committerDavid S. Miller <davem@davemloft.net>2009-01-06 13:40:43 -0500
commitaf0490810cfa159b4894ddecfc5eb2e4432fb976 (patch)
tree7c5074c11633b5c9cfa1489859d015974be5fe32 /drivers/net/irda/w83977af_ir.c
parent46377bb311a7682f6240c954c48e81a1e4f51e66 (diff)
irda: convert to internal stats
Convert IRDA drivers to use already existing net_device_stats structure in network device. This is a pre-cursor to conversion to net_device ops. Compile tested only. Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/irda/w83977af_ir.c')
-rw-r--r--drivers/net/irda/w83977af_ir.c35
1 files changed, 13 insertions, 22 deletions
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");