[linux-usb-devel] upping a semaphore from a USB completion handler?

2007-06-22 Thread Florin Iucha
Hello,

I am writing a USB driver for some custom hardware, and I need to
synchronize between the user-space and the USB subsystem.  Can I
create a semaphore and down it in the reader then up it in the
completion handler?

I know the completion handler runs in interrupt context so you are not
allowed to acquire any semaphores: but can you release them?  Will the
waiting tasks wake up after the handler and its caller returned - IOW
will the waking up task run in interrupt context as well?

This is with Linux 2.4 (if it makes a difference).

Thanks,
florin

-- 
Bruce Schneier expects the Spanish Inquisition.
  http://geekz.co.uk/schneierfacts/fact/163


signature.asc
Description: Digital signature
-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


Re: [linux-usb-devel] upping a semaphore from a USB completion handler?

2007-06-22 Thread Oliver Neukum
Am Freitag, 22. Juni 2007 schrieb Florin Iucha:
 Hello,
 
 I am writing a USB driver for some custom hardware, and I need to
 synchronize between the user-space and the USB subsystem.  Can I
 create a semaphore and down it in the reader then up it in the
 completion handler?

Yes, you can.

 I know the completion handler runs in interrupt context so you are not
 allowed to acquire any semaphores: but can you release them?  Will the

You can.

 waiting tasks wake up after the handler and its caller returned - IOW
 will the waking up task run in interrupt context as well?

No, it will run or rather may run, as you have no guarantee that it'll be
scheduled to run immediately, in its own context.

Regards
Oliver

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel