All of lore.kernel.org
 help / color / mirror / Atom feed
From: Huang Shijie <b32955@freescale.com>
To: Florian Fainelli <ffainelli@freebox.fr>
Cc: linux-mtd@lists.infradead.org, dwmw2@infradead.org,
	linux-kernel@vger.kernel.org, matthieu.castet@parrot.com,
	dedekind1@gmail.com
Subject: Re: [PATCH v2] mtd: fix the wrong timeo for panic_nand_wait()
Date: Wed, 30 Jan 2013 10:31:53 +0800	[thread overview]
Message-ID: <51088619.5060102@freescale.com> (raw)
In-Reply-To: <201301292200.14622.ffainelli@freebox.fr>

于 2013年01月30日 05:00, Florian Fainelli 写道:
> Hello Huang,
>
> Le mardi 22 janvier 2013 02:30:30, Huang Shijie a écrit :
>> In nand_wait(), the timeo for panic_nand_wait() is assigned with
>> wrong value(jiffies + some delay). The timeo should be set like the
>> panic_nand_write() does.
>>
>> This patch fixes it, and also uses the msecs_to_jiffies() to make the
>> code more readable.
> You are not exactly explaining what is the issue with the current code, and
> how you are fixing it. If someone needs to backport this patch for whatever
> reason, it must be clear as to what it fixes.
ok, i can add more comments.
thanks for your review.

Best Regards
Huang Shijie

>> Signed-off-by: Huang Shijie<b32955@freescale.com>
>> ---
>> fix the compiler error in version 1, and add some commits.
>>
>> ---
>>   drivers/mtd/nand/nand_base.c |    8 ++------
>>   1 files changed, 2 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
>> index 8323ac9..a8c1fb4 100644
>> --- a/drivers/mtd/nand/nand_base.c
>> +++ b/drivers/mtd/nand/nand_base.c
>> @@ -825,13 +825,8 @@ static void panic_nand_wait(struct mtd_info *mtd,
>> struct nand_chip *chip, static int nand_wait(struct mtd_info *mtd, struct
>> nand_chip *chip) {
>>
>> -	unsigned long timeo = jiffies;
>>   	int status, state = chip->state;
>> -
>> -	if (state == FL_ERASING)
>> -		timeo += (HZ * 400) / 1000;
>> -	else
>> -		timeo += (HZ * 20) / 1000;
>> +	unsigned long timeo = (state == FL_ERASING ? 400 : 20);
>>
>>   	led_trigger_event(nand_led_trigger, LED_FULL);
>>
>> @@ -849,6 +844,7 @@ static int nand_wait(struct mtd_info *mtd, struct
>> nand_chip *chip) if (in_interrupt() || oops_in_progress)
>>   		panic_nand_wait(mtd, chip, timeo);
>>   	else {
>> +		timeo = jiffies + msecs_to_jiffies(timeo);
>>   		while (time_before(jiffies, timeo)) {
>>   			if (chip->dev_ready) {
>>   				if (chip->dev_ready(mtd))

WARNING: multiple messages have this Message-ID (diff)
From: Huang Shijie <b32955@freescale.com>
To: Florian Fainelli <ffainelli@freebox.fr>
Cc: <dwmw2@infradead.org>, <dedekind1@gmail.com>,
	<matthieu.castet@parrot.com>, <linux-mtd@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] mtd: fix the wrong timeo for panic_nand_wait()
Date: Wed, 30 Jan 2013 10:31:53 +0800	[thread overview]
Message-ID: <51088619.5060102@freescale.com> (raw)
In-Reply-To: <201301292200.14622.ffainelli@freebox.fr>

于 2013年01月30日 05:00, Florian Fainelli 写道:
> Hello Huang,
>
> Le mardi 22 janvier 2013 02:30:30, Huang Shijie a écrit :
>> In nand_wait(), the timeo for panic_nand_wait() is assigned with
>> wrong value(jiffies + some delay). The timeo should be set like the
>> panic_nand_write() does.
>>
>> This patch fixes it, and also uses the msecs_to_jiffies() to make the
>> code more readable.
> You are not exactly explaining what is the issue with the current code, and
> how you are fixing it. If someone needs to backport this patch for whatever
> reason, it must be clear as to what it fixes.
ok, i can add more comments.
thanks for your review.

Best Regards
Huang Shijie

>> Signed-off-by: Huang Shijie<b32955@freescale.com>
>> ---
>> fix the compiler error in version 1, and add some commits.
>>
>> ---
>>   drivers/mtd/nand/nand_base.c |    8 ++------
>>   1 files changed, 2 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
>> index 8323ac9..a8c1fb4 100644
>> --- a/drivers/mtd/nand/nand_base.c
>> +++ b/drivers/mtd/nand/nand_base.c
>> @@ -825,13 +825,8 @@ static void panic_nand_wait(struct mtd_info *mtd,
>> struct nand_chip *chip, static int nand_wait(struct mtd_info *mtd, struct
>> nand_chip *chip) {
>>
>> -	unsigned long timeo = jiffies;
>>   	int status, state = chip->state;
>> -
>> -	if (state == FL_ERASING)
>> -		timeo += (HZ * 400) / 1000;
>> -	else
>> -		timeo += (HZ * 20) / 1000;
>> +	unsigned long timeo = (state == FL_ERASING ? 400 : 20);
>>
>>   	led_trigger_event(nand_led_trigger, LED_FULL);
>>
>> @@ -849,6 +844,7 @@ static int nand_wait(struct mtd_info *mtd, struct
>> nand_chip *chip) if (in_interrupt() || oops_in_progress)
>>   		panic_nand_wait(mtd, chip, timeo);
>>   	else {
>> +		timeo = jiffies + msecs_to_jiffies(timeo);
>>   		while (time_before(jiffies, timeo)) {
>>   			if (chip->dev_ready) {
>>   				if (chip->dev_ready(mtd))



  parent reply	other threads:[~2013-01-30  2:32 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-22  3:11 [PATCH] mtd: fix the wrong timeo for panic_nand_wait() Huang Shijie
2013-01-22  3:11 ` Huang Shijie
2013-01-21 14:27 ` Matthieu CASTET
2013-01-21 14:27   ` Matthieu CASTET
2013-01-21 14:54   ` Huang Shijie
2013-01-21 14:54     ` Huang Shijie
2013-01-22  1:30     ` [PATCH v2] " Huang Shijie
2013-01-22  1:30       ` Huang Shijie
2013-01-29 21:00       ` Florian Fainelli
2013-01-29 21:00         ` Florian Fainelli
2013-01-30  2:03         ` [PATCH v3] " Huang Shijie
2013-01-30  2:03           ` Huang Shijie
2013-02-04  7:37           ` Artem Bityutskiy
2013-02-04  7:37             ` Artem Bityutskiy
2013-01-30  2:31         ` Huang Shijie [this message]
2013-01-30  2:31           ` [PATCH v2] " Huang Shijie

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=51088619.5060102@freescale.com \
    --to=b32955@freescale.com \
    --cc=dedekind1@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=ffainelli@freebox.fr \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=matthieu.castet@parrot.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.