aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/irda/sir_dev.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/sir_dev.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/sir_dev.c')
-rw-r--r--drivers/net/irda/sir_dev.c26
1 files changed, 9 insertions, 17 deletions
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)) {