[PATCH] nand_wait_ready timeout fix

Artem Bityutskiy dedekind1 at gmail.com
Thu Nov 15 08:55:17 EST 2012


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 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 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
URL: <http://lists.infradead.org/pipermail/linux-mtd/attachments/20121115/f31343bf/attachment.sig>


More information about the linux-mtd mailing list