[PATCH] nand_wait_ready timeout fix

Johan Gunnarsson johan.gunnarsson at axis.com
Fri Nov 23 07:45:41 EST 2012



> -----Original Message-----
> From: linux-mtd-bounces at lists.infradead.org [mailto:linux-mtd-
> bounces at lists.infradead.org] On Behalf Of Matthieu CASTET
> Sent: den 22 november 2012 18:31
> To: linux-mtd at lists.infradead.org
> Cc: Matthieu CASTET; dedekind1 at 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 at 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/



More information about the linux-mtd mailing list