I'm trying to set up an interrupt-handler within a kernel-module that gets triggered by a gpio-interrupt, but it seems that I don't use the request_irq()
-function right...
I'm getting my irq-number via gpio_to_irq()
and this seems to work.
Then I'm calling
request_irq(irqNumber, handler, 0, "GPIO_Test", NULL);
but It returns -22, Invalid parameters.
I think it might be the handler-function because I'm not sure about it's signature - Sometimes it's defined as void handler (int irq, void *dev_id, struct pt_regs *regs)
, sometimes as static irqreturn_t handler(int irq, void *data)
- Which one is the correct one to use in this case and why are there these two totally different variations?
I tried both, but always got the same Invalid-parameters-error.
The compiler gives me a warning about the return-type of my handler-function: when using:
static irqreturn_t handler(int irq, void *data)
{
/*interrupt-handling*/
return IRQ_HANDLED;
}
»irq_handler_t« expected, but argument has type »enum irqreturn_t (* (*)(int, void *))(int, void *)«
...and when using:
void handler (int irq, void *dev_id, struct pt_regs *regs){/*interrupt-handling*/}
»irq_handler_t« expected, but argument has type »void (*)(int, void *, struct pt_regs *)«
Thank you for your support ;)