Skip to contentSkip to conversation

free_irq

PATCH Russell King 1 participant 1 message Sep 29, 2002

lore
Share & tools
lore
#0 lore raw

Hi,

The comments surrounding free_irq() include these line:

 *      On a shared IRQ the caller must ensure the interrupt is disabled
 *      on the card it drives before calling this function. The function
 *      does not return until any executing interrupts for this IRQ
 *      have completed.

*
* This function may be called from interrupt context.

This last line is quite bogus.

- if we call this function to free IRQ "n" from an interrupt handler running on IRQ "n", then we will deadlock; we call synchronize_irq(n) which will wait for us to exit.

- if we call this function to free IRQ "n" from an interrupt handler running on IRQ "b", and a handler for IRQ "n" is already running and IRQ "n" interrupted IRQ "n", then we will deadlock.

In light of the above, I'd suggest changing the last line to:

* This function must not be called from interrupt context.

This patch is against 2.5.34:

arch/i386/kernel/irq.c +1 -4
@@ -483,10 +483,7 @@
  *	does not return until any executing interrupts for this IRQ
  *	have completed.
  *
- *	This function may be called from interrupt context. 
- *
- *	Bugs: Attempting to free an irq in a handler for the same irq hangs
- *	      the machine.
+ *	This function must not be called from interrupt context. 
  */
  
 void free_irq(unsigned int irq, void *dev_id)
Signature · 2 lines
Russell King ([email protected])                The developer of ARM Linux
             http://www.arm.linux.org.uk/personal/aboutme.html