From: Artem Bityutskiy <dedekind1@gmail.com>
To: Matthieu CASTET <matthieu.castet@parrot.com>
Cc: "linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>
Subject: Re: [PATCH 1/6] nand_wait_ready timeout fix
Date: Wed, 29 Jun 2011 09:08:08 +0300 [thread overview]
Message-ID: <1309327692.23597.99.camel@sauron> (raw)
In-Reply-To: <4E09EEA9.2040307@parrot.com>
On Tue, 2011-06-28 at 17:09 +0200, Matthieu CASTET wrote:
> >> struct nand_chip *chip = mtd->priv;
> >> - unsigned long timeo = jiffies + 2;
> >> + unsigned long timeo = jiffies + (2 * HZ) / 1000;
> >
> > I agree that the code is buggy, but your fix is strange: if HZ = 100, (2
> > * HZ) / 1000 will be zero?
> >
> > I think you should instead know for how many msecs you want to wait, and
> > use msecs_to_jiffies().
> >
> Your right, I assume the code was written for HZ=100, and the code should wait
> for 20 ms :
> unsigned long timeo = jiffies + (20 * HZ) / 1000;
>
> this will match with the
> 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;
> [...]
> }
I think we should use msecs_to_jiffies() in nand_wait() as well. Why
relying on weird calculations with HZ?
--
Best Regards,
Artem Bityutskiy
prev parent reply other threads:[~2011-06-29 6:08 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-26 16:26 [PATCH 1/6] nand_wait_ready timeout fix Matthieu CASTET
2011-06-26 16:26 ` [PATCH 2/6] nand_wait : warn if the nand is busy on exit Matthieu CASTET
2011-06-28 7:57 ` Artem Bityutskiy
2011-06-28 15:03 ` Matthieu CASTET
2011-06-28 19:05 ` Artem Bityutskiy
2011-06-29 13:59 ` Ivan Djelic
2011-06-30 12:36 ` Artem Bityutskiy
2011-06-26 16:26 ` [PATCH 3/6] refactor mtd wait code Matthieu CASTET
2011-06-28 8:00 ` Artem Bityutskiy
2011-06-28 8:03 ` Artem Bityutskiy
2011-06-28 15:00 ` Matthieu CASTET
2011-06-29 6:09 ` Artem Bityutskiy
2011-06-26 16:26 ` [PATCH 4/6] nand_wait_read : add code to wait on status for LP Matthieu CASTET
2011-06-26 16:26 ` [PATCH 5/6] nand_flash_detect_onfi propagate busw info Matthieu CASTET
2011-06-29 16:38 ` Brian Norris
2011-06-30 11:47 ` Artem Bityutskiy
2011-06-26 16:26 ` [PATCH 6/6] add NAND_BUSWIDTH_AUTO Matthieu CASTET
2011-06-29 16:37 ` Brian Norris
2011-06-28 7:48 ` [PATCH 1/6] nand_wait_ready timeout fix Artem Bityutskiy
2011-06-28 15:09 ` Matthieu CASTET
2011-06-29 6:08 ` Artem Bityutskiy [this message]
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=1309327692.23597.99.camel@sauron \
--to=dedekind1@gmail.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).