Reputation: 59
I am trying to install an IRQ handler for the IRQ line 43 as below:
ret2 = request_irq(irq_no, handle_interrupt, IRQF_SHARED, DEVICE_NAME, &pdev->dev);
But I keep on getting rquest_irq failed with -22 which is INVALID input. After looking into the kernel code I could see the function request_threaded_irq() is returning with -EINVAL at the below point:
desc = irq_to_desc(irq);
if (!desc) {
printk(KERN_EMERG "%s:%d\n", __func__, __LINE__);
return -EINVAL;
}
Can any one please help me understanding what could be the reason for the irq_to_desc() function to return NULL? I am using Kernel version 4.11 in a mips machine.
Thanks.
Upvotes: 1
Views: 2116
Reputation: 587
The call to irq_to_desc()
can fail if the corresponding IRQ number is not mapped to any allocated IRQ descriptors. IRQ descriptors are stored in a radix tree if CONFIG_SPARSE_IRQ
kernel config is enabled. Otherwise there is a direct translation between IRQ number and descriptor.
IRQ descriptors are usually allocated when interrupt controller driver is registered. You can refer to the datasheet of the interrupt controller OR the datasheet of the platform which you are using.
You can check if IRQ 43 is valid for your interrupt controller or not. The interrupt controller information can be found from the device-tree node of your device (look for interrupt-parent
in your device tree node).
Hope this helps.
Upvotes: 2