From: Mike Dunn <mikedunn@newsguy.com>
To: dedekind1@gmail.com
Cc: linux-mtd@lists.infradead.org
Subject: Re: [PATCH] mtd: nand: docg4: add udelay(1) to polling loop
Date: Thu, 16 May 2013 12:49:55 -0700 [thread overview]
Message-ID: <51953863.4080609@newsguy.com> (raw)
In-Reply-To: <1368690236.15764.178.camel@sauron.fi.intel.com>
On 05/16/2013 12:43 AM, Artem Bityutskiy wrote:
> On Mon, 2013-04-22 at 11:23 -0700, Mike Dunn wrote:
>> timeo = 1000;
>> do {
>> + udelay(1);
>> cpu_relax();
>> flash_status = readb(docptr + DOC_FLASHCONTROL);
>> } while (!(flash_status & DOC_CTRL_FLASHREADY) && --timeo);
>
> How about using jiffies instead? Something like:
>
> timeout = jiffies + msecs_to_jiffies(delay);
> do {
> } while (time_before(jiffies, timeout))
>
This works too (just tested it). But the reason I did not do this originally is
because the timeout is very short. With udelay(1) and timeo=1000, the timeout
is 1ms (plus processing time), and I think this is well in excess of the actual
time needed by the hardware. Using jiffies and with HZ=100, my minimum timeout
is 10ms. But there's no harm in having an excessive timeout since it's a
busy-wait loop, so your suggestion is probably fine.
Is use of udelay() frowned upon? Will using jiffies cause a problem with a
"tickless" configuration? Hoping to learn something...
Thanks Artem!
Mike
prev parent reply other threads:[~2013-05-16 19:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-22 18:23 [PATCH] mtd: nand: docg4: add udelay(1) to polling loop Mike Dunn
2013-05-16 7:43 ` Artem Bityutskiy
2013-05-16 19:49 ` Mike Dunn [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=51953863.4080609@newsguy.com \
--to=mikedunn@newsguy.com \
--cc=dedekind1@gmail.com \
--cc=linux-mtd@lists.infradead.org \
/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 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.