Steven:
At OSL you mentioned that local_irq_{save,disable} is unfriendly for RT
and spin_lock_irq[save] is greatly preferred. As it happens, the USB
core contains several instances of this code pattern:
local_irq_save(flags);
spin_lock(&some_lock);
...
spin_unlock(&some_lock);
usb_hcd_giveback_urb(hcd, urb);
local_irq_restore(flags);
The reason for doing this is historical; usb_hcd_giveback_urb() is
documented as running with local IRQs disabled, and many drivers depend
on that. For example, their callback routines invoked by
usb_hcd_giveback_urb do spin_lock() instead of spin_lock_irqsave().
So what's the best way to do this? Should we do:
spin_lock_irqsave(&some_lock, flags);
...
spin_unlock(&some_lock);
usb_hcd_giveback_urb(hcd, urb);
local_irq_restore(flags);
or is there a better approach?
Also, the USB host controller drivers contain this code pattern:
spin_lock_irq(&some_lock);
...
spin_unlock(&some_lock);
usb_hcd_giveback_urb(hcd, urb);
spin_lock(&some_lock);
...
spin_unlock_irq(&some_lock);
Again, this is because usb_hcd_giveback_urb() must run with interrupts
disabled. Is this pattern okay?
Alan Stern
-------------------------------------------------------------------------
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/
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel