I'm facing a problem with request_irq, when I try to hook my interrupt handler with the interrupt line, I receive the following message:
root@device:~# insmod kernelModule.ko
genirq: Flags mismatch irq 18. 00000000 (xyz) vs. 00000000 (xyz)
Request_irq return: -16 (This is my print of the return value of request_irq function)
The flags are totally equal, and I don't know what is the problem.
The irq number looks correct, as shown below:
root@device:~# cat /proc/interrupts
CPU0 CPU1 CPU2 CPU3 CPU4 CPU5 CPU6 CPU7
18: 0 0 0 0 0 0 0 0 OpenPIC 8 Level xyz
And my code is listed below:
#define XYZ_IRQ (18)
int reqRet;
static irqreturn_t xyz_interrupt(int irq, void *dev)
{
printk(KERN_INFO "Interrupt "XYZ Handled!!!);
return IRQ_HANDLED;
}
static int __init hello_init(void)
{
reqRet = request_irq(XYZ_IRQ, xyz_interrupt, 0, "xyz", (void*)&reqRet);
// reqRet = request_irq(XYZ_IRQ, xyz_interrupt, 0, "xyz", (void*)NULL); /* If I use this call, I don't receive the mismatch message, but the return code still -16 */
printk(KERN_INFO "xyz_irq: Request_irq return: %d\n", reqRet);
if(reqRet)
{
printk(KERN_ERR "xyz_irq: cannot register IRQ %d\n", XYZ_IRQ);
return -EIO;
}
return 0;
}
My Device tree config for this external device:
xyz@5,0 {
compatible = "generic-uio";
reg = <0x5 0x0 0x1000>;
interrupt = <0x8 0x1 0x0 0x0>
};
My device is based on p4080ds.
Could someone help me?
Thanks in advance
Look at the following page:
http://www-numi.fnal.gov/offline_software/srt_public_context/WebDocs/Errors/unix_system_errors.html
Error -16 shows about EBUSY for this interrupt.
See the following pages:
http://www.makelinux.net/books/lkd2/ch06lev1sec3
http://www.makelinux.net/ldd3/chp-10-sect-2
https://www.opennet.ru/man.shtml?topic=request_irq&category=9&russian=2
https://lists.gt.net/linux/kernel/883644
Have a great day,
Pavel Chubakov
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------