aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/irda/sa1100_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/sa1100_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/sa1100_ir.c')
-rw-r--r--drivers/net/irda/sa1100_ir.c46
1 files changed, 19 insertions, 27 deletions
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);