logo       

Re: busy waiting: msg#00029

Subject: Re: busy waiting
On Wed, 31 May 2006 18:37:03 -0400 Trevor Woerner wrote:

> I've got one of those situations whereby I write the offset of the
> data I want into an ADDR register and then I have to wait until a
> certain bit in a STATUS register switches before I can read the data
> out from the DATA register.
> 
> This occurs in "regular" driver mode, i.e. in an IOCTL so there's no
> worries about being in interrupt mode or anything like that.
> 
> Currently I check the bit and if it isn't set I perform an:
> 
>     msleep_interruptible (1);
> 
> before re-reading the register and checking again. This is all wrapped
> in a for() loop so it can't go on forever.
> 
> The problem I'm having is that I find this is too slow, waiting a
> millisecond each time is very long to wait and I'm curious to know if
> there are any other units of time I could try that would be smaller.
> Grepping around in the kernel sources the obvious
> "usleep_interruptible()" doesn't exist :-(
> 
> Any ideas?

you could consider what libata does.
See include/linux/libata.h::ata_busy_wait() or ata_wait_idle().


---
~Randy


<Prev in Thread] Current Thread [Next in Thread>