* [PATCH] net/pasemi: Fix missing coding style
@ 2013-02-24 23:01 Syam Sidhardhan
2013-02-24 23:23 ` Joe Perches
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: Syam Sidhardhan @ 2013-02-24 23:01 UTC (permalink / raw)
To: netdev; +Cc: syamsidhardh, olof
Fix missing () & { }
Signed-off-by: Syam Sidhardhan <s.syam@samsung.com>
---
drivers/net/ethernet/pasemi/pasemi_mac.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/pasemi/pasemi_mac.c b/drivers/net/ethernet/pasemi/pasemi_mac.c
index 0be5844..b1cfbb7 100644
--- a/drivers/net/ethernet/pasemi/pasemi_mac.c
+++ b/drivers/net/ethernet/pasemi/pasemi_mac.c
@@ -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;
--
1.7.9.5
^ permalink raw reply related [flat|nested] 10+ messages in thread* Re: [PATCH] net/pasemi: Fix missing coding style
2013-02-24 23:01 [PATCH] net/pasemi: Fix missing coding style Syam Sidhardhan
@ 2013-02-24 23:23 ` Joe Perches
2013-02-24 23:29 ` Joe Perches
2013-02-25 0:51 ` Olof Johansson
2013-02-25 1:13 ` David Miller
2 siblings, 1 reply; 10+ messages in thread
From: Joe Perches @ 2013-02-24 23:23 UTC (permalink / raw)
To: Syam Sidhardhan; +Cc: netdev, olof
On Mon, 2013-02-25 at 04:31 +0530, Syam Sidhardhan wrote:
> Fix missing () & { }
[]
> diff --git a/drivers/net/ethernet/pasemi/pasemi_mac.c b/drivers/net/ethernet/pasemi/pasemi_mac.c
[]
> @@ -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.
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH] net/pasemi: Fix missing coding style
2013-02-24 23:23 ` Joe Perches
@ 2013-02-24 23:29 ` Joe Perches
2013-02-25 0:53 ` Olof Johansson
0 siblings, 1 reply; 10+ messages in thread
From: Joe Perches @ 2013-02-24 23:29 UTC (permalink / raw)
To: Syam Sidhardhan; +Cc: netdev
On Sun, 2013-02-24 at 15:23 -0800, Joe Perches wrote:
> On Mon, 2013-02-25 at 04:31 +0530, Syam Sidhardhan wrote:
> > Fix missing () & { }
> []
> > diff --git a/drivers/net/ethernet/pasemi/pasemi_mac.c b/drivers/net/ethernet/pasemi/pasemi_mac.c
> []
> > @@ -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.
Nevermind. Not true.
netif_msg_probe is already surrounded by parens.
It's just stylistic ugly.
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH] net/pasemi: Fix missing coding style
2013-02-24 23:29 ` Joe Perches
@ 2013-02-25 0:53 ` Olof Johansson
0 siblings, 0 replies; 10+ messages in thread
From: Olof Johansson @ 2013-02-25 0:53 UTC (permalink / raw)
To: Joe Perches; +Cc: Syam Sidhardhan, netdev
On Sun, Feb 24, 2013 at 3:29 PM, Joe Perches <joe@perches.com> wrote:
> On Sun, 2013-02-24 at 15:23 -0800, Joe Perches wrote:
>> On Mon, 2013-02-25 at 04:31 +0530, Syam Sidhardhan wrote:
>> > Fix missing () & { }
>> []
>> > diff --git a/drivers/net/ethernet/pasemi/pasemi_mac.c b/drivers/net/ethernet/pasemi/pasemi_mac.c
>> []
>> > @@ -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.
This driver is still used by several people running upstream kernels,
including myself. Removal is out of the question.
> 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
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] net/pasemi: Fix missing coding style
2013-02-24 23:01 [PATCH] net/pasemi: Fix missing coding style Syam Sidhardhan
2013-02-24 23:23 ` Joe Perches
@ 2013-02-25 0:51 ` Olof Johansson
2013-02-25 1:13 ` David Miller
2 siblings, 0 replies; 10+ messages in thread
From: Olof Johansson @ 2013-02-25 0:51 UTC (permalink / raw)
To: Syam Sidhardhan; +Cc: netdev
On Sun, Feb 24, 2013 at 3:01 PM, Syam Sidhardhan <syamsidhardh@gmail.com> wrote:
> Fix missing () & { }
>
> Signed-off-by: Syam Sidhardhan <s.syam@samsung.com>
Acked-by: Olof Johansson <olof@lixom.net>
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH] net/pasemi: Fix missing coding style
2013-02-24 23:01 [PATCH] net/pasemi: Fix missing coding style Syam Sidhardhan
2013-02-24 23:23 ` Joe Perches
2013-02-25 0:51 ` Olof Johansson
@ 2013-02-25 1:13 ` David Miller
2013-02-25 1:23 ` Joe Perches
2 siblings, 1 reply; 10+ messages in thread
From: David Miller @ 2013-02-25 1:13 UTC (permalink / raw)
To: syamsidhardh; +Cc: netdev, olof
From: Syam Sidhardhan <syamsidhardh@gmail.com>
Date: Mon, 25 Feb 2013 04:31:19 +0530
> - } else
> + } else {
> freed = 2;
> + }
Single line statements do not need braces.
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH] net/pasemi: Fix missing coding style
2013-02-25 1:13 ` David Miller
@ 2013-02-25 1:23 ` Joe Perches
2013-02-25 1:52 ` David Miller
0 siblings, 1 reply; 10+ messages in thread
From: Joe Perches @ 2013-02-25 1:23 UTC (permalink / raw)
To: David Miller; +Cc: syamsidhardh, netdev, olof
On Sun, 2013-02-24 at 20:13 -0500, David Miller wrote:
> From: Syam Sidhardhan <syamsidhardh@gmail.com>
> Date: Mon, 25 Feb 2013 04:31:19 +0530
>
> > - } 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:
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH] net/pasemi: Fix missing coding style
2013-02-25 1:23 ` Joe Perches
@ 2013-02-25 1:52 ` David Miller
2013-02-25 2:11 ` Joe Perches
0 siblings, 1 reply; 10+ messages in thread
From: David Miller @ 2013-02-25 1:52 UTC (permalink / raw)
To: joe; +Cc: syamsidhardh, netdev, olof
From: Joe Perches <joe@perches.com>
Date: Sun, 24 Feb 2013 17:23:29 -0800
> On Sun, 2013-02-24 at 20:13 -0500, David Miller wrote:
>> From: Syam Sidhardhan <syamsidhardh@gmail.com>
>> Date: Mon, 25 Feb 2013 04:31:19 +0530
>>
>> > - } 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:
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?
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH] net/pasemi: Fix missing coding style
2013-02-25 1:52 ` David Miller
@ 2013-02-25 2:11 ` Joe Perches
2013-02-25 2:22 ` David Miller
0 siblings, 1 reply; 10+ messages in thread
From: Joe Perches @ 2013-02-25 2:11 UTC (permalink / raw)
To: David Miller; +Cc: syamsidhardh, netdev, olof
On Sun, 2013-02-24 at 20:52 -0500, David Miller wrote:
> From: Joe Perches <joe@perches.com>
> Date: Sun, 24 Feb 2013 17:23:29 -0800
>
> > On Sun, 2013-02-24 at 20:13 -0500, David Miller wrote:
> >> From: Syam Sidhardhan <syamsidhardh@gmail.com>
> >> Date: Mon, 25 Feb 2013 04:31:19 +0530
> >>
> >> > - } 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:
>
> 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.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2013-02-25 2:22 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-24 23:01 [PATCH] net/pasemi: Fix missing coding style Syam Sidhardhan
2013-02-24 23:23 ` Joe Perches
2013-02-24 23:29 ` Joe Perches
2013-02-25 0:53 ` Olof Johansson
2013-02-25 0:51 ` Olof Johansson
2013-02-25 1:13 ` David Miller
2013-02-25 1:23 ` Joe Perches
2013-02-25 1:52 ` David Miller
2013-02-25 2:11 ` Joe Perches
2013-02-25 2:22 ` David Miller
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).