Conversely, when the driver is being unloaded or the device is being detached, the remove() (or disconnect()) method is the right place where you should call the converse routine – free_irq() – to free the IRQ line back to the kernel:
void *free_irq(unsigned int, void *);
The first parameter to free_irq() is the IRQ line to free back to the kernel. The second parameter is, again, the same value that's passed to the interrupt handler (via the last parameter to request_irq()), so you must typically populate it with either the device structure pointer (which embeds your driver's context or private data structure) or the THIS_MODULE macro.
The return value is the device name argument that you passed as the fourth parameter of the request_irq() routine (yes, it's a string) on success and NULL on failure.
It's important that you, as the driver author, take...