aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorKrzysztof Halasa <khc@pm.waw.pl>2008-06-30 17:26:53 -0400
committerJeff Garzik <jgarzik@redhat.com>2008-07-04 08:47:41 -0400
commit198191c4a7ce4daba379608fb38b9bc5a4eedc61 (patch)
tree3229362a45a15af42628553926bc040e44c39ce0 /drivers/char
parent844290e56067aed0a54142d756565abb9614136c (diff)
WAN: convert drivers to use built-in netdev_stats
There is no point in using separate net_device_stats structs when the one in struct net_device is present. Compiles. Signed-off-by: Krzysztof HaƂasa <khc@pm.waw.pl> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/pcmcia/synclink_cs.c28
-rw-r--r--drivers/char/synclink.c33
-rw-r--r--drivers/char/synclink_gt.c28
-rw-r--r--drivers/char/synclinkmp.c31
4 files changed, 53 insertions, 67 deletions
diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c
index 1dd0e992c83d..fb2fb159faa3 100644
--- a/drivers/char/pcmcia/synclink_cs.c
+++ b/drivers/char/pcmcia/synclink_cs.c
@@ -3886,9 +3886,8 @@ static bool rx_get_frame(MGSLPC_INFO *info)
3886 framesize = 0; 3886 framesize = 0;
3887#if SYNCLINK_GENERIC_HDLC 3887#if SYNCLINK_GENERIC_HDLC
3888 { 3888 {
3889 struct net_device_stats *stats = hdlc_stats(info->netdev); 3889 info->netdev->stats.rx_errors++;
3890 stats->rx_errors++; 3890 info->netdev->stats.rx_frame_errors++;
3891 stats->rx_frame_errors++;
3892 } 3891 }
3893#endif 3892#endif
3894 } else 3893 } else
@@ -4144,7 +4143,6 @@ static int hdlcdev_attach(struct net_device *dev, unsigned short encoding,
4144static int hdlcdev_xmit(struct sk_buff *skb, struct net_device *dev) 4143static int hdlcdev_xmit(struct sk_buff *skb, struct net_device *dev)
4145{ 4144{
4146 MGSLPC_INFO *info = dev_to_port(dev); 4145 MGSLPC_INFO *info = dev_to_port(dev);
4147 struct net_device_stats *stats = hdlc_stats(dev);
4148 unsigned long flags; 4146 unsigned long flags;
4149 4147
4150 if (debug_level >= DEBUG_LEVEL_INFO) 4148 if (debug_level >= DEBUG_LEVEL_INFO)
@@ -4159,8 +4157,8 @@ static int hdlcdev_xmit(struct sk_buff *skb, struct net_device *dev)
4159 info->tx_put = info->tx_count = skb->len; 4157 info->tx_put = info->tx_count = skb->len;
4160 4158
4161 /* update network statistics */ 4159 /* update network statistics */
4162 stats->tx_packets++; 4160 dev->stats.tx_packets++;
4163 stats->tx_bytes += skb->len; 4161 dev->stats.tx_bytes += skb->len;
4164 4162
4165 /* done with socket buffer, so free it */ 4163 /* done with socket buffer, so free it */
4166 dev_kfree_skb(skb); 4164 dev_kfree_skb(skb);
@@ -4376,14 +4374,13 @@ static int hdlcdev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
4376static void hdlcdev_tx_timeout(struct net_device *dev) 4374static void hdlcdev_tx_timeout(struct net_device *dev)
4377{ 4375{
4378 MGSLPC_INFO *info = dev_to_port(dev); 4376 MGSLPC_INFO *info = dev_to_port(dev);
4379 struct net_device_stats *stats = hdlc_stats(dev);
4380 unsigned long flags; 4377 unsigned long flags;
4381 4378
4382 if (debug_level >= DEBUG_LEVEL_INFO) 4379 if (debug_level >= DEBUG_LEVEL_INFO)
4383 printk("hdlcdev_tx_timeout(%s)\n",dev->name); 4380 printk("hdlcdev_tx_timeout(%s)\n",dev->name);
4384 4381
4385 stats->tx_errors++; 4382 dev->stats.tx_errors++;
4386 stats->tx_aborted_errors++; 4383 dev->stats.tx_aborted_errors++;
4387 4384
4388 spin_lock_irqsave(&info->lock,flags); 4385 spin_lock_irqsave(&info->lock,flags);
4389 tx_stop(info); 4386 tx_stop(info);
@@ -4416,27 +4413,26 @@ static void hdlcdev_rx(MGSLPC_INFO *info, char *buf, int size)
4416{ 4413{
4417 struct sk_buff *skb = dev_alloc_skb(size); 4414 struct sk_buff *skb = dev_alloc_skb(size);
4418 struct net_device *dev = info->netdev; 4415 struct net_device *dev = info->netdev;
4419 struct net_device_stats *stats = hdlc_stats(dev);
4420 4416
4421 if (debug_level >= DEBUG_LEVEL_INFO) 4417 if (debug_level >= DEBUG_LEVEL_INFO)
4422 printk("hdlcdev_rx(%s)\n",dev->name); 4418 printk("hdlcdev_rx(%s)\n",dev->name);
4423 4419
4424 if (skb == NULL) { 4420 if (skb == NULL) {
4425 printk(KERN_NOTICE "%s: can't alloc skb, dropping packet\n", dev->name); 4421 printk(KERN_NOTICE "%s: can't alloc skb, dropping packet\n", dev->name);
4426 stats->rx_dropped++; 4422 dev->stats.rx_dropped++;
4427 return; 4423 return;
4428 } 4424 }
4429 4425
4430 memcpy(skb_put(skb, size),buf,size); 4426 memcpy(skb_put(skb, size), buf, size);
4431 4427
4432 skb->protocol = hdlc_type_trans(skb, info->netdev); 4428 skb->protocol = hdlc_type_trans(skb, dev);
4433 4429
4434 stats->rx_packets++; 4430 dev->stats.rx_packets++;
4435 stats->rx_bytes += size; 4431 dev->stats.rx_bytes += size;
4436 4432
4437 netif_rx(skb); 4433 netif_rx(skb);
4438 4434
4439 info->netdev->last_rx = jiffies; 4435 dev->last_rx = jiffies;
4440} 4436}
4441 4437
4442/** 4438/**
diff --git a/drivers/char/synclink.c b/drivers/char/synclink.c
index ac5080df2565..9d247d8a87a3 100644
--- a/drivers/char/synclink.c
+++ b/drivers/char/synclink.c
@@ -6640,9 +6640,8 @@ static bool mgsl_get_rx_frame(struct mgsl_struct *info)
6640 framesize = 0; 6640 framesize = 0;
6641#if SYNCLINK_GENERIC_HDLC 6641#if SYNCLINK_GENERIC_HDLC
6642 { 6642 {
6643 struct net_device_stats *stats = hdlc_stats(info->netdev); 6643 info->netdev->stats.rx_errors++;
6644 stats->rx_errors++; 6644 info->netdev->stats.rx_frame_errors++;
6645 stats->rx_frame_errors++;
6646 } 6645 }
6647#endif 6646#endif
6648 } else 6647 } else
@@ -7753,7 +7752,6 @@ static int hdlcdev_attach(struct net_device *dev, unsigned short encoding,
7753static int hdlcdev_xmit(struct sk_buff *skb, struct net_device *dev) 7752static int hdlcdev_xmit(struct sk_buff *skb, struct net_device *dev)
7754{ 7753{
7755 struct mgsl_struct *info = dev_to_port(dev); 7754 struct mgsl_struct *info = dev_to_port(dev);
7756 struct net_device_stats *stats = hdlc_stats(dev);
7757 unsigned long flags; 7755 unsigned long flags;
7758 7756
7759 if (debug_level >= DEBUG_LEVEL_INFO) 7757 if (debug_level >= DEBUG_LEVEL_INFO)
@@ -7767,8 +7765,8 @@ static int hdlcdev_xmit(struct sk_buff *skb, struct net_device *dev)
7767 mgsl_load_tx_dma_buffer(info, skb->data, skb->len); 7765 mgsl_load_tx_dma_buffer(info, skb->data, skb->len);
7768 7766
7769 /* update network statistics */ 7767 /* update network statistics */
7770 stats->tx_packets++; 7768 dev->stats.tx_packets++;
7771 stats->tx_bytes += skb->len; 7769 dev->stats.tx_bytes += skb->len;
7772 7770
7773 /* done with socket buffer, so free it */ 7771 /* done with socket buffer, so free it */
7774 dev_kfree_skb(skb); 7772 dev_kfree_skb(skb);
@@ -7984,14 +7982,13 @@ static int hdlcdev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
7984static void hdlcdev_tx_timeout(struct net_device *dev) 7982static void hdlcdev_tx_timeout(struct net_device *dev)
7985{ 7983{
7986 struct mgsl_struct *info = dev_to_port(dev); 7984 struct mgsl_struct *info = dev_to_port(dev);
7987 struct net_device_stats *stats = hdlc_stats(dev);
7988 unsigned long flags; 7985 unsigned long flags;
7989 7986
7990 if (debug_level >= DEBUG_LEVEL_INFO) 7987 if (debug_level >= DEBUG_LEVEL_INFO)
7991 printk("hdlcdev_tx_timeout(%s)\n",dev->name); 7988 printk("hdlcdev_tx_timeout(%s)\n",dev->name);
7992 7989
7993 stats->tx_errors++; 7990 dev->stats.tx_errors++;
7994 stats->tx_aborted_errors++; 7991 dev->stats.tx_aborted_errors++;
7995 7992
7996 spin_lock_irqsave(&info->irq_spinlock,flags); 7993 spin_lock_irqsave(&info->irq_spinlock,flags);
7997 usc_stop_transmitter(info); 7994 usc_stop_transmitter(info);
@@ -8024,27 +8021,27 @@ static void hdlcdev_rx(struct mgsl_struct *info, char *buf, int size)
8024{ 8021{
8025 struct sk_buff *skb = dev_alloc_skb(size); 8022 struct sk_buff *skb = dev_alloc_skb(size);
8026 struct net_device *dev = info->netdev; 8023 struct net_device *dev = info->netdev;
8027 struct net_device_stats *stats = hdlc_stats(dev);
8028 8024
8029 if (debug_level >= DEBUG_LEVEL_INFO) 8025 if (debug_level >= DEBUG_LEVEL_INFO)
8030 printk("hdlcdev_rx(%s)\n",dev->name); 8026 printk("hdlcdev_rx(%s)\n", dev->name);
8031 8027
8032 if (skb == NULL) { 8028 if (skb == NULL) {
8033 printk(KERN_NOTICE "%s: can't alloc skb, dropping packet\n", dev->name); 8029 printk(KERN_NOTICE "%s: can't alloc skb, dropping packet\n",
8034 stats->rx_dropped++; 8030 dev->name);
8031 dev->stats.rx_dropped++;
8035 return; 8032 return;
8036 } 8033 }
8037 8034
8038 memcpy(skb_put(skb, size),buf,size); 8035 memcpy(skb_put(skb, size), buf, size);
8039 8036
8040 skb->protocol = hdlc_type_trans(skb, info->netdev); 8037 skb->protocol = hdlc_type_trans(skb, dev);
8041 8038
8042 stats->rx_packets++; 8039 dev->stats.rx_packets++;
8043 stats->rx_bytes += size; 8040 dev->stats.rx_bytes += size;
8044 8041
8045 netif_rx(skb); 8042 netif_rx(skb);
8046 8043
8047 info->netdev->last_rx = jiffies; 8044 dev->last_rx = jiffies;
8048} 8045}
8049 8046
8050/** 8047/**
diff --git a/drivers/char/synclink_gt.c b/drivers/char/synclink_gt.c
index 55c1653be00c..d88a607e34b7 100644
--- a/drivers/char/synclink_gt.c
+++ b/drivers/char/synclink_gt.c
@@ -1544,7 +1544,6 @@ static int hdlcdev_attach(struct net_device *dev, unsigned short encoding,
1544static int hdlcdev_xmit(struct sk_buff *skb, struct net_device *dev) 1544static int hdlcdev_xmit(struct sk_buff *skb, struct net_device *dev)
1545{ 1545{
1546 struct slgt_info *info = dev_to_port(dev); 1546 struct slgt_info *info = dev_to_port(dev);
1547 struct net_device_stats *stats = hdlc_stats(dev);
1548 unsigned long flags; 1547 unsigned long flags;
1549 1548
1550 DBGINFO(("%s hdlc_xmit\n", dev->name)); 1549 DBGINFO(("%s hdlc_xmit\n", dev->name));
@@ -1557,8 +1556,8 @@ static int hdlcdev_xmit(struct sk_buff *skb, struct net_device *dev)
1557 tx_load(info, skb->data, skb->len); 1556 tx_load(info, skb->data, skb->len);
1558 1557
1559 /* update network statistics */ 1558 /* update network statistics */
1560 stats->tx_packets++; 1559 dev->stats.tx_packets++;
1561 stats->tx_bytes += skb->len; 1560 dev->stats.tx_bytes += skb->len;
1562 1561
1563 /* done with socket buffer, so free it */ 1562 /* done with socket buffer, so free it */
1564 dev_kfree_skb(skb); 1563 dev_kfree_skb(skb);
@@ -1775,13 +1774,12 @@ static int hdlcdev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
1775static void hdlcdev_tx_timeout(struct net_device *dev) 1774static void hdlcdev_tx_timeout(struct net_device *dev)
1776{ 1775{
1777 struct slgt_info *info = dev_to_port(dev); 1776 struct slgt_info *info = dev_to_port(dev);
1778 struct net_device_stats *stats = hdlc_stats(dev);
1779 unsigned long flags; 1777 unsigned long flags;
1780 1778
1781 DBGINFO(("%s hdlcdev_tx_timeout\n", dev->name)); 1779 DBGINFO(("%s hdlcdev_tx_timeout\n", dev->name));
1782 1780
1783 stats->tx_errors++; 1781 dev->stats.tx_errors++;
1784 stats->tx_aborted_errors++; 1782 dev->stats.tx_aborted_errors++;
1785 1783
1786 spin_lock_irqsave(&info->lock,flags); 1784 spin_lock_irqsave(&info->lock,flags);
1787 tx_stop(info); 1785 tx_stop(info);
@@ -1814,26 +1812,25 @@ static void hdlcdev_rx(struct slgt_info *info, char *buf, int size)
1814{ 1812{
1815 struct sk_buff *skb = dev_alloc_skb(size); 1813 struct sk_buff *skb = dev_alloc_skb(size);
1816 struct net_device *dev = info->netdev; 1814 struct net_device *dev = info->netdev;
1817 struct net_device_stats *stats = hdlc_stats(dev);
1818 1815
1819 DBGINFO(("%s hdlcdev_rx\n", dev->name)); 1816 DBGINFO(("%s hdlcdev_rx\n", dev->name));
1820 1817
1821 if (skb == NULL) { 1818 if (skb == NULL) {
1822 DBGERR(("%s: can't alloc skb, drop packet\n", dev->name)); 1819 DBGERR(("%s: can't alloc skb, drop packet\n", dev->name));
1823 stats->rx_dropped++; 1820 dev->stats.rx_dropped++;
1824 return; 1821 return;
1825 } 1822 }
1826 1823
1827 memcpy(skb_put(skb, size),buf,size); 1824 memcpy(skb_put(skb, size), buf, size);
1828 1825
1829 skb->protocol = hdlc_type_trans(skb, info->netdev); 1826 skb->protocol = hdlc_type_trans(skb, dev);
1830 1827
1831 stats->rx_packets++; 1828 dev->stats.rx_packets++;
1832 stats->rx_bytes += size; 1829 dev->stats.rx_bytes += size;
1833 1830
1834 netif_rx(skb); 1831 netif_rx(skb);
1835 1832
1836 info->netdev->last_rx = jiffies; 1833 dev->last_rx = jiffies;
1837} 1834}
1838 1835
1839/** 1836/**
@@ -4577,9 +4574,8 @@ check_again:
4577 4574
4578#if SYNCLINK_GENERIC_HDLC 4575#if SYNCLINK_GENERIC_HDLC
4579 if (framesize == 0) { 4576 if (framesize == 0) {
4580 struct net_device_stats *stats = hdlc_stats(info->netdev); 4577 info->netdev->stats.rx_errors++;
4581 stats->rx_errors++; 4578 info->netdev->stats.rx_frame_errors++;
4582 stats->rx_frame_errors++;
4583 } 4579 }
4584#endif 4580#endif
4585 4581
diff --git a/drivers/char/synclinkmp.c b/drivers/char/synclinkmp.c
index bec54866e0bb..10241ed86100 100644
--- a/drivers/char/synclinkmp.c
+++ b/drivers/char/synclinkmp.c
@@ -1678,7 +1678,6 @@ static int hdlcdev_attach(struct net_device *dev, unsigned short encoding,
1678static int hdlcdev_xmit(struct sk_buff *skb, struct net_device *dev) 1678static int hdlcdev_xmit(struct sk_buff *skb, struct net_device *dev)
1679{ 1679{
1680 SLMP_INFO *info = dev_to_port(dev); 1680 SLMP_INFO *info = dev_to_port(dev);
1681 struct net_device_stats *stats = hdlc_stats(dev);
1682 unsigned long flags; 1681 unsigned long flags;
1683 1682
1684 if (debug_level >= DEBUG_LEVEL_INFO) 1683 if (debug_level >= DEBUG_LEVEL_INFO)
@@ -1692,8 +1691,8 @@ static int hdlcdev_xmit(struct sk_buff *skb, struct net_device *dev)
1692 tx_load_dma_buffer(info, skb->data, skb->len); 1691 tx_load_dma_buffer(info, skb->data, skb->len);
1693 1692
1694 /* update network statistics */ 1693 /* update network statistics */
1695 stats->tx_packets++; 1694 dev->stats.tx_packets++;
1696 stats->tx_bytes += skb->len; 1695 dev->stats.tx_bytes += skb->len;
1697 1696
1698 /* done with socket buffer, so free it */ 1697 /* done with socket buffer, so free it */
1699 dev_kfree_skb(skb); 1698 dev_kfree_skb(skb);
@@ -1909,14 +1908,13 @@ static int hdlcdev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
1909static void hdlcdev_tx_timeout(struct net_device *dev) 1908static void hdlcdev_tx_timeout(struct net_device *dev)
1910{ 1909{
1911 SLMP_INFO *info = dev_to_port(dev); 1910 SLMP_INFO *info = dev_to_port(dev);
1912 struct net_device_stats *stats = hdlc_stats(dev);
1913 unsigned long flags; 1911 unsigned long flags;
1914 1912
1915 if (debug_level >= DEBUG_LEVEL_INFO) 1913 if (debug_level >= DEBUG_LEVEL_INFO)
1916 printk("hdlcdev_tx_timeout(%s)\n",dev->name); 1914 printk("hdlcdev_tx_timeout(%s)\n",dev->name);
1917 1915
1918 stats->tx_errors++; 1916 dev->stats.tx_errors++;
1919 stats->tx_aborted_errors++; 1917 dev->stats.tx_aborted_errors++;
1920 1918
1921 spin_lock_irqsave(&info->lock,flags); 1919 spin_lock_irqsave(&info->lock,flags);
1922 tx_stop(info); 1920 tx_stop(info);
@@ -1949,27 +1947,27 @@ static void hdlcdev_rx(SLMP_INFO *info, char *buf, int size)
1949{ 1947{
1950 struct sk_buff *skb = dev_alloc_skb(size); 1948 struct sk_buff *skb = dev_alloc_skb(size);
1951 struct net_device *dev = info->netdev; 1949 struct net_device *dev = info->netdev;
1952 struct net_device_stats *stats = hdlc_stats(dev);
1953 1950
1954 if (debug_level >= DEBUG_LEVEL_INFO) 1951 if (debug_level >= DEBUG_LEVEL_INFO)
1955 printk("hdlcdev_rx(%s)\n",dev->name); 1952 printk("hdlcdev_rx(%s)\n",dev->name);
1956 1953
1957 if (skb == NULL) { 1954 if (skb == NULL) {
1958 printk(KERN_NOTICE "%s: can't alloc skb, dropping packet\n", dev->name); 1955 printk(KERN_NOTICE "%s: can't alloc skb, dropping packet\n",
1959 stats->rx_dropped++; 1956 dev->name);
1957 dev->stats.rx_dropped++;
1960 return; 1958 return;
1961 } 1959 }
1962 1960
1963 memcpy(skb_put(skb, size),buf,size); 1961 memcpy(skb_put(skb, size), buf, size);
1964 1962
1965 skb->protocol = hdlc_type_trans(skb, info->netdev); 1963 skb->protocol = hdlc_type_trans(skb, dev);
1966 1964
1967 stats->rx_packets++; 1965 dev->stats.rx_packets++;
1968 stats->rx_bytes += size; 1966 dev->stats.rx_bytes += size;
1969 1967
1970 netif_rx(skb); 1968 netif_rx(skb);
1971 1969
1972 info->netdev->last_rx = jiffies; 1970 dev->last_rx = jiffies;
1973} 1971}
1974 1972
1975/** 1973/**
@@ -4983,9 +4981,8 @@ CheckAgain:
4983 framesize = 0; 4981 framesize = 0;
4984#if SYNCLINK_GENERIC_HDLC 4982#if SYNCLINK_GENERIC_HDLC
4985 { 4983 {
4986 struct net_device_stats *stats = hdlc_stats(info->netdev); 4984 info->netdev->stats.rx_errors++;
4987 stats->rx_errors++; 4985 info->netdev->stats.rx_frame_errors++;
4988 stats->rx_frame_errors++;
4989 } 4986 }
4990#endif 4987#endif
4991 } 4988 }