Skip to contentSkip to conversation

staging: slicoss: Fix multiple checkpatch warnings

PATCH In review Rehas Sachdeva 3 participants 9 messages Sep 15, 2016 – Sep 16, 2016 Staging

lore
Share & tools
lore
#0 lore raw

cover staging: slicoss: Fix multiple checkpatch warnings

Fixes multiple checkpatch.pl warnings in slicoss driver.

Rehas Sachdeva (5):
staging: slicoss: Fix alignment with open parentheses
staging: slicoss: Remove blank lines before & after braces
staging: slicoss: Add {} to an arm of if-else
staging: slicoss: Remove unnecessary braces {}
staging: slicoss: Remove unnecessary blank line

 drivers/staging/slicoss/slicoss.c | 40 ++++++++++++++++++---------------------
 1 file changed, 18 insertions(+), 22 deletions(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/5 staging: slicoss: Fix alignment with open parentheses

Align statements following a line with open parentheses to start after the '('. Issue detected by checkpatch.pl.

---
 drivers/staging/slicoss/slicoss.c | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)
drivers/staging/slicoss/slicoss.c +14 -14
index 21280a3..6bfb7a8 100644
@@ -191,7 +191,7 @@ static void slic_timer_ping(ulong dev)
  *
  */
 static void slic_link_config(struct adapter *adapter,
-		      u32 linkspeed, u32 linkduplex)
+			     u32 linkspeed, u32 linkduplex)
 {
 	u32 speed;
 	u32 duplex;
@@ -707,7 +707,7 @@ static void slic_config_clear(struct adapter *adapter)
 }
 
 static bool slic_mac_filter(struct adapter *adapter,
-			struct ether_header *ether_frame)
+			    struct ether_header *ether_frame)
 {
 	struct net_device *netdev = adapter->netdev;
 	u32 opts = adapter->macopts;
@@ -830,10 +830,10 @@ static void slic_timer_load_check(ulong cardaddr)
 }
 
 static int slic_upr_queue_request(struct adapter *adapter,
-			   u32 upr_request,
-			   u32 upr_data,
-			   u32 upr_data_h,
-			   u32 upr_buffer, u32 upr_buffer_h)
+				  u32 upr_request,
+				  u32 upr_data,
+				  u32 upr_data_h,
+				  u32 upr_buffer, u32 upr_buffer_h)
 {
 	struct slic_upr *upr;
 	struct slic_upr *uprqueue;
@@ -899,19 +899,19 @@ static void slic_upr_start(struct adapter *adapter)
 }
 
 static int slic_upr_request(struct adapter *adapter,
-		     u32 upr_request,
-		     u32 upr_data,
-		     u32 upr_data_h,
-		     u32 upr_buffer, u32 upr_buffer_h)
+			    u32 upr_request,
+			    u32 upr_data,
+			    u32 upr_data_h,
+			    u32 upr_buffer, u32 upr_buffer_h)
 {
 	unsigned long flags;
 	int rc;
 
 	spin_lock_irqsave(&adapter->upr_lock, flags);
 	rc = slic_upr_queue_request(adapter,
-					upr_request,
-					upr_data,
-					upr_data_h, upr_buffer, upr_buffer_h);
+				    upr_request,
+				    upr_data,
+				    upr_data_h, upr_buffer, upr_buffer_h);
 	if (rc)
 		goto err_unlock_irq;
 
@@ -1421,7 +1421,7 @@ retry:
 }
 
 static void slic_cmdq_putdone_irq(struct adapter *adapter,
-				struct slic_hostcmd *cmd)
+				  struct slic_hostcmd *cmd)
 {
 	struct slic_cmdqueue *cmdq = &adapter->cmdq_done;
 
Signature · 1 line
2.7.4
#4 lore raw

PATCH 2/5 staging: slicoss: Remove blank lines before & after braces

In reply to Rehas Sachdeva

Removes unnecessary blank lines after an opening brace '{' and before a closing brace '}'. Issue detected by checkpatch.pl.

---
 drivers/staging/slicoss/slicoss.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/staging/slicoss/slicoss.c +0 -3
index 6bfb7a8..f2c751c 100644
@@ -514,7 +514,6 @@ static int slic_card_download(struct adapter *adapter)
 			slic_write32(adapter, SLIC_REG_WCS, instruction);
 			instruction = *(u32 *)(fw->data + index);
 			index += 4;
-
 		}
 	}
 	release_firmware(fw);
@@ -2718,7 +2717,6 @@ static int slic_card_init(struct sliccard *card, struct adapter *adapter)
 		/*  see if the EEPROM is valid by checking it's checksum */
 		if ((eecodesize <= MAX_EECODE_SIZE) &&
 		    (eecodesize >= MIN_EECODE_SIZE)) {
-
 			ee_chksum =
 			    *(u16 *)((char *)peeprom + (eecodesize - 2));
 			/*
@@ -2856,7 +2854,6 @@ static int slic_init_adapter(struct net_device *netdev,
 	 */
 	for (index = 1, pslic_handle = &adapter->slic_handles[1];
 	     index < SLIC_CMDQ_MAXCMDS; index++, pslic_handle++) {
-
 		pslic_handle->token.handle_index = index;
 		pslic_handle->type = SLIC_HANDLE_FREE;
 		pslic_handle->next = adapter->pfree_slic_handles;
Signature · 1 line
2.7.4
#5 lore raw

PATCH 3/5 staging: slicoss: Add {} to an arm of if-else

In reply to Rehas Sachdeva

Adds braces {} to the if arm of an if-else statement which has braces {} on its else arm. This improves uniformity and readability. Issue detected by checkpatch.

---
 drivers/staging/slicoss/slicoss.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/slicoss/slicoss.c +2 -1
index f2c751c..8182e58 100644
@@ -784,8 +784,9 @@ static void slic_timer_load_check(ulong cardaddr)
 	if ((adapter) && (adapter->state == ADAPT_UP) &&
 	    (card->state == CARD_UP) && (slic_global.dynamic_intagg)) {
 		if (adapter->devid == SLIC_1GB_DEVICE_ID) {
-			if (adapter->linkspeed == LINK_1000MB)
+			if (adapter->linkspeed == LINK_1000MB) {
 				level = 100;
+			}
 			else {
 				if (load > SLIC_LOAD_5)
 					level = SLIC_INTAGG_5;
Signature · 1 line
2.7.4
#7 lore raw

PATCH 4/5 staging: slicoss: Remove unnecessary braces {}

In reply to Rehas Sachdeva

Removes unnecessary braces {} on both arms of an if-else block as they have a single statement each. Issue detected by checkpatch.

---
 drivers/staging/slicoss/slicoss.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/staging/slicoss/slicoss.c +2 -3
index 8182e58..6b1c92e 100644
@@ -1631,11 +1631,10 @@ static u32 slic_rcvqueue_reinsert(struct adapter *adapter, struct sk_buff *skb)
 		dev_err(dev, "         rcvq->tail[%p]\n", rcvq->tail);
 		dev_err(dev, "         rcvq->count[%x]\n", rcvq->count);
 	}
-	if (paddrh == 0) {
+	if (paddrh == 0)
 		slic_write32(adapter, SLIC_REG_HBAR, (u32)paddrl);
-	} else {
+	else
 		slic_write64(adapter, SLIC_REG_HBAR64, paddrl, paddrh);
-	}
 	if (rcvq->head)
 		rcvq->tail->next = skb;
 	else
Signature · 1 line
2.7.4
#8 lore raw

PATCH 5/5 staging: slicoss: Remove unnecessary blank line

In reply to Rehas Sachdeva

Removes unnecessary blank line detected by checkpatch.

---
 drivers/staging/slicoss/slicoss.c | 1 -
 1 file changed, 1 deletion(-)
drivers/staging/slicoss/slicoss.c +0 -1
index 6b1c92e..8be8f7c 100644
@@ -1660,7 +1660,6 @@ static int slic_link_event_handler(struct adapter *adapter)
 	struct slic_shmemory *sm = &adapter->shmem;
 	dma_addr_t phaddr = sm->lnkstatus_phaddr;
 
-
 	if (adapter->state != ADAPT_UP) {
 		/* Adapter is not operational.  Ignore.  */
 		return -ENODEV;
Signature · 1 line
2.7.4
#2 lore raw

Re: [Outreachy kernel] [PATCH 1/5] staging: slicoss: Fix alignment with open parentheses

In reply to Rehas Sachdeva
Quoted 32 lines · Rehas Sachdeva

Align statements following a line with open parentheses to start after the '('. Issue detected by checkpatch.pl.

---
 drivers/staging/slicoss/slicoss.c | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)
drivers/staging/slicoss/slicoss.c +2 -2
index 21280a3..6bfb7a8 100644
@@ -191,7 +191,7 @@ static void slic_timer_ping(ulong dev)
  *
  */
 static void slic_link_config(struct adapter *adapter,
-		      u32 linkspeed, u32 linkduplex)
+			     u32 linkspeed, u32 linkduplex)
 {
 	u32 speed;
 	u32 duplex;
@@ -707,7 +707,7 @@ static void slic_config_clear(struct adapter *adapter)
 }
 
 static bool slic_mac_filter(struct adapter *adapter,
-			struct ether_header *ether_frame)
+			    struct ether_header *ether_frame)
 {
 	struct net_device *netdev = adapter->netdev;
 	u32 opts = adapter->macopts;
@@ -830,10 +830,10 @@ static void slic_timer_load_check(ulong cardaddr)
 }

drivers/staging/slicoss/slicoss.c static void slic_timer_load_check(ulong cardaddr) · line 836

Quoted 10 lines
drivers/staging/slicoss/slicoss.c +4 -4
 
 static int slic_upr_queue_request(struct adapter *adapter,
-			   u32 upr_request,
-			   u32 upr_data,
-			   u32 upr_data_h,
-			   u32 upr_buffer, u32 upr_buffer_h)
+				  u32 upr_request,
+				  u32 upr_data,
+				  u32 upr_data_h,
+				  u32 upr_buffer, u32 upr_buffer_h)

Maybe you could put a few more arguments on the same line. For example, since upr_buffer and upr_buffer_h are already on the same line, maybe you could do the same with upr_data and upr_data_h.

Quoted 5 lines
drivers/staging/slicoss/slicoss.c +0 -0
 {
 	struct slic_upr *upr;
 	struct slic_upr *uprqueue;
@@ -899,19 +899,19 @@ static void slic_upr_start(struct adapter *adapter)
 }

drivers/staging/slicoss/slicoss.c static void slic_upr_start(struct adapter *adapter) · line 905

Quoted 10 lines
drivers/staging/slicoss/slicoss.c +4 -4
 
 static int slic_upr_request(struct adapter *adapter,
-		     u32 upr_request,
-		     u32 upr_data,
-		     u32 upr_data_h,
-		     u32 upr_buffer, u32 upr_buffer_h)
+			    u32 upr_request,
+			    u32 upr_data,
+			    u32 upr_data_h,
+			    u32 upr_buffer, u32 upr_buffer_h)

Likewise here.

julia

Quoted 34 lines
drivers/staging/slicoss/slicoss.c +4 -5
 {
 	unsigned long flags;
 	int rc;
 
 	spin_lock_irqsave(&adapter->upr_lock, flags);
 	rc = slic_upr_queue_request(adapter,
-					upr_request,
-					upr_data,
-					upr_data_h, upr_buffer, upr_buffer_h);
+				    upr_request,
+				    upr_data,
+				    upr_data_h, upr_buffer, upr_buffer_h);
 	if (rc)
 		goto err_unlock_irq;
 
@@ -1421,7 +1421,7 @@ retry:
 }
 
 static void slic_cmdq_putdone_irq(struct adapter *adapter,
-				struct slic_hostcmd *cmd)
+				  struct slic_hostcmd *cmd)
 {
 	struct slic_cmdqueue *cmdq = &adapter->cmdq_done;
 
--

2.7.4

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/a0e1623587ce0b842607142663aa65d7871245cc.1473966683.git.aquannie%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

#3 lore raw

Re: [Outreachy kernel] [PATCH 1/5] staging: slicoss: Fix alignment with open parentheses

Quoted 37 lines · Julia Lawall
Quoted 33 lines · Rehas Sachdeva

Align statements following a line with open parentheses to start after the '('. Issue detected by checkpatch.pl.

---
 drivers/staging/slicoss/slicoss.c | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)
drivers/staging/slicoss/slicoss.c +2 -2
index 21280a3..6bfb7a8 100644
@@ -191,7 +191,7 @@ static void slic_timer_ping(ulong dev)
  *
  */
 static void slic_link_config(struct adapter *adapter,
-		      u32 linkspeed, u32 linkduplex)
+			     u32 linkspeed, u32 linkduplex)
 {
 	u32 speed;
 	u32 duplex;
@@ -707,7 +707,7 @@ static void slic_config_clear(struct adapter *adapter)
 }
 
 static bool slic_mac_filter(struct adapter *adapter,
-			struct ether_header *ether_frame)
+			    struct ether_header *ether_frame)
 {
 	struct net_device *netdev = adapter->netdev;
 	u32 opts = adapter->macopts;
@@ -830,10 +830,10 @@ static void slic_timer_load_check(ulong cardaddr)
 }
 
Quoted 14 lines

drivers/staging/slicoss/slicoss.c static void slic_timer_load_check(ulong cardaddr) · line 836

Quoted 9 lines
drivers/staging/slicoss/slicoss.c +4 -4
 static int slic_upr_queue_request(struct adapter *adapter,
-			   u32 upr_request,
-			   u32 upr_data,
-			   u32 upr_data_h,
-			   u32 upr_buffer, u32 upr_buffer_h)
+				  u32 upr_request,
+				  u32 upr_data,
+				  u32 upr_data_h,
+				  u32 upr_buffer, u32 upr_buffer_h)

Maybe you could put a few more arguments on the same line. For example, since upr_buffer and upr_buffer_h are already on the same line, maybe you could do the same with upr_data and upr_data_h.

I see. I'll make the changes right away. Thanks for pointing out.

Rehas

Quoted 55 lines
Quoted 5 lines
drivers/staging/slicoss/slicoss.c +0 -0
 {
 	struct slic_upr *upr;
 	struct slic_upr *uprqueue;
@@ -899,19 +899,19 @@ static void slic_upr_start(struct adapter *adapter)
 }

drivers/staging/slicoss/slicoss.c static void slic_upr_start(struct adapter *adapter) · line 905

Quoted 10 lines
drivers/staging/slicoss/slicoss.c +4 -4
 
 static int slic_upr_request(struct adapter *adapter,
-		     u32 upr_request,
-		     u32 upr_data,
-		     u32 upr_data_h,
-		     u32 upr_buffer, u32 upr_buffer_h)
+			    u32 upr_request,
+			    u32 upr_data,
+			    u32 upr_data_h,
+			    u32 upr_buffer, u32 upr_buffer_h)

Likewise here.

julia

Quoted 34 lines
drivers/staging/slicoss/slicoss.c +4 -5
 {
 	unsigned long flags;
 	int rc;
 
 	spin_lock_irqsave(&adapter->upr_lock, flags);
 	rc = slic_upr_queue_request(adapter,
-					upr_request,
-					upr_data,
-					upr_data_h, upr_buffer, upr_buffer_h);
+				    upr_request,
+				    upr_data,
+				    upr_data_h, upr_buffer, upr_buffer_h);
 	if (rc)
 		goto err_unlock_irq;
 
@@ -1421,7 +1421,7 @@ retry:
 }
 
 static void slic_cmdq_putdone_irq(struct adapter *adapter,
-				struct slic_hostcmd *cmd)
+				  struct slic_hostcmd *cmd)
 {
 	struct slic_cmdqueue *cmdq = &adapter->cmdq_done;
 
--

2.7.4

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/a0e1623587ce0b842607142663aa65d7871245cc.1473966683.git.aquannie%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

#6 lore raw

Re: [Outreachy kernel] [PATCH 3/5] staging: slicoss: Add {} to an arm of if-else

In reply to Rehas Sachdeva
Quoted 14 lines · Rehas Sachdeva

Adds braces {} to the if arm of an if-else statement which has braces {} on its else arm. This improves uniformity and readability. Issue detected by checkpatch.

---
 drivers/staging/slicoss/slicoss.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/slicoss/slicoss.c +0 -0
index f2c751c..8182e58 100644

drivers/staging/slicoss/slicoss.c static void slic_timer_load_check(ulong cardaddr) · line 790

Quoted 8 lines
drivers/staging/slicoss/slicoss.c +2 -1
@@ -784,8 +784,9 @@ static void slic_timer_load_check(ulong cardaddr)
 	if ((adapter) && (adapter->state == ADAPT_UP) &&
 	    (card->state == CARD_UP) && (slic_global.dynamic_intagg)) {
 		if (adapter->devid == SLIC_1GB_DEVICE_ID) {
-			if (adapter->linkspeed == LINK_1000MB)
+			if (adapter->linkspeed == LINK_1000MB) {
 				level = 100;
+			}
 			else {

This line should be:

			} else {

thanks,

greg k-h