Re: [PATCH] deinline sleep/delay functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thursday 30 June 2005 12:19, Arjan van de Ven wrote:
> 
> > > There are a number of compile-time checks that your patch has removed
> > > which catch such things, and as such your patch is not acceptable.
> > > Some architectures have a lower threshold of acceptability for the
> > > maximum udelay value, so it's absolutely necessary to keep this.
> > 
> > It removes that check from x86 - other architectures retain it.
> > 
> > I don't recall seeing anyone trigger the check,
> 
> I do ;) Esp in vendor out of tree crap. It's a good compile time
> diagnostic so the junk code doesnt' hit mainline but gets fixed first.

It seems my patch was incomplete.

Thinking more about it, since it exists in all arches
and also since delaying is not performance critical
(hey, if we're going to delay/sleep, we surely can burn
a few more cycles), this can be done as follows:

linux/timer.c:

void ndelay(unsigned int nsecs)
{
	unsigned int m = nsecs/(1024*1024);
       	while (m--)
		__ndelay(1024);
	__ndelay(nsecs % (1024*1024));
}

void udelay(unsigned int usecs)
{
	unsigned int k = usecs/1024;
       	while (k--)
		__udelay(1024);
	__udelay(usecs % 1024);
}

void mdelay(unsigned int msecs)
{
       	while (msecs--)
		udelay(1000);
}

void ssleep(unsigned int secs)
{
        msleep(secs * 1000);
}

and arches will need to only supply two functions:

__udelay(n) [n is guaranteed <1024]
__ndelay(n) [n is guaranteed <1024*1024]

For users, _any_ value, however large, will work for
any delay function.

Comments?
--
vda

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux