[PATCH 3/4] add delay when entering cmd mode

Harald Welte laforge at openmoko.org
Wed Dec 19 18:57:57 CET 2007


On Wed, Dec 19, 2007 at 02:08:14PM -0300, Werner Almesberger wrote:
> Chia-I Wu wrote:
> > +		msleep(90);
> 
> Hmm, such a long msleep isn't so nice. How about this ?

Mh, I don't really understand this.  it's msleep, not mdelay!

msleep very much schedules the current task away, without any
busy-waiting.

> 	schedule_timeout_uninterruptible(msecs_to_jiffies(90)+1);
> 
> This will wait at least 90ms, without keeping the CPU busy.

from kernel/timer.c

void msleep(unsigned int msecs)
{
	unsigned long timeout = msecs_to_jiffies(msecs) + 1;

	while (timeout)
		timeout = schedule_timeout_uninterruptible(timeout);
}

Cheers,
-- 
- Harald Welte <laforge at openmoko.org>          	        http://openmoko.org/
============================================================================
Software for the world's first truly open Free Software mobile phone




More information about the openmoko-kernel mailing list