diff mbox

nand_wait_ready timeout fix

Message ID 1353605488-29438-1-git-send-email-matthieu.castet@parrot.com
State Accepted
Commit ca6a24893073414c549920d93bac57d46d7f3e1e
Headers show

Commit Message

Matthieu CASTET Nov. 22, 2012, 5:31 p.m. UTC
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(-)

Comments

Johan Gunnarsson Nov. 23, 2012, 12:45 p.m. UTC | #1
> -----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/
Artem Bityutskiy Nov. 30, 2012, 1:20 p.m. UTC | #2
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!
diff mbox

Patch

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)