Re: [PATCH] asm/semaphore.h compatibility header

On 17/02/05 23:02, Frank Mori Hess wrote:
> On Wednesday 16 February 2005 09:53 am, Ian Abbott wrote:
>>The only drivers that use mutexes currently are usbdux and usbduxfast,
>>and they won't compile for old kernels anyway.  Still, there's no reason
>>why some other drivers couldn't make use of mutexes now!
> 
> I've committed it, but you should be aware that using mutexes will break 
> your driver for use under RT, since down() can sleep.  It doesn't matter 
> for usb drivers though, since I doubt there is any easy way to make them 
> work under RT.

Good point!

Any idea which bits of a Comedi driver are allowed to sleep?

I know the following can't sleep:

   interrupt handlers
   any code holding a spinlock

I'm pretty sure the following can't sleep:

   s->insn_read
   s->insn_write
   s->insn_bits
   s->insn_config (I'm not as sure about this one!)

I've no idea if these should be allowed to sleep or not:

   s->do_cmd
   s->do_cmdtest (but it should have no reason to sleep)
   s->poll
   s->cancel (might need to sleep for synchronization)
   s->buf_change
   s->munge (but it should have no reason to sleep)
   s->async->inttrig

I'm pretty sure these are allowed to sleep:

   dev->attach
   dev->detach
   dev->open
   dev->close

Also, I guess it would be a bad idea to call comedi_event while holding 
any sort of lock which s->async->cb_func may to use!

-- 
-=( Ian Abbott _at_ MEV Ltd.    E-mail: <abbotti_at_mev.co.uk>        )=-
-=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587         )=-

Received on 2005-02-18Z13:58:37