Messages in this thread | | | Date | Thu, 6 Feb 2003 17:49:44 +0300 | From | Ivan Kokshaysky <> | Subject | Re: [PATCH] PATCH: add framework for ndelay (nanoseconds) |
| |
On Wed, Feb 05, 2003 at 03:34:31PM +0100, Geert Uytterhoeven wrote: > On Sun, 2 Feb 2003, Linux Kernel Mailing List wrote: > > ChangeSet 1.953.4.9, 2003/02/02 02:44:15-02:00, alan@lxorguk.ukuu.org.uk > > > > [PATCH] PATCH: add framework for ndelay (nanoseconds) > > > > +void __ndelay(unsigned long usecs) > ^^^^^ > > +{ > > + __const_udelay(usecs * 0x00005); /* 2**32 / 1000000000 (rounded up) */ > ^^^^^ > > +} > > Wouldn't it make more sense to call the parameter `nsecs' (or `ns')?
There are more serious problems with this implementation: 1) It's *very* imprecise. Even on an 1 GHz CPU and with HZ = 100 precision is ~86 nsec. With HZ = 1000 it's almost unusable on *any* CPU. 2) Additional delay caused by integer multiplication, cache misses and so on may be large enough, especially on older processors. On 233 MHz PII it's 600-700 nsec (perfectly repeatable), on 600 MHz alpha ev56 - 200-300 nsec.
As of current 2.4, there is the only user of ndelay() - ide_execute_command() that calls ndelay(400). Why udelay(1) cannot be used instead?
Ivan. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |