[Top] [All Lists]

Re: Interrupts in modules

To: Steve Papacharalambous <>
Subject: Re: Interrupts in modules
From: Keith Owens <>
Date: Sun, 22 Jul 2001 11:17:29 +1000
In-reply-to: Your message of "Sat, 21 Jul 2001 23:02:53 +0100." <>
On Sat, 21 Jul 2001 23:02:53 +0100, 
Steve Papacharalambous <> wrote:
>Are there any limitations or precautions needed with interrupt handlers
>in loadable modules?

There is a potential race condition when removing the module.  rmmod
will remove a module when its use count is zero.  If the interrupt
handler is invoked after the use count is tested but before the module
cleanup routine is entered then the code can be removed while the
interrupt handler is running.  The 2.5 module load/unload system will
remove this race.

In 2.4, your best option is to set a can_unload() function in the
module.  Unregister the interrupt handler in can_unload(), wait until
the interrupt count goes to zero (might be running on another cpu) then
return 0.  See drivers/char/ftape/compressor/zftape-compress.c for an

Alternatively keep a use count for opens on the device.  This assumes
that the device does not generate interrupts while it is not open, not
always true.

<Prev in Thread] Current Thread [Next in Thread>