Interrupts stop working after device driver is removed and reinserted
I'm working on a driver for a network card. The first time I insert it (insmod) it loads up and registers a PCI MSI (message signaled interrupt). The code looks something like this:
pci_register_driver( ... );
pci_enable_msi( ... );
request_irq( ... );
When I generate interrupts, the handler catches them and everything works. If I remove the module, this code executes:
free_irq( ... );
pci_disable_msi ( ... );
pci_disable_device( ... );
Everything seems to work, but, if I reinsert the module, I get no errors, but interrupts are no longer caught/handled.
If I look in /proc/interrupts, it seems that the interrupts are't even being generated anymore. However, 3 times out of 4, when I remove the driver a second time, I get an unhandled IRQ error on the linux kernel, which suggests that the hardware is working, but that the kernel is masking these interrupts.
Any ideas why?