Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

sbni: use internal net_device_stats

Convert to use existing net_device_stats.
This driver,
has bad style,
of using commas,
when brackets should be used...

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Stephen Hemminger and committed by
David S. Miller
fe6c6fbb 39549b1e

+26 -42
+26 -42
drivers/net/wan/sbni.c
··· 68 68 /* device private data */ 69 69 70 70 struct net_local { 71 - struct net_device_stats stats; 72 71 struct timer_list watchdog; 73 72 74 73 spinlock_t lock; ··· 116 117 static int sbni_close( struct net_device * ); 117 118 static int sbni_start_xmit( struct sk_buff *, struct net_device * ); 118 119 static int sbni_ioctl( struct net_device *, struct ifreq *, int ); 119 - static struct net_device_stats *sbni_get_stats( struct net_device * ); 120 120 static void set_multicast_list( struct net_device * ); 121 121 122 122 static irqreturn_t sbni_interrupt( int, void * ); ··· 721 723 nl->wait_frameno = 0, 722 724 nl->inppos = 0, 723 725 #ifdef CONFIG_SBNI_MULTILINE 724 - ((struct net_local *)netdev_priv(nl->master)) 725 - ->stats.rx_errors++, 726 - ((struct net_local *)netdev_priv(nl->master)) 727 - ->stats.rx_missed_errors++; 726 + nl->master->stats.rx_errors++, 727 + nl->master->stats.rx_missed_errors++; 728 728 #else 729 - nl->stats.rx_errors++, 730 - nl->stats.rx_missed_errors++; 729 + dev->stats.rx_errors++, 730 + dev->stats.rx_missed_errors++; 731 731 #endif 732 732 /* now skip all frames until is_first != 0 */ 733 733 } else ··· 738 742 */ 739 743 nl->wait_frameno = 0, 740 744 #ifdef CONFIG_SBNI_MULTILINE 741 - ((struct net_local *)netdev_priv(nl->master)) 742 - ->stats.rx_errors++, 743 - ((struct net_local *)netdev_priv(nl->master)) 744 - ->stats.rx_crc_errors++; 745 + nl->master->stats.rx_errors++, 746 + nl->master->stats.rx_crc_errors++; 745 747 #else 746 - nl->stats.rx_errors++, 747 - nl->stats.rx_crc_errors++; 748 + dev->stats.rx_errors++, 749 + dev->stats.rx_crc_errors++; 748 750 #endif 749 751 750 752 return frame_ok; ··· 750 756 751 757 752 758 static inline void 753 - send_complete( struct net_local *nl ) 759 + send_complete( struct net_device *dev ) 754 760 { 761 + struct net_local *nl = netdev_priv(dev); 762 + 755 763 #ifdef CONFIG_SBNI_MULTILINE 756 - ((struct net_local *)netdev_priv(nl->master))->stats.tx_packets++; 757 - ((struct net_local *)netdev_priv(nl->master))->stats.tx_bytes 758 - += nl->tx_buf_p->len; 764 + nl->master->stats.tx_packets++; 765 + nl->master->stats.tx_bytes += nl->tx_buf_p->len; 759 766 #else 760 - nl->stats.tx_packets++; 761 - nl->stats.tx_bytes += nl->tx_buf_p->len; 767 + dev->stats.tx_packets++; 768 + dev->stats.tx_bytes += nl->tx_buf_p->len; 762 769 #endif 763 770 dev_kfree_skb_irq( nl->tx_buf_p ); 764 771 ··· 787 792 nl->maxframe, 788 793 nl->tx_buf_p->len - nl->outpos); 789 794 else 790 - send_complete( nl ), 795 + send_complete( dev ), 791 796 #ifdef CONFIG_SBNI_MULTILINE 792 797 netif_wake_queue( nl->master ); 793 798 #else ··· 876 881 dev_kfree_skb_any( nl->tx_buf_p ), 877 882 nl->tx_buf_p = NULL, 878 883 #ifdef CONFIG_SBNI_MULTILINE 879 - ((struct net_local *)netdev_priv(nl->master)) 880 - ->stats.tx_errors++, 881 - ((struct net_local *)netdev_priv(nl->master)) 882 - ->stats.tx_carrier_errors++; 884 + nl->master->stats.tx_errors++, 885 + nl->master->stats.tx_carrier_errors++; 883 886 #else 884 - nl->stats.tx_errors++, 885 - nl->stats.tx_carrier_errors++; 887 + dev->stats.tx_errors++, 888 + dev->stats.tx_carrier_errors++; 886 889 #endif 887 890 888 891 nl->tx_frameno = 0; ··· 1010 1017 #ifdef CONFIG_SBNI_MULTILINE 1011 1018 skb->protocol = eth_type_trans( skb, nl->master ); 1012 1019 netif_rx( skb ); 1013 - ++((struct net_local *)netdev_priv(nl->master))->stats.rx_packets; 1014 - ((struct net_local *)netdev_priv(nl->master))->stats.rx_bytes += 1015 - nl->inppos; 1020 + ++nl->master->stats.rx_packets; 1021 + nl->master->stats.rx_bytes += nl->inppos; 1016 1022 #else 1017 1023 skb->protocol = eth_type_trans( skb, dev ); 1018 1024 netif_rx( skb ); 1019 - ++nl->stats.rx_packets; 1020 - nl->stats.rx_bytes += nl->inppos; 1025 + ++dev->stats.rx_packets; 1026 + dev->stats.rx_bytes += nl->inppos; 1021 1027 #endif 1022 1028 nl->rx_buf_p = NULL; /* protocol driver will clear this sk_buff */ 1023 1029 } ··· 1189 1197 handler_attached: 1190 1198 1191 1199 spin_lock( &nl->lock ); 1192 - memset( &nl->stats, 0, sizeof(struct net_device_stats) ); 1200 + memset( &dev->stats, 0, sizeof(struct net_device_stats) ); 1193 1201 memset( &nl->in_stats, 0, sizeof(struct sbni_in_stats) ); 1194 1202 1195 1203 card_start( dev ); ··· 1405 1413 1406 1414 /* Summary statistics of MultiLine operation will be stored 1407 1415 in master's counters */ 1408 - memset( &snl->stats, 0, sizeof(struct net_device_stats) ); 1416 + memset( &slave_dev->stats, 0, sizeof(struct net_device_stats) ); 1409 1417 netif_stop_queue( slave_dev ); 1410 1418 netif_wake_queue( dev ); /* Now we are able to transmit */ 1411 1419 ··· 1455 1463 } 1456 1464 1457 1465 #endif 1458 - 1459 - 1460 - static struct net_device_stats * 1461 - sbni_get_stats( struct net_device *dev ) 1462 - { 1463 - return &((struct net_local *)netdev_priv(dev))->stats; 1464 - } 1465 - 1466 1466 1467 1467 static void 1468 1468 set_multicast_list( struct net_device *dev )