--- spinlocks.txt.0     Thu Sep  9 13:40:46 1999
+++ spinlocks.txt       Thu Sep  9 13:57:01 1999
@@ -63,9 +63,9 @@

and another sequence that does

-       spin_lock_irqsave(flags);
+       spin_lock_irqsave(&xxx_lock, flags);
       .. critical section ..
-       spin_unlock_irqrestore(flags);
+       spin_unlock_irqrestore(&xxx_lock, flags);

then they are NOT mutually exclusive, and the critical regions can happen
at the same time on two different CPU's. That's fine per se, but the
@@ -168,6 +168,25 @@
on other CPU's, because an interrupt on another CPU doesn't interrupt the
CPU that holds the lock, so the lock-holder can continue and eventually
releases the lock).
+
+If you have a case where both interrupt and non-interrupt (e.g. ioctl()) code
+access the same data structures then you should use spin_lock_irqsave() in the
+non-interrupt code and spin_lock() in the interrupt handler as in:
+
+my_ioctl()
+{
+       spin_lock_irqsave(&lock, flags);
+       ...
+       spin_unlock_irqrestore(&lock, flags);
+}
+
+my_irq_handler()
+{
+       spin_lock(&lock);
+       ...
+       spin_unlock(&lock);
+}
+

Note that you can be clever with read-write locks and interrupts. For
example, if you know that the interrupt only ever gets a read-lock, then