Ayaz Abdulla wrote:



Manfred Spraul wrote:

Ayaz Abdulla wrote:

    if (nv_alloc_rx(dev)) {
-        spin_lock(&np->lock);
+        spin_lock_irqsave(&np->lock, flags);
Tiny point:
there is not need for irqsave(): we are in timer context, that guarantees:
- bottom half disabled
- interrupts enabled

Just use spin_lock_irq() and spin_unlock_irq().


I was assuming this function is called either from within irq handler or timer expiry and thats why I used "irqsave". But if interrupts are disabled in timer context, I can change the code.

No, it's the other way around:
spin_lock_irq() or _irqsave() disable interrupt processing of the current cpu entirely - no interrupts are handled. The concept of disabled local interrupts is entirely independant from process context, bottom half context or interrupt context. E.g. certain parts of the scheduler run in process context, but with disabled local interrupts.

You are right, the function is called from within the irq handler or a timer - that means either in interrupt context or in bottom half context (timers run in bottom half context). But: in both cases, they run with enabled local interrupts. Thus, spin_lock_irq()+spin_unlock_irq() is sufficient. spin_lock_irqsave()+spin_unlock_irqrestore() are only required in functions that are called both with enabled or disabled local interrupts.

--
   Manfred
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to