On Sun, 2005-01-30 at 00:16 +0000, Chris Rankin wrote: > I am writing a USB driver for Linux 2.4 and Linux 2.6, > and I am currently using a single spin lock > exclusively with spin_lock_irqsave() and > spin_unlock_irqrestore(). However, I am wondering if > it is possible to optimise this approach to locking, > please? > > I am currently using my lock in the following places: > - user context > - timer functions > - tasklets > - USB URB callback functions As far as I understand your mail you start at the wrong end with the locking - namely the functions. Start from the correct end - tha data: Look at your data and which parts are shared between the various flows of control. And then think about one lock (there are more than spinlocks) or several locks. Bernd -- Firmix Software GmbH http://www.firmix.at/ mobil: +43 664 4416156 fax: +43 1 7890849-55 Embedded Linux Development and Services -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/