Now, let's quickly learn the mechanical part of it. The signature of the hardware interrupt handler routine (often referred to as the hardirq routine) is as follows:
static irqreturn_t interrupt_handler(int irq, void *data);
The interrupt handler routine is invoked by the kernel's generic IRQ layer when a hardware IRQ that your driver has registered interest in (via the request_irq() or friends APIs) is triggered. It receives two parameters:
- The first parameter is the IRQ line (an integer). Triggering this causes this handler to be invoked.
- The second parameter is the value that was passed via the last parameter to request_irq(). As we mentioned previously, it's typically the driver's specialized device structure that embeds the driver context or private data. Because of this, its data type is the generic void *, allowing request_irq() to pass any type along, typecasting it appropriately...