All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nand_wait_ready timeout fix
@ 2012-11-05 13:51 Matthieu CASTET
  2012-11-15 13:55 ` Artem Bityutskiy
  0 siblings, 1 reply; 7+ messages in thread
From: Matthieu CASTET @ 2012-11-05 13:51 UTC (permalink / raw)
  To: linux-mtd; +Cc: Matthieu CASTET, dedekind1

nand_wait_ready timeout should not assume HZ=1000.
Make it independent of HZ value like it is done in nand_wait.

Signed-off-by: Matthieu CASTET <matthieu.castet@parrot.com>
---
 drivers/mtd/nand/nand_base.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index d5ece6e..ee49fe2 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -492,7 +492,7 @@ static void panic_nand_wait_ready(struct mtd_info *mtd, unsigned long timeo)
 void nand_wait_ready(struct mtd_info *mtd)
 {
 	struct nand_chip *chip = mtd->priv;
-	unsigned long timeo = jiffies + 2;
+	unsigned long timeo = jiffies + (2 * HZ) / 1000;
 
 	/* 400ms timeout */
 	if (in_interrupt() || oops_in_progress)
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] nand_wait_ready timeout fix
  2012-11-05 13:51 [PATCH] nand_wait_ready timeout fix Matthieu CASTET
@ 2012-11-15 13:55 ` Artem Bityutskiy
  2012-11-22 17:06   ` Matthieu CASTET
  0 siblings, 1 reply; 7+ messages in thread
From: Artem Bityutskiy @ 2012-11-15 13:55 UTC (permalink / raw)
  To: Matthieu CASTET; +Cc: linux-mtd

[-- Attachment #1: Type: text/plain, Size: 1066 bytes --]

On Mon, 2012-11-05 at 14:51 +0100, Matthieu CASTET wrote:
> nand_wait_ready timeout should not assume HZ=1000.
> Make it independent of HZ value like it is done in nand_wait.
> 
> Signed-off-by: Matthieu CASTET <matthieu.castet@parrot.com>
> ---
>  drivers/mtd/nand/nand_base.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
> index d5ece6e..ee49fe2 100644
> --- a/drivers/mtd/nand/nand_base.c
> +++ b/drivers/mtd/nand/nand_base.c
> @@ -492,7 +492,7 @@ static void panic_nand_wait_ready(struct mtd_info *mtd, unsigned long timeo)
>  void nand_wait_ready(struct mtd_info *mtd)
>  {
>  	struct nand_chip *chip = mtd->priv;
> -	unsigned long timeo = jiffies + 2;
> +	unsigned long timeo = jiffies + (2 * HZ) / 1000;

I HZ=100, (2 * HZ) / 1000 will be 0, which is probably wrong.

Instead, this cruft should be re-worked and should use milliseconds for
time-outs, and use things like 'msecs_to_jiffies()' instead.


-- 
Best Regards,
Artem Bityutskiy

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] nand_wait_ready timeout fix
  2012-11-15 13:55 ` Artem Bityutskiy
@ 2012-11-22 17:06   ` Matthieu CASTET
  2012-11-30 12:35     ` Artem Bityutskiy
  0 siblings, 1 reply; 7+ messages in thread
From: Matthieu CASTET @ 2012-11-22 17:06 UTC (permalink / raw)
  To: dedekind1@gmail.com; +Cc: linux-mtd@lists.infradead.org

Artem Bityutskiy a écrit :
> On Mon, 2012-11-05 at 14:51 +0100, Matthieu CASTET wrote:
>> nand_wait_ready timeout should not assume HZ=1000.
>> Make it independent of HZ value like it is done in nand_wait.
>>
>> Signed-off-by: Matthieu CASTET <matthieu.castet@parrot.com>
>> ---
>>  drivers/mtd/nand/nand_base.c |    2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
>> index d5ece6e..ee49fe2 100644
>> --- a/drivers/mtd/nand/nand_base.c
>> +++ b/drivers/mtd/nand/nand_base.c
>> @@ -492,7 +492,7 @@ static void panic_nand_wait_ready(struct mtd_info *mtd, unsigned long timeo)
>>  void nand_wait_ready(struct mtd_info *mtd)
>>  {
>>  	struct nand_chip *chip = mtd->priv;
>> -	unsigned long timeo = jiffies + 2;
>> +	unsigned long timeo = jiffies + (2 * HZ) / 1000;
> 
> I HZ=100, (2 * HZ) / 1000 will be 0, which is probably wrong.
> 
> Instead, this cruft should be re-worked and should use milliseconds for
> time-outs, and use things like 'msecs_to_jiffies()' instead.
> 
> 

Ok,

Should I also update nand_wait [1] ?


Matthieu

[1]
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;

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH] nand_wait_ready timeout fix
@ 2012-11-22 17:31 Matthieu CASTET
  2012-11-23 12:45 ` Johan Gunnarsson
  2012-11-30 13:20 ` Artem Bityutskiy
  0 siblings, 2 replies; 7+ messages in thread
From: Matthieu CASTET @ 2012-11-22 17:31 UTC (permalink / raw)
  To: linux-mtd; +Cc: Matthieu CASTET, dedekind1

nand_wait_ready timeout should not assume HZ=100.
Make it independent of HZ value by using msecs_to_jiffies.

Signed-off-by: Matthieu CASTET <matthieu.castet@parrot.com>
---
 drivers/mtd/nand/nand_base.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 1a03b7f..16e95e7 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -492,7 +492,7 @@ static void panic_nand_wait_ready(struct mtd_info *mtd, unsigned long timeo)
 void nand_wait_ready(struct mtd_info *mtd)
 {
 	struct nand_chip *chip = mtd->priv;
-	unsigned long timeo = jiffies + 2;
+	unsigned long timeo = jiffies + msecs_to_jiffies(20);
 
 	/* 400ms timeout */
 	if (in_interrupt() || oops_in_progress)
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* RE: [PATCH] nand_wait_ready timeout fix
  2012-11-22 17:31 Matthieu CASTET
@ 2012-11-23 12:45 ` Johan Gunnarsson
  2012-11-30 13:20 ` Artem Bityutskiy
  1 sibling, 0 replies; 7+ messages in thread
From: Johan Gunnarsson @ 2012-11-23 12:45 UTC (permalink / raw)
  To: Matthieu CASTET, linux-mtd@lists.infradead.org; +Cc: dedekind1@gmail.com



> -----Original Message-----
> From: linux-mtd-bounces@lists.infradead.org [mailto:linux-mtd-
> bounces@lists.infradead.org] On Behalf Of Matthieu CASTET
> Sent: den 22 november 2012 18:31
> To: linux-mtd@lists.infradead.org
> Cc: Matthieu CASTET; dedekind1@gmail.com
> Subject: [PATCH] nand_wait_ready timeout fix
> 
> nand_wait_ready timeout should not assume HZ=100.
> Make it independent of HZ value by using msecs_to_jiffies.
> 
> Signed-off-by: Matthieu CASTET <matthieu.castet@parrot.com>
> ---
>  drivers/mtd/nand/nand_base.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mtd/nand/nand_base.c
> b/drivers/mtd/nand/nand_base.c
> index 1a03b7f..16e95e7 100644
> --- a/drivers/mtd/nand/nand_base.c
> +++ b/drivers/mtd/nand/nand_base.c
> @@ -492,7 +492,7 @@ static void panic_nand_wait_ready(struct mtd_info
> *mtd, unsigned long timeo)
>  void nand_wait_ready(struct mtd_info *mtd)
>  {
>  	struct nand_chip *chip = mtd->priv;
> -	unsigned long timeo = jiffies + 2;
> +	unsigned long timeo = jiffies + msecs_to_jiffies(20);

This won't work well for HZ <= 50 (probably not a very realistic case,
but still...)

I was involved in a discussion about this some months ago. The output of
that discussion was that it is probably safe to set the timeout to much
longer, like 1000ms, for both program and erase commands.

> 
>  	/* 400ms timeout */
>  	if (in_interrupt() || oops_in_progress)
> --
> 1.7.10.4
> 
> 
> ______________________________________________________
> Linux MTD discussion mailing list
> http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] nand_wait_ready timeout fix
  2012-11-22 17:06   ` Matthieu CASTET
@ 2012-11-30 12:35     ` Artem Bityutskiy
  0 siblings, 0 replies; 7+ messages in thread
From: Artem Bityutskiy @ 2012-11-30 12:35 UTC (permalink / raw)
  To: Matthieu CASTET; +Cc: linux-mtd@lists.infradead.org

[-- Attachment #1: Type: text/plain, Size: 165 bytes --]

On Thu, 2012-11-22 at 18:06 +0100, Matthieu CASTET wrote:
> Should I also update nand_wait [1] ?

Would be nice I think.

-- 
Best Regards,
Artem Bityutskiy

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] nand_wait_ready timeout fix
  2012-11-22 17:31 Matthieu CASTET
  2012-11-23 12:45 ` Johan Gunnarsson
@ 2012-11-30 13:20 ` Artem Bityutskiy
  1 sibling, 0 replies; 7+ messages in thread
From: Artem Bityutskiy @ 2012-11-30 13:20 UTC (permalink / raw)
  To: Matthieu CASTET; +Cc: linux-mtd

[-- Attachment #1: Type: text/plain, Size: 314 bytes --]

On Thu, 2012-11-22 at 18:31 +0100, Matthieu CASTET wrote:
> nand_wait_ready timeout should not assume HZ=100.
> Make it independent of HZ value by using msecs_to_jiffies.
> 
> Signed-off-by: Matthieu CASTET <matthieu.castet@parrot.com>

Pushed to l2-mtd.git, thanks!

-- 
Best Regards,
Artem Bityutskiy

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-11-30 13:19 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-05 13:51 [PATCH] nand_wait_ready timeout fix Matthieu CASTET
2012-11-15 13:55 ` Artem Bityutskiy
2012-11-22 17:06   ` Matthieu CASTET
2012-11-30 12:35     ` Artem Bityutskiy
  -- strict thread matches above, loose matches on Subject: below --
2012-11-22 17:31 Matthieu CASTET
2012-11-23 12:45 ` Johan Gunnarsson
2012-11-30 13:20 ` Artem Bityutskiy

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.