linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Jiri Kosina <trivial@kernel.org>, linux-kernel@vger.kernel.org
Cc: "David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	netdev@vger.kernel.org
Subject: [PATCH 18/29] wan: sbni: Avoid comma separated statements
Date: Mon, 24 Aug 2020 21:56:15 -0700	[thread overview]
Message-ID: <e79d390c5b492ecbf61fb79d35625f88c57265b6.1598331149.git.joe@perches.com> (raw)
In-Reply-To: <cover.1598331148.git.joe@perches.com>

Use semicolons and braces.

Signed-off-by: Joe Perches <joe@perches.com>
---
 drivers/net/wan/sbni.c | 101 +++++++++++++++++++++++------------------
 1 file changed, 58 insertions(+), 43 deletions(-)

diff --git a/drivers/net/wan/sbni.c b/drivers/net/wan/sbni.c
index 40c04ea1200a..2fde439543fb 100644
--- a/drivers/net/wan/sbni.c
+++ b/drivers/net/wan/sbni.c
@@ -260,11 +260,12 @@ static int __init sbni_init(struct net_device *dev)
 		return  sbni_isa_probe( dev );
 	/* otherwise we have to perform search our adapter */
 
-	if( io[ num ] != -1 )
-		dev->base_addr	= io[ num ],
+	if( io[ num ] != -1 ) {
+		dev->base_addr	= io[ num ];
 		dev->irq	= irq[ num ];
-	else if( scandone  ||  io[ 0 ] != -1 )
+	} else if( scandone  ||  io[ 0 ] != -1 ) {
 		return  -ENODEV;
+	}
 
 	/* if io[ num ] contains non-zero address, then that is on ISA bus */
 	if( dev->base_addr )
@@ -399,12 +400,13 @@ sbni_probe1( struct net_device  *dev,  unsigned long  ioaddr,  int  irq )
 	nl->maxframe  = DEFAULT_FRAME_LEN;
 	nl->csr1.rate = baud[ num ];
 
-	if( (nl->cur_rxl_index = rxl[ num ]) == -1 )
+	if( (nl->cur_rxl_index = rxl[ num ]) == -1 ) {
 		/* autotune rxl */
-		nl->cur_rxl_index = DEF_RXL,
+		nl->cur_rxl_index = DEF_RXL;
 		nl->delta_rxl = DEF_RXL_DELTA;
-	else
+	} else {
 		nl->delta_rxl = 0;
+	}
 	nl->csr1.rxl  = rxl_tab[ nl->cur_rxl_index ];
 	if( inb( ioaddr + CSR0 ) & 0x01 )
 		nl->state |= FL_SLOW_MODE;
@@ -512,13 +514,15 @@ sbni_interrupt( int  irq,  void  *dev_id )
 
 	do {
 		repeat = 0;
-		if( inb( dev->base_addr + CSR0 ) & (RC_RDY | TR_RDY) )
-			handle_channel( dev ),
+		if( inb( dev->base_addr + CSR0 ) & (RC_RDY | TR_RDY) ) {
+			handle_channel( dev );
 			repeat = 1;
+		}
 		if( nl->second  && 	/* second channel present */
-		    (inb( nl->second->base_addr+CSR0 ) & (RC_RDY | TR_RDY)) )
-			handle_channel( nl->second ),
+		    (inb( nl->second->base_addr+CSR0 ) & (RC_RDY | TR_RDY)) ) {
+			handle_channel( nl->second );
 			repeat = 1;
+		}
 	} while( repeat );
 
 	if( nl->second )
@@ -610,11 +614,12 @@ recv_frame( struct net_device  *dev )
 		nl->state |= FL_PREV_OK;
 		if( framelen > 4 )
 			nl->in_stats.all_rx_number++;
-	} else
-		nl->state &= ~FL_PREV_OK,
-		change_level( dev ),
-		nl->in_stats.all_rx_number++,
+	} else {
+		nl->state &= ~FL_PREV_OK;
+		change_level( dev );
+		nl->in_stats.all_rx_number++;
 		nl->in_stats.bad_rx_number++;
+	}
 
 	return  !frame_ok  ||  framelen > 4;
 }
@@ -689,9 +694,10 @@ download_data( struct net_device  *dev,  u32  *crc_p )
 	*crc_p = calc_crc32( *crc_p, skb->data + nl->outpos, len );
 
 	/* if packet too short we should write some more bytes to pad */
-	for( len = nl->framelen - len;  len--; )
-		outb( 0, dev->base_addr + DAT ),
+	for( len = nl->framelen - len;  len--; ) {
+		outb( 0, dev->base_addr + DAT );
 		*crc_p = CRC32( 0, *crc_p );
+	}
 }
 
 
@@ -703,9 +709,10 @@ upload_data( struct net_device  *dev,  unsigned  framelen,  unsigned  frameno,
 
 	int  frame_ok;
 
-	if( is_first )
-		nl->wait_frameno = frameno,
+	if( is_first ) {
+		nl->wait_frameno = frameno;
 		nl->inppos = 0;
+	}
 
 	if( nl->wait_frameno == frameno ) {
 
@@ -717,33 +724,35 @@ upload_data( struct net_device  *dev,  unsigned  framelen,  unsigned  frameno,
 		 * error was occurred... drop entire packet
 		 */
 		else if( (frame_ok = skip_tail( dev->base_addr, framelen, crc ))
-			 != 0 )
-			nl->wait_frameno = 0,
-			nl->inppos = 0,
+			 != 0 ) {
+			nl->wait_frameno = 0;
+			nl->inppos = 0;
 #ifdef CONFIG_SBNI_MULTILINE
-			nl->master->stats.rx_errors++,
+			nl->master->stats.rx_errors++;
 			nl->master->stats.rx_missed_errors++;
 #else
-		        dev->stats.rx_errors++,
+		        dev->stats.rx_errors++;
 			dev->stats.rx_missed_errors++;
 #endif
+		}
 			/* now skip all frames until is_first != 0 */
 	} else
 		frame_ok = skip_tail( dev->base_addr, framelen, crc );
 
-	if( is_first  &&  !frame_ok )
+	if( is_first  &&  !frame_ok ) {
 		/*
 		 * Frame has been broken, but we had already stored
 		 * is_first... Drop entire packet.
 		 */
-		nl->wait_frameno = 0,
+		nl->wait_frameno = 0;
 #ifdef CONFIG_SBNI_MULTILINE
-		nl->master->stats.rx_errors++,
+		nl->master->stats.rx_errors++;
 		nl->master->stats.rx_crc_errors++;
 #else
-		dev->stats.rx_errors++,
+		dev->stats.rx_errors++;
 		dev->stats.rx_crc_errors++;
 #endif
+	}
 
 	return  frame_ok;
 }
@@ -782,17 +791,18 @@ interpret_ack( struct net_device  *dev,  unsigned  ack )
 		if( nl->state & FL_WAIT_ACK ) {
 			nl->outpos += nl->framelen;
 
-			if( --nl->tx_frameno )
+			if( --nl->tx_frameno ) {
 				nl->framelen = min_t(unsigned int,
 						   nl->maxframe,
 						   nl->tx_buf_p->len - nl->outpos);
-			else
-				send_complete( dev ),
+			} else {
+				send_complete( dev );
 #ifdef CONFIG_SBNI_MULTILINE
 				netif_wake_queue( nl->master );
 #else
 				netif_wake_queue( dev );
 #endif
+			}
 		}
 	}
 
@@ -872,16 +882,17 @@ drop_xmit_queue( struct net_device  *dev )
 {
 	struct net_local  *nl = netdev_priv(dev);
 
-	if( nl->tx_buf_p )
-		dev_kfree_skb_any( nl->tx_buf_p ),
-		nl->tx_buf_p = NULL,
+	if( nl->tx_buf_p ) {
+		dev_kfree_skb_any( nl->tx_buf_p );
+		nl->tx_buf_p = NULL;
 #ifdef CONFIG_SBNI_MULTILINE
-		nl->master->stats.tx_errors++,
+		nl->master->stats.tx_errors++;
 		nl->master->stats.tx_carrier_errors++;
 #else
-		dev->stats.tx_errors++,
+		dev->stats.tx_errors++;
 		dev->stats.tx_carrier_errors++;
 #endif
+	}
 
 	nl->tx_frameno	= 0;
 	nl->framelen	= 0;
@@ -1327,12 +1338,13 @@ sbni_ioctl( struct net_device  *dev,  struct ifreq  *ifr,  int  cmd )
 
 		spin_lock( &nl->lock );
 		flags = *(struct sbni_flags*) &ifr->ifr_ifru;
-		if( flags.fixed_rxl )
-			nl->delta_rxl = 0,
+		if( flags.fixed_rxl ) {
+			nl->delta_rxl = 0;
 			nl->cur_rxl_index = flags.rxl;
-		else
-			nl->delta_rxl = DEF_RXL_DELTA,
+		} else {
+			nl->delta_rxl = DEF_RXL_DELTA;
 			nl->cur_rxl_index = DEF_RXL;
+		}
 
 		nl->csr1.rxl = rxl_tab[ nl->cur_rxl_index ];
 		nl->csr1.rate = flags.rate;
@@ -1526,13 +1538,16 @@ sbni_setup( char  *p )
 		(*dest[ parm ])[ n ] = simple_strtol( p, &p, 0 );
 		if( !*p  ||  *p == ')' )
 			return 1;
-		if( *p == ';' )
-			++p, ++n, parm = 0;
-		else if( *p++ != ',' )
+		if( *p == ';' ) {
+			++p;
+			++n;
+			parm = 0;
+		} else if( *p++ != ',' ) {
 			break;
-		else
+		} else {
 			if( ++parm >= 5 )
 				break;
+		}
 	}
 bad_param:
 	pr_err("Error in sbni kernel parameter!\n");
-- 
2.26.0


  parent reply	other threads:[~2020-08-25  4:58 UTC|newest]

Thread overview: 80+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-25  4:55 [PATCH 00/29] treewide: Convert comma separated statements Joe Perches
2020-08-25  4:55 ` [PATCH 01/29] coding-style.rst: Avoid comma statements Joe Perches
2021-01-30 18:53   ` Joe Perches
2021-02-04 21:41     ` Jonathan Corbet
2020-08-25  4:55 ` [PATCH 02/29] alpha: Avoid comma separated statements Joe Perches
2020-08-25  6:37   ` Robert Richter
2021-01-30 18:54   ` Joe Perches
2021-02-16 14:39     ` Robert Richter
2021-02-16 15:10       ` Joe Perches
2020-08-25  4:56 ` [PATCH 03/29] ia64: " Joe Perches
2021-01-30 18:55   ` Joe Perches
2020-08-25  4:56 ` [PATCH 04/29] sparc: " Joe Perches
2021-01-30 18:56   ` Joe Perches
2020-08-25  4:56 ` [PATCH 05/29] ata: " Joe Perches
2021-01-30 18:56   ` Joe Perches
2021-01-31 15:06     ` Jens Axboe
2020-08-25  4:56 ` [PATCH 06/29] drbd: " Joe Perches
2021-01-30 18:57   ` Joe Perches
2021-01-31 15:06     ` Jens Axboe
2020-08-25  4:56 ` [PATCH 07/29] lp: " Joe Perches
2020-08-25  4:56 ` [PATCH 08/29] dma-buf: " Joe Perches
2020-08-26 15:08   ` Christian König
2020-09-03 12:21     ` Sumit Semwal
2020-09-04 11:42   ` Kieran Bingham
2020-09-04 21:33     ` Joe Perches
2021-01-30 18:47   ` Joe Perches
2021-02-03 13:26     ` Christian König
2021-01-31 17:39       ` Joe Perches
2021-01-31 17:53         ` Christian König
2021-02-01 21:54       ` Lyude Paul
2021-02-02  8:33         ` [Linaro-mm-sig] " Christian König
2021-02-02 18:24           ` Lyude Paul
2020-08-25  4:56 ` [PATCH 09/29] drm/gma500: " Joe Perches
2021-01-30 18:47   ` Joe Perches
2021-01-30 21:21     ` Patrik Jakobsson
2020-08-25  4:56 ` [PATCH 10/29] drm/i915: " Joe Perches
2021-01-30 18:47   ` Joe Perches
2021-02-01  8:41     ` Jani Nikula
2020-08-25  4:56 ` [PATCH 11/29] hwmon: (scmi-hwmon): " Joe Perches
2020-08-25 23:33   ` Guenter Roeck
2020-08-25  4:56 ` [PATCH 12/29] Input: MT - " Joe Perches
2020-08-25 17:07   ` Dmitry Torokhov
2020-08-25  4:56 ` [PATCH 13/29] bcache: " Joe Perches
2021-01-30 18:59   ` Joe Perches
2021-01-31 15:58     ` Coly Li
2020-08-25  4:56 ` [PATCH 14/29] media: " Joe Perches
2020-09-04 11:45   ` Kieran Bingham
2020-08-25  4:56 ` [PATCH 15/29] mtd: " Joe Perches
2020-09-07  7:34   ` Miquel Raynal
2020-08-25  4:56 ` [PATCH 16/29] 8390: " Joe Perches
2020-08-25 14:54   ` David Miller
2020-08-25  4:56 ` [PATCH 17/29] fs_enet: " Joe Perches
2020-08-25 14:55   ` David Miller
2020-08-25  4:56 ` Joe Perches [this message]
2020-08-25 14:55   ` [PATCH 18/29] wan: sbni: " David Miller
2020-08-25  4:56 ` [PATCH 19/29] s390/tty3270: " Joe Perches
2021-01-30 19:01   ` Joe Perches
2020-08-25  4:56 ` [PATCH 20/29] scai/arm: " Joe Perches
2020-08-25  4:56 ` [PATCH 21/29] media: atomisp: " Joe Perches
2020-09-04 11:46   ` Kieran Bingham
2020-08-25  4:56 ` [PATCH 22/29] video: fbdev: " Joe Perches
2020-09-08 11:37   ` Bartlomiej Zolnierkiewicz
2020-08-25  4:56 ` [PATCH 23/29] fuse: " Joe Perches
2021-01-30 19:04   ` Joe Perches
2021-02-01  8:12   ` Miklos Szeredi
2020-08-25  4:56 ` [PATCH 24/29] reiserfs: " Joe Perches
2021-01-30 19:04   ` Joe Perches
2020-08-25  4:56 ` [PATCH 25/29] lib/zlib: " Joe Perches
2021-01-30 19:05   ` Joe Perches
2020-08-25  4:56 ` [PATCH 26/29] lib: zstd: " Joe Perches
2021-01-30 19:06   ` Joe Perches
2020-08-25  4:56 ` [PATCH 27/29] ipv6: fib6: " Joe Perches
2020-08-25 14:55   ` David Miller
2020-08-25  4:56 ` [PATCH 28/29] sunrpc: " Joe Perches
2020-08-25 14:55   ` David Miller
2020-08-25  4:56 ` [PATCH 29/29] tools: " Joe Perches
2020-08-26  9:30   ` Thomas Renninger
2020-08-26 14:45     ` Joe Perches
2020-08-26 16:13       ` Thomas Renninger
2020-09-09  2:09 ` [PATCH 00/29] treewide: Convert " Martin K. Petersen

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=e79d390c5b492ecbf61fb79d35625f88c57265b6.1598331149.git.joe@perches.com \
    --to=joe@perches.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=trivial@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).