All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@vyatta.com>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Subject: [PATCH 52/77] sbni: use internal net_device_stats
Date: Fri, 20 Mar 2009 22:36:19 -0700	[thread overview]
Message-ID: <20090321053716.500120634@vyatta.com> (raw)
In-Reply-To: 20090321053527.316395697@vyatta.com

[-- Attachment #1: sbni.patch --]
[-- Type: text/plain, Size: 5136 bytes --]

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>

--- a/drivers/net/wan/sbni.c	2009-03-20 17:14:16.263027723 -0700
+++ b/drivers/net/wan/sbni.c	2009-03-20 17:22:27.542840306 -0700
@@ -68,7 +68,6 @@
 /* device private data */
 
 struct net_local {
-	struct net_device_stats	stats;
 	struct timer_list	watchdog;
 
 	spinlock_t	lock;
@@ -117,7 +116,6 @@ static int  sbni_open( struct net_device
 static int  sbni_close( struct net_device * );
 static int  sbni_start_xmit( struct sk_buff *, struct net_device * );
 static int  sbni_ioctl( struct net_device *, struct ifreq *, int );
-static struct net_device_stats  *sbni_get_stats( struct net_device * );
 static void  set_multicast_list( struct net_device * );
 
 static irqreturn_t sbni_interrupt( int, void * );
@@ -723,13 +721,11 @@ upload_data( struct net_device  *dev,  u
 			nl->wait_frameno = 0,
 			nl->inppos = 0,
 #ifdef CONFIG_SBNI_MULTILINE
-			((struct net_local *)netdev_priv(nl->master))
-				->stats.rx_errors++,
-			((struct net_local *)netdev_priv(nl->master))
-				->stats.rx_missed_errors++;
+			nl->master->stats.rx_errors++,
+			nl->master->stats.rx_missed_errors++;
 #else
-			nl->stats.rx_errors++,
-			nl->stats.rx_missed_errors++;
+		        dev->stats.rx_errors++,
+			dev->stats.rx_missed_errors++;
 #endif
 			/* now skip all frames until is_first != 0 */
 	} else
@@ -742,13 +738,11 @@ upload_data( struct net_device  *dev,  u
 		 */
 		nl->wait_frameno = 0,
 #ifdef CONFIG_SBNI_MULTILINE
-		((struct net_local *)netdev_priv(nl->master))
-			->stats.rx_errors++,
-		((struct net_local *)netdev_priv(nl->master))
-			->stats.rx_crc_errors++;
+		nl->master->stats.rx_errors++,
+		nl->master->stats.rx_crc_errors++;
 #else
-		nl->stats.rx_errors++,
-		nl->stats.rx_crc_errors++;
+		dev->stats.rx_errors++,
+		dev->stats.rx_crc_errors++;
 #endif
 
 	return  frame_ok;
@@ -756,15 +750,16 @@ upload_data( struct net_device  *dev,  u
 
 
 static inline void
-send_complete( struct net_local  *nl )
+send_complete( struct net_device *dev )
 {
+	struct net_local  *nl = netdev_priv(dev);
+
 #ifdef CONFIG_SBNI_MULTILINE
-	((struct net_local *)netdev_priv(nl->master))->stats.tx_packets++;
-	((struct net_local *)netdev_priv(nl->master))->stats.tx_bytes
-		+= nl->tx_buf_p->len;
+	nl->master->stats.tx_packets++;
+	nl->master->stats.tx_bytes += nl->tx_buf_p->len;
 #else
-	nl->stats.tx_packets++;
-	nl->stats.tx_bytes += nl->tx_buf_p->len;
+	dev->stats.tx_packets++;
+	dev->stats.tx_bytes += nl->tx_buf_p->len;
 #endif
 	dev_kfree_skb_irq( nl->tx_buf_p );
 
@@ -792,7 +787,7 @@ interpret_ack( struct net_device  *dev, 
 						   nl->maxframe,
 						   nl->tx_buf_p->len - nl->outpos);
 			else
-				send_complete( nl ),
+				send_complete( dev ),
 #ifdef CONFIG_SBNI_MULTILINE
 				netif_wake_queue( nl->master );
 #else
@@ -881,13 +876,11 @@ drop_xmit_queue( struct net_device  *dev
 		dev_kfree_skb_any( nl->tx_buf_p ),
 		nl->tx_buf_p = NULL,
 #ifdef CONFIG_SBNI_MULTILINE
-		((struct net_local *)netdev_priv(nl->master))
-			->stats.tx_errors++,
-		((struct net_local *)netdev_priv(nl->master))
-			->stats.tx_carrier_errors++;
+		nl->master->stats.tx_errors++,
+		nl->master->stats.tx_carrier_errors++;
 #else
-		nl->stats.tx_errors++,
-		nl->stats.tx_carrier_errors++;
+		dev->stats.tx_errors++,
+		dev->stats.tx_carrier_errors++;
 #endif
 
 	nl->tx_frameno	= 0;
@@ -1017,14 +1010,13 @@ indicate_pkt( struct net_device  *dev )
 #ifdef CONFIG_SBNI_MULTILINE
 	skb->protocol = eth_type_trans( skb, nl->master );
 	netif_rx( skb );
-	++((struct net_local *)netdev_priv(nl->master))->stats.rx_packets;
-	((struct net_local *)netdev_priv(nl->master))->stats.rx_bytes +=
-		nl->inppos;
+	++nl->master->stats.rx_packets;
+	nl->master->stats.rx_bytes += nl->inppos;
 #else
 	skb->protocol = eth_type_trans( skb, dev );
 	netif_rx( skb );
-	++nl->stats.rx_packets;
-	nl->stats.rx_bytes += nl->inppos;
+	++dev->stats.rx_packets;
+	dev->stats.rx_bytes += nl->inppos;
 #endif
 	nl->rx_buf_p = NULL;	/* protocol driver will clear this sk_buff */
 }
@@ -1197,7 +1189,7 @@ sbni_open( struct net_device  *dev )
 handler_attached:
 
 	spin_lock( &nl->lock );
-	memset( &nl->stats, 0, sizeof(struct net_device_stats) );
+	memset( &dev->stats, 0, sizeof(struct net_device_stats) );
 	memset( &nl->in_stats, 0, sizeof(struct sbni_in_stats) );
 
 	card_start( dev );
@@ -1413,7 +1405,7 @@ enslave( struct net_device  *dev,  struc
 
 	/* Summary statistics of MultiLine operation will be stored
 	   in master's counters */
-	memset( &snl->stats, 0, sizeof(struct net_device_stats) );
+	memset( &slave_dev->stats, 0, sizeof(struct net_device_stats) );
 	netif_stop_queue( slave_dev );
 	netif_wake_queue( dev );	/* Now we are able to transmit */
 
@@ -1464,14 +1456,6 @@ emancipate( struct net_device  *dev )
 
 #endif
 
-
-static struct net_device_stats *
-sbni_get_stats( struct net_device  *dev )
-{
-	return  &((struct net_local *)netdev_priv(dev))->stats;
-}
-
-
 static void
 set_multicast_list( struct net_device  *dev )
 {

-- 


  parent reply	other threads:[~2009-03-21  5:48 UTC|newest]

Thread overview: 229+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-21  5:35 [PATCH 00/77] Convert most of the rest of the devices to net_device_ops Stephen Hemminger
2009-03-21  5:35 ` [PATCH 01/77] atm: convert mpc device to using netdev_ops Stephen Hemminger
2009-03-21 11:44   ` Chas Williams (CONTRACTOR)
2009-03-22  2:34   ` David Miller
2009-03-21  5:35 ` [PATCH 02/77] atm: cconvert clip driver to net_device_ops Stephen Hemminger
2009-03-22  2:34   ` David Miller
2009-03-21  5:35 ` [ofa-general] [PATCH 03/77] infiniband: convert c2 " Stephen Hemminger
2009-03-21 18:26   ` [ofa-general] " Steve Wise
2009-03-22  2:34   ` David Miller
2009-03-22 16:12   ` [ofa-general] " Roland Dreier
2009-03-23  4:17     ` David Miller
2009-03-21  5:35 ` [ofa-general] [PATCH 04/77] infiniband: convert nes driver " Stephen Hemminger
2009-03-22  2:34   ` David Miller
2009-03-21  5:35 ` [ofa-general] [PATCH 05/77] infiniband: convert ipoib " Stephen Hemminger
2009-03-22  2:34   ` [ofa-general] " David Miller
2009-03-21  5:35 ` [PATCH 06/77] irda: net_device_ops ioctl fix Stephen Hemminger
2009-03-22  2:34   ` David Miller
2009-03-23 11:33   ` Samuel Ortiz
2009-03-23 11:33   ` Samuel Ortiz
2009-03-21  5:35 ` [PATCH 07/77] irlan: convert to net_device_ops Stephen Hemminger
2009-03-22  2:34   ` David Miller
2009-03-23 11:33   ` Samuel Ortiz
2009-03-21  5:35 ` [PATCH 08/77] irda: convert irda_usb " Stephen Hemminger
2009-03-22  2:34   ` David Miller
2009-03-23 11:34   ` Samuel Ortiz
2009-03-21  5:35 ` [PATCH 09/77] irda: convert mcs driver " Stephen Hemminger
2009-03-22  2:34   ` David Miller
2009-03-23 11:34   ` Samuel Ortiz
2009-03-21  5:35 ` [PATCH 10/77] stir4200: convert " Stephen Hemminger
2009-03-22  2:34   ` David Miller
2009-03-23 11:34   ` Samuel Ortiz
2009-03-21  5:35 ` [PATCH 11/77] irda: convert w83977af_ir " Stephen Hemminger
2009-03-22  2:36   ` David Miller
2009-03-23 11:35   ` Samuel Ortiz
2009-03-21  5:35 ` [PATCH 12/77] irda: convert nsc_ircc driver " Stephen Hemminger
2009-03-22  2:36   ` David Miller
2009-03-23 11:35   ` Samuel Ortiz
2009-03-21  5:35 ` [PATCH 13/77] irda: convert ali " Stephen Hemminger
2009-03-22  2:36   ` David Miller
2009-03-23 11:35   ` Samuel Ortiz
2009-03-21  5:35 ` [PATCH 14/77] irda: convert vlsi " Stephen Hemminger
2009-03-22  2:36   ` David Miller
2009-03-23 11:35   ` Samuel Ortiz
2009-03-21  5:35 ` [PATCH 15/77] irda: convert smsc " Stephen Hemminger
2009-03-22  2:36   ` David Miller
2009-03-23 11:36   ` Samuel Ortiz
2009-03-21  5:35 ` [PATCH 16/77] irda: convert via-ircc " Stephen Hemminger
2009-03-22  2:36   ` David Miller
2009-03-23 11:36   ` Samuel Ortiz
2009-03-21  5:35 ` [PATCH 17/77] irda: convert sir device " Stephen Hemminger
2009-03-22  2:36   ` David Miller
2009-03-23 11:36   ` Samuel Ortiz
2009-03-21  5:35 ` [PATCH 18/77] irda: convert kignsun " Stephen Hemminger
2009-03-22  2:37   ` David Miller
2009-03-23 11:37   ` Samuel Ortiz
2009-03-21  5:35 ` [PATCH 19/77] irda: convert ksdazzle " Stephen Hemminger
2009-03-22  2:37   ` David Miller
2009-03-23 11:37   ` Samuel Ortiz
2009-03-21  5:35 ` [PATCH 20/77] irda: convert ks959 " Stephen Hemminger
2009-03-22  2:37   ` David Miller
2009-03-23 11:37   ` Samuel Ortiz
2009-03-21  5:35 ` [PATCH 21/77] usbnet: convert catc to internal net_device_stats Stephen Hemminger
2009-03-22  2:45   ` David Miller
2009-03-21  5:35 ` [PATCH 22/77] usbnet: convert catc device to net_device_ops Stephen Hemminger
2009-03-21  9:01   ` David Brownell
2009-03-21 13:02     ` Vojtech Pavlik
2009-03-21 10:17   ` Jiri Pirko
2009-03-22  2:40     ` David Miller
2009-03-22  2:45   ` David Miller
2009-03-21  5:35 ` [PATCH 23/77] usbnet: convert to internal net_device stats Stephen Hemminger
2009-03-21  9:01   ` David Brownell
2009-03-21 13:02     ` Vojtech Pavlik
2009-03-22  2:45   ` David Miller
2009-03-21  5:35 ` [PATCH 24/77] usbnet: convert rtl driver to net_device_ops Stephen Hemminger
2009-03-21  9:03   ` David Brownell
2009-03-23  9:17     ` Petko Manolov
2009-03-22  2:45   ` David Miller
2009-03-21  5:35 ` [PATCH 25/77] usbnet: convert hso " Stephen Hemminger
2009-03-21  9:08   ` David Brownell
2009-03-22  2:45   ` David Miller
2009-03-21  5:35 ` [PATCH 26/77] usbnet: convert to internal net_device_stats Stephen Hemminger
2009-03-21  9:09   ` David Brownell
2009-03-22  2:46   ` David Miller
2009-03-21  5:35 ` [PATCH 27/77] usbnet: support net_device_ops Stephen Hemminger
2009-03-21  9:11   ` David Brownell
2009-03-22  2:46   ` David Miller
2009-03-21  5:35 ` [PATCH 28/77] usbnet: convert asix driver to net_device_ops Stephen Hemminger
2009-03-21  9:12   ` David Brownell
2009-03-22  2:46   ` David Miller
2009-03-21  5:35 ` [PATCH 29/77] usbnet: convert dms9601 " Stephen Hemminger
2009-03-21  9:14   ` David Brownell
2009-03-21 10:57     ` Peter Korsgaard
2009-03-21 11:28       ` Peter Korsgaard
2009-03-22  3:00   ` David Miller
2009-03-21  5:35 ` [PATCH 30/77] usbnet: convert msc7830 " Stephen Hemminger
2009-03-21  9:19   ` David Brownell
2009-03-22  3:00   ` David Miller
2009-03-21  5:35 ` [PATCH 31/77] usbnet: convert sms95xx " Stephen Hemminger
2009-03-21  9:20   ` David Brownell
2009-03-21 15:53     ` Steve.Glendinning
2009-03-22  3:01   ` David Miller
2009-03-21  5:35 ` [PATCH 32/77] usbnet: convert rndis driver to use dev_get_stats Stephen Hemminger
2009-03-21  9:22   ` David Brownell
2009-03-22  3:01   ` David Miller
2009-03-21  5:36 ` [PATCH 33/77] usbnet: convert rndis driver to net_device_ops Stephen Hemminger
2009-03-21  9:23   ` David Brownell
2009-03-22  3:01   ` David Miller
2009-03-21  5:36 ` [PATCH 34/77] pcmcia: convert 3c589 " Stephen Hemminger
2009-03-22  3:01   ` David Miller
2009-03-21  5:36 ` [PATCH 35/77] pcmcia: convert 3c574 " Stephen Hemminger
2009-03-22  3:01   ` David Miller
2009-03-21  5:36 ` [PATCH 36/77] pcmcia: convert fmvj18x driver to internal net_device_stats Stephen Hemminger
2009-03-22  3:01   ` David Miller
2009-03-21  5:36 ` [PATCH 37/77] pcmcia: convert fmvj18x driver to net_device_ops Stephen Hemminger
2009-03-22  3:01   ` David Miller
2009-03-21  5:36 ` [PATCH 38/77] pcmcia: convert nmclan " Stephen Hemminger
2009-03-22  3:01   ` David Miller
2009-03-21  5:36 ` [PATCH 39/77] pcnet: convert " Stephen Hemminger
2009-03-22  3:01   ` David Miller
2009-03-21  5:36 ` [PATCH 40/77] xir2cps: convert to internal net_device stats Stephen Hemminger
2009-03-22  3:02   ` David Miller
2009-03-21  5:36 ` [PATCH 41/77] xirc2ps: convert to net_device_ops Stephen Hemminger
2009-03-22  5:42   ` David Miller
2009-03-21  5:36 ` [PATCH 42/77] smc91c92: convert to internal net_device_stats Stephen Hemminger
2009-03-22  5:42   ` David Miller
2009-03-21  5:36 ` [PATCH 43/77] smc91c92: convert to net_device_ops Stephen Hemminger
2009-03-22  5:42   ` David Miller
2009-03-21  5:36 ` [PATCH 44/77] axnet: convert ot net_device_ops Stephen Hemminger
2009-03-22  5:42   ` David Miller
2009-03-21  5:36 ` [PATCH 45/77] x25_asy: convert to internal net_device_stats Stephen Hemminger
2009-03-22  5:42   ` David Miller
2009-03-21  5:36 ` [PATCH 46/77] x25_asy: convert to net_device_ops Stephen Hemminger
2009-03-22  5:43   ` David Miller
2009-03-21  5:36 ` [PATCH 47/77] dlci: convert to internal net_device_stats Stephen Hemminger
2009-03-22  5:43   ` David Miller
2009-03-21  5:36 ` [PATCH 48/77] dlci: convert to net_device_ops Stephen Hemminger
2009-03-22  5:43   ` David Miller
2009-03-21  5:36 ` [PATCH 49/77] cycx: " Stephen Hemminger
2009-03-22  5:43   ` David Miller
2009-03-21  5:36 ` [PATCH 50/77] lapbether: convert to internal net_device_stats Stephen Hemminger
2009-03-22  5:43   ` David Miller
2009-03-21  5:36 ` [PATCH 51/77] labether: convert to net_device_ops Stephen Hemminger
2009-03-22  5:47   ` David Miller
2009-03-21  5:36 ` Stephen Hemminger [this message]
2009-03-22  5:47   ` [PATCH 52/77] sbni: use internal net_device_stats David Miller
2009-03-21  5:36 ` [PATCH 53/77] sbni: convert to net_device_ops Stephen Hemminger
2009-03-22  5:47   ` David Miller
2009-03-21  5:36 ` [PATCH 54/77] netwave: convert to internal net_device_stats Stephen Hemminger
2009-03-21  5:36   ` Stephen Hemminger
2009-03-22  5:47   ` David Miller
2009-03-22  5:47     ` David Miller
2009-03-21  5:36 ` [PATCH 55/77] netwave: convert to net_device_ops Stephen Hemminger
2009-03-21  5:36   ` Stephen Hemminger
2009-03-22  5:48   ` David Miller
2009-03-21  5:36 ` [PATCH 56/77] strip: " Stephen Hemminger
2009-03-21  5:36   ` Stephen Hemminger
2009-03-22  5:47   ` David Miller
2009-03-21  5:36 ` [PATCH 57/77] wavelan: convert to internal net_device_stats Stephen Hemminger
2009-03-21  5:36   ` Stephen Hemminger
2009-03-22  5:47   ` David Miller
2009-03-22  5:47     ` David Miller
2009-03-21  5:36 ` [PATCH 58/77] wavelan: convert to net_device_ops Stephen Hemminger
2009-03-21  5:36   ` Stephen Hemminger
2009-03-22  5:47   ` David Miller
2009-03-21  5:36 ` [PATCH 59/77] airo: " Stephen Hemminger
2009-03-21  5:36   ` Stephen Hemminger
2009-03-22  5:48   ` David Miller
2009-03-22  5:48     ` David Miller
2009-03-21  5:36 ` [PATCH 60/77] atmel: " Stephen Hemminger
2009-03-21  5:36   ` Stephen Hemminger
2009-03-22  5:48   ` David Miller
2009-03-22  5:48     ` David Miller
2009-03-21  5:36 ` [PATCH 61/77] raylan: " Stephen Hemminger
2009-03-21  5:36   ` Stephen Hemminger
2009-03-22  5:53   ` David Miller
2009-03-21  5:36 ` [PATCH 62/77] wl3501: convert to internal net_device_stats Stephen Hemminger
2009-03-22  5:53   ` David Miller
2009-03-21  5:36 ` [PATCH 63/77] wl3501: convert to net_device_ops Stephen Hemminger
2009-03-22  5:53   ` David Miller
2009-03-21  5:36 ` [PATCH 64/77] zd1201: convert to internal net_device_stats Stephen Hemminger
2009-03-21  5:36   ` Stephen Hemminger
2009-03-22  5:53   ` David Miller
2009-03-22  5:53     ` David Miller
2009-03-21  5:36 ` [PATCH 65/77] zd1201: convert to net_device_ops Stephen Hemminger
2009-03-21  5:36   ` Stephen Hemminger
2009-03-22  5:53   ` David Miller
2009-03-22  5:53     ` David Miller
2009-03-21  5:36 ` [PATCH 66/77] mac80211_hwsim: convert to internal net_device_stats Stephen Hemminger
2009-03-21  5:36   ` Stephen Hemminger
2009-03-21 11:08   ` Johannes Berg
2009-03-21 11:08     ` Johannes Berg
2009-03-22  5:49     ` David Miller
2009-03-22  5:53   ` David Miller
2009-03-22  5:53     ` David Miller
2009-03-21  5:36 ` [PATCH 67/77] prism54: convert to net_device_ops Stephen Hemminger
2009-03-21  5:36   ` Stephen Hemminger
2009-03-22  5:53   ` David Miller
2009-03-22  5:53     ` David Miller
2009-03-21  5:36 ` [PATCH 68/77] prism54: convert to internal net_device_stats Stephen Hemminger
2009-03-21  5:36   ` Stephen Hemminger
2009-03-22  5:53   ` David Miller
2009-03-21  5:36 ` [PATCH 69/77] libertas: " Stephen Hemminger
2009-03-21  5:36   ` Stephen Hemminger
2009-03-22  5:54   ` David Miller
2009-03-21  5:36 ` [PATCH 70/77] libertas: convert to net_device_ops Stephen Hemminger
2009-03-21  5:36   ` Stephen Hemminger
2009-03-22  5:54   ` David Miller
2009-03-21  5:36 ` [PATCH 71/77] ipw2x00: convert to internal net_device_stats Stephen Hemminger
2009-03-21  5:36   ` Stephen Hemminger
2009-03-22  5:56   ` David Miller
2009-03-21  5:36 ` [PATCH 72/77] ipw2x00: convert infrastructure for use by net_device_ops Stephen Hemminger
2009-03-21  5:36   ` Stephen Hemminger
2009-03-22  5:56   ` David Miller
2009-03-21  5:36 ` [PATCH 73/77] ipw2100: convert to net_device_ops Stephen Hemminger
2009-03-21  5:36   ` Stephen Hemminger
2009-03-22  5:57   ` David Miller
2009-03-22  5:57     ` David Miller
2009-03-21  5:36 ` [PATCH 74/77] ipw2200: " Stephen Hemminger
2009-03-21  5:36   ` Stephen Hemminger
2009-03-22  5:57   ` David Miller
2009-03-22  5:57     ` David Miller
2009-03-21  5:36 ` [PATCH 75/77] hostap: convert to internal net_device_stats Stephen Hemminger
2009-03-21  5:36   ` Stephen Hemminger
2009-03-22  5:57   ` David Miller
2009-03-21  5:36 ` [PATCH 76/77] hostap: convert to net_device_ops Stephen Hemminger
2009-03-21  5:36   ` Stephen Hemminger
2009-03-22  5:57   ` David Miller
2009-03-21  5:36 ` [PATCH 77/77] netdev: expose net_device_ops compat as config option Stephen Hemminger
2009-03-22  5:57   ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090321053716.500120634@vyatta.com \
    --to=shemminger@vyatta.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.