From: Jiri Slaby <jirislaby@gmail.com>
To: Josh Boyer <jdub@us.ibm.com>
Cc: Andrew Morton <akpm@osdl.org>, Mark Ferrell <mferrell@mvista.com>,
linux-mtd@lists.infradead.org, Jiri Slaby <jirislaby@gmail.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/4] pmc551 remove unnecessary braces
Date: Tue, 19 Sep 2006 12:17:08 +0200 [thread overview]
Message-ID: <450FC3A4.9020402@gmail.com> (raw)
In-Reply-To: <1158624979.3600.31.camel@zod.rchland.ibm.com>
Josh Boyer wrote:
> On Tue, 2006-09-19 at 00:47 +0200, Jiri Slaby wrote:
>> diff --git a/drivers/mtd/devices/pmc551.c b/drivers/mtd/devices/pmc551.c
>> index 6d4d5a4..0ee22ca 100644
>> --- a/drivers/mtd/devices/pmc551.c
>> +++ b/drivers/mtd/devices/pmc551.c
>> @@ -137,11 +137,11 @@ #endif
>>
>> pmc551_point(mtd, instr->addr, instr->len, &retlen, &ptr);
>>
>> - if (soff_hi == eoff_hi || mtd->size == priv->asize) {
>> + if (soff_hi == eoff_hi || mtd->size == priv->asize)
>> /* The whole thing fits within one access, so just one shot
>> will do it. */
>> memset(ptr, 0xff, instr->len);
>> - } else {
>> + else {
>> /* We have to do multiple writes to get all the data
>> written. */
>> while (soff_hi != eoff_hi) {
>
> I actually find this change to make the code less readable. Yes, the
> braces aren't technically necessary, but the else requires them, and the
> comment block before the memset makes this multi-line.
>
> This whole patch is highly user preference, but I'd rather these braces
> stay.
Yes, I agree. This was one of my old patches stored on other PC, that I find
now. The patch definitely makes it ugly.
>> @@ -700,9 +695,8 @@ static int __init init_pmc551(void)
>>
>> if ((PCI_Device = pci_find_device(PCI_VENDOR_ID_V3_SEMI,
>> PCI_DEVICE_ID_V3_SEMI_V370PDC,
>> - PCI_Device)) == NULL) {
>> + PCI_Device)) == NULL)
>> break;
>> - }
>
> 1) If you're going for coding style, the assignment within the if
> condition needs to be moved outside of it.
>
> 2) If you're not going to fix 1, then leave the braces.
1) is fine, I will do it, thanks for comments.
--
http://www.fi.muni.cz/~xslaby/ Jiri Slaby
faculty of informatics, masaryk university, brno, cz
e-mail: jirislaby gmail com, gpg pubkey fingerprint:
B674 9967 0407 CE62 ACC8 22A0 32CC 55C3 39D4 7A7E
WARNING: multiple messages have this Message-ID (diff)
From: Jiri Slaby <jirislaby@gmail.com>
To: Josh Boyer <jdub@us.ibm.com>
Cc: Jiri Slaby <jirislaby@gmail.com>, Andrew Morton <akpm@osdl.org>,
linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org,
Mark Ferrell <mferrell@mvista.com>
Subject: Re: [PATCH 2/4] pmc551 remove unnecessary braces
Date: Tue, 19 Sep 2006 12:17:08 +0200 [thread overview]
Message-ID: <450FC3A4.9020402@gmail.com> (raw)
In-Reply-To: <1158624979.3600.31.camel@zod.rchland.ibm.com>
Josh Boyer wrote:
> On Tue, 2006-09-19 at 00:47 +0200, Jiri Slaby wrote:
>> diff --git a/drivers/mtd/devices/pmc551.c b/drivers/mtd/devices/pmc551.c
>> index 6d4d5a4..0ee22ca 100644
>> --- a/drivers/mtd/devices/pmc551.c
>> +++ b/drivers/mtd/devices/pmc551.c
>> @@ -137,11 +137,11 @@ #endif
>>
>> pmc551_point(mtd, instr->addr, instr->len, &retlen, &ptr);
>>
>> - if (soff_hi == eoff_hi || mtd->size == priv->asize) {
>> + if (soff_hi == eoff_hi || mtd->size == priv->asize)
>> /* The whole thing fits within one access, so just one shot
>> will do it. */
>> memset(ptr, 0xff, instr->len);
>> - } else {
>> + else {
>> /* We have to do multiple writes to get all the data
>> written. */
>> while (soff_hi != eoff_hi) {
>
> I actually find this change to make the code less readable. Yes, the
> braces aren't technically necessary, but the else requires them, and the
> comment block before the memset makes this multi-line.
>
> This whole patch is highly user preference, but I'd rather these braces
> stay.
Yes, I agree. This was one of my old patches stored on other PC, that I find
now. The patch definitely makes it ugly.
>> @@ -700,9 +695,8 @@ static int __init init_pmc551(void)
>>
>> if ((PCI_Device = pci_find_device(PCI_VENDOR_ID_V3_SEMI,
>> PCI_DEVICE_ID_V3_SEMI_V370PDC,
>> - PCI_Device)) == NULL) {
>> + PCI_Device)) == NULL)
>> break;
>> - }
>
> 1) If you're going for coding style, the assignment within the if
> condition needs to be moved outside of it.
>
> 2) If you're not going to fix 1, then leave the braces.
1) is fine, I will do it, thanks for comments.
--
http://www.fi.muni.cz/~xslaby/ Jiri Slaby
faculty of informatics, masaryk university, brno, cz
e-mail: jirislaby gmail com, gpg pubkey fingerprint:
B674 9967 0407 CE62 ACC8 22A0 32CC 55C3 39D4 7A7E
next prev parent reply other threads:[~2006-09-19 10:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-09-18 22:47 [PATCH 2/4] pmc551 remove unnecessary braces Jiri Slaby
2006-09-18 22:47 ` Jiri Slaby
2006-09-19 0:16 ` Josh Boyer
2006-09-19 10:17 ` Jiri Slaby [this message]
2006-09-19 10:17 ` Jiri Slaby
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=450FC3A4.9020402@gmail.com \
--to=jirislaby@gmail.com \
--cc=akpm@osdl.org \
--cc=jdub@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=mferrell@mvista.com \
/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.