Skip to contentSkip to conversation

net/pasemi: Fix missing coding style

PATCH In review Syam Sidhardhan 4 participants 10 messages Feb 24, 2013 – Feb 25, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/pasemi: Fix missing coding style

Fix missing () & { }

---
 drivers/net/ethernet/pasemi/pasemi_mac.c |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/net/ethernet/pasemi/pasemi_mac.c +6 -3
index 0be5844..b1cfbb7 100644
@@ -579,8 +579,9 @@ static void pasemi_mac_free_tx_resources(struct pasemi_mac *mac)
 						(TX_RING_SIZE-1)].dma;
 			freed = pasemi_mac_unmap_tx_skb(mac, nfrags,
 							info->skb, dmas);
-		} else
+		} else {
 			freed = 2;
+		}
 	}
 
 	kfree(txring->ring_info);
@@ -808,8 +809,9 @@ static int pasemi_mac_clean_rx(struct pasemi_mac_rxring *rx,
 			skb->ip_summed = CHECKSUM_UNNECESSARY;
 			skb->csum = (macrx & XCT_MACRX_CSUM_M) >>
 					   XCT_MACRX_CSUM_S;
-		} else
+		} else {
 			skb_checksum_none_assert(skb);
+		}
 
 		packets++;
 		tot_bytes += len;
@@ -1829,10 +1831,11 @@ pasemi_mac_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 		dev_err(&mac->pdev->dev, "register_netdev failed with error %d\n",
 			err);
 		goto out;
-	} else if netif_msg_probe(mac)
+	} else if (netif_msg_probe(mac)) {
 		printk(KERN_INFO "%s: PA Semi %s: intf %d, hw addr %pM\n",
 		       dev->name, mac->type == MAC_TYPE_GMAC ? "GMAC" : "XAUI",
 		       mac->dma_if, dev->dev_addr);
+	}
 
 	return err;
 
Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 1 line · Syam Sidhardhan

Fix missing () & { }

[]

drivers/net/ethernet/pasemi/pasemi_mac.c

Quoted 1 line
drivers/net/ethernet/pasemi/pasemi_mac.c +0 -0

[]

drivers/net/ethernet/pasemi/pasemi_mac.c pasemi_mac_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · line 1841

Quoted 13 lines
drivers/net/ethernet/pasemi/pasemi_mac.c +2 -1
@@ -1829,10 +1831,11 @@ pasemi_mac_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 		dev_err(&mac->pdev->dev, "register_netdev failed with error %d\n",
 			err);
 		goto out;
-	} else if netif_msg_probe(mac)
+	} else if (netif_msg_probe(mac)) {
 		printk(KERN_INFO "%s: PA Semi %s: intf %d, hw addr %pM\n",
 		       dev->name, mac->type == MAC_TYPE_GMAC ? "GMAC" : "XAUI",
 		       mac->dma_if, dev->dev_addr);
+	}
 
 	return err;
 

Uncompilable since 2007!

That argues more for removal than anything else.

#2 lore raw
Quoted 16 lines · Joe Perches
Quoted 1 line · Syam Sidhardhan

Fix missing () & { }

[]

drivers/net/ethernet/pasemi/pasemi_mac.c

Quoted 1 line
drivers/net/ethernet/pasemi/pasemi_mac.c +0 -0

[]

Quoted 11 lines
drivers/net/ethernet/pasemi/pasemi_mac.c +2 -1
@@ -1829,10 +1831,11 @@ pasemi_mac_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 		dev_err(&mac->pdev->dev, "register_netdev failed with error %d\n",
 			err);
 		goto out;
-	} else if netif_msg_probe(mac)
+	} else if (netif_msg_probe(mac)) {
 		printk(KERN_INFO "%s: PA Semi %s: intf %d, hw addr %pM\n",
 		       dev->name, mac->type == MAC_TYPE_GMAC ? "GMAC" : "XAUI",
 		       mac->dma_if, dev->dev_addr);
+	}
 
Quoted 5 lines

drivers/net/ethernet/pasemi/pasemi_mac.c pasemi_mac_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · line 1841

Quoted 2 lines
drivers/net/ethernet/pasemi/pasemi_mac.c +0 -0
 	return err;
 

Uncompilable since 2007!
That argues more for removal than anything else.

Nevermind. Not true.
netif_msg_probe is already surrounded by parens.
It's just stylistic ugly.

#3 lore raw
Quoted 17 lines · Joe Perches
Quoted 16 lines · Joe Perches
Quoted 1 line · Syam Sidhardhan

Fix missing () & { }

[]

drivers/net/ethernet/pasemi/pasemi_mac.c

Quoted 1 line
drivers/net/ethernet/pasemi/pasemi_mac.c +0 -0

[]

Quoted 11 lines
drivers/net/ethernet/pasemi/pasemi_mac.c +2 -1
@@ -1829,10 +1831,11 @@ pasemi_mac_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
            dev_err(&mac->pdev->dev, "register_netdev failed with error %d\n",
                    err);
            goto out;
-   } else if netif_msg_probe(mac)
+   } else if (netif_msg_probe(mac)) {
            printk(KERN_INFO "%s: PA Semi %s: intf %d, hw addr %pM\n",
                   dev->name, mac->type == MAC_TYPE_GMAC ? "GMAC" : "XAUI",
                   mac->dma_if, dev->dev_addr);
+   }
 
Quoted 5 lines
Quoted 5 lines

drivers/net/ethernet/pasemi/pasemi_mac.c pasemi_mac_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · line 1841

Quoted 2 lines
drivers/net/ethernet/pasemi/pasemi_mac.c +0 -0
    return err;
 

Uncompilable since 2007!
That argues more for removal than anything else.

This driver is still used by several people running upstream kernels, including myself. Removal is out of the question.

Quoted 3 lines

Nevermind. Not true.
netif_msg_probe is already surrounded by parens.
It's just stylistic ugly.

Yeah, not sure how that one made it through way back then. Worth fixing so it doesn't bite later if netif_msg_probe() is changed.

-Olof

maintainer
#5 lore raw
In reply to Syam Sidhardhan

From: Syam Sidhardhan <[email protected]>
Date: Mon, 25 Feb 2013 04:31:19 +0530

drivers/net/ethernet/pasemi/pasemi_mac.c static void pasemi_mac_free_tx_resources(struct pasemi_mac *mac) · line 584

Quoted 4 lines
drivers/net/ethernet/pasemi/pasemi_mac.c +2 -1
-		} else
+		} else {
 			freed = 2;
+		}

Single line statements do not need braces.

#6 lore raw
Quoted 9 lines · David Miller

From: Syam Sidhardhan <[email protected]>
Date: Mon, 25 Feb 2013 04:31:19 +0530

drivers/net/ethernet/pasemi/pasemi_mac.c static void pasemi_mac_free_tx_resources(struct pasemi_mac *mac) · line 584

Quoted 4 lines
drivers/net/ethernet/pasemi/pasemi_mac.c +2 -1
-             } else
+             } else {
                      freed = 2;
+             }

Single line statements do not need braces.

I guess you didn't see the preceding block with braces.

CodingStyle:

This does not apply if only one branch of a conditional statement is a single statement; in the latter case use braces in both branches:

maintainer
#7 lore raw

From: Joe Perches <[email protected]>
Date: Sun, 24 Feb 2013 17:23:29 -0800

Quoted 9 lines · David Miller
Quoted 8 lines

From: Syam Sidhardhan <[email protected]>
Date: Mon, 25 Feb 2013 04:31:19 +0530

Quoted 4 lines
drivers/net/ethernet/pasemi/pasemi_mac.c +2 -1
-             } else
+             } else {
                      freed = 2;
+             }
Quoted 8 lines
Quoted 1 line

Single line statements do not need braces.

I guess you didn't see the preceding block with braces.

CodingStyle:

This does not apply if only one branch of a conditional statement is a single statement; in the latter case use braces in both branches:

I did, and I don't think it's necessary in this case regardless of what CodingStyle says, do you really honestly think it increases readability enough to justify those two wasted vertical lines of screen space?

#8 lore raw
Quoted 18 lines · David Miller

From: Joe Perches <[email protected]>
Date: Sun, 24 Feb 2013 17:23:29 -0800

Quoted 15 lines · David Miller
Quoted 9 lines

From: Syam Sidhardhan <[email protected]>
Date: Mon, 25 Feb 2013 04:31:19 +0530

drivers/net/ethernet/pasemi/pasemi_mac.c static void pasemi_mac_free_tx_resources(struct pasemi_mac *mac) · line 584

Quoted 4 lines
drivers/net/ethernet/pasemi/pasemi_mac.c +2 -1
-             } else
+             } else {
                      freed = 2;
+             }

Single line statements do not need braces.

I guess you didn't see the preceding block with braces.

CodingStyle:

Quoted 8 lines
Quoted 2 lines

This does not apply if only one branch of a conditional statement is a single statement; in the latter case use braces in both branches:

I did, and I don't think it's necessary in this case regardless of what CodingStyle says, do you really honestly think it increases readability enough to justify those two wasted vertical lines of screen space?

One additional line not two.

You've mentioned it yourself in the past as something you seem to prefer.

http://markmail.org/message/go7z57ztnl2nivpz#query:+page:1+mid:tgpy4tricd5yqktp+state:results

and I don't much care except for consistency's sake.