public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Jingoo Han <jg1.han@samsung.com>
To: 'Bean Huo' <beanhuo@outlook.com>,
	dwmw2@infradead.org, computersforpeace@gmail.com
Cc: b32955@freescale.com, artem.bityutskiy@linux.intel.com,
	'Jingoo Han' <jg1.han@samsung.com>,
	linux-kernel@vger.kernel.org, paul.gortmaker@windriver.com,
	linux-mtd@lists.infradead.org, christian.riesch@omicron.at
Subject: Re: [PATCH v5] mtd:nor:timeout:fix do_write_buffer() timeout error
Date: Wed, 16 Jul 2014 19:22:27 +0900	[thread overview]
Message-ID: <003f01cfa0df$d79d5fc0$86d81f40$%han@samsung.com> (raw)
In-Reply-To: <BLU185-W44C89261B8307EBFCC2EC0A6F70@phx.gbl>

On Wednesday, July 16, 2014 5:49 PM, Bean Huo wrote:
> 
> >> + if (cfi->cfiq->BufWriteTimeoutTyp &&
> >> + cfi->cfiq->BufWriteTimeoutMax){
> >> + cfi->chips[i].buffer_write_time_max =
> >> + 1<<(cfi->cfiq->BufWriteTimeoutTyp +
> >> + cfi->cfiq->BufWriteTimeoutMax);
> >> + } else {
> >> + cfi->chips[i].buffer_write_time_max = 0;
> >> + }
> >
> > Please keep the coding style as below.
> >
> > if ( ) {
> > ...
> > } else {
> > ...
> > }
> >
> 
> If I keep coding style as above.this will be beyond the requirements of one line length.
> I also saw othter files use the same code style as mine.please see:cfi_cmdset_0001.c
> 
> if (cfi->cfiq->WordWriteTimeoutTyp &&
>      cfi->cfiq->WordWriteTimeoutMax)
>         cfi->chips[i].word_write_time_max =
> 		1<<(cfi->cfiq->WordWriteTimeoutTyp +
> 		      cfi->cfiq->WordWriteTimeoutMax);
> else
>       cfi->chips[i].word_write_time_max = 50000 * 8;

I don't want to mention about braces.
However, I said that you should keep the indentation.

Your original patch

+		if (cfi->cfiq->BufWriteTimeoutTyp &&
+			cfi->cfiq->BufWriteTimeoutMax){
+			cfi->chips[i].buffer_write_time_max =
+				1<<(cfi->cfiq->BufWriteTimeoutTyp +
+					cfi->cfiq->BufWriteTimeoutMax);
+			} else {
+				cfi->chips[i].buffer_write_time_max = 0;
+				}
+		cfi->chips[i].buffer_write_time_max =
+			((cfi->chips[i].buffer_write_time_max>= 2000)
+			 ? cfi->chips[i].buffer_write_time_max : 2000);

My suggestion is as follows: 

+		if (cfi->cfiq->BufWriteTimeoutTyp &&
+			cfi->cfiq->BufWriteTimeoutMax){
+			cfi->chips[i].buffer_write_time_max =
+				1<<(cfi->cfiq->BufWriteTimeoutTyp +
+					cfi->cfiq->BufWriteTimeoutMax);
+		} else {
+			cfi->chips[i].buffer_write_time_max = 0;
+		}
+		cfi->chips[i].buffer_write_time_max =
+			((cfi->chips[i].buffer_write_time_max>= 2000)
+			 ? cfi->chips[i].buffer_write_time_max : 2000);

Braces? I have no idea. Actually, I prefer to use braces for the
readability. However, according to the Document/CodingStyle, 
these braces are unnecessary.

However, one thing is clear; 'if' and 'else' should use the same
indentation level as below.

1. 
	if(){
		...
	} else {
		...
	}

2.
		if(){
			...
		} else {
			...
		}

3.

			if(){
				...
			} else {
				...
			}

Best regards,
Jingoo Han

> 
> Note: beacuse I cann't send mail by git in office,I send this patch by web mail client.So,
> there still a error stype in this patch(web mail client will remove some spaces),that is one space
> required before that '>='.I will send again this patch at home.
> For your coding style advice, I will take into account,but i don't know if can put one line.
> 	 	   		  =

  reply	other threads:[~2014-07-16 10:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-16  7:09 [PATCH v4] mtd:nor:timeout:fix do_write_buffer() timeout error Bean Huo
2014-07-16  7:19 ` [PATCH v5] " Bean Huo
2014-07-16  7:51   ` Jingoo Han
2014-07-16  8:48     ` Bean Huo
2014-07-16 10:22       ` Jingoo Han [this message]
2014-07-16 16:10         ` Bean Huo

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='003f01cfa0df$d79d5fc0$86d81f40$%han@samsung.com' \
    --to=jg1.han@samsung.com \
    --cc=artem.bityutskiy@linux.intel.com \
    --cc=b32955@freescale.com \
    --cc=beanhuo@outlook.com \
    --cc=christian.riesch@omicron.at \
    --cc=computersforpeace@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=paul.gortmaker@windriver.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox