Unexpected driver interrupt behavior during init
Alvin Abitria
abitria.alvin at gmail.com
Mon May 26 11:12:16 EDT 2014
I am currently developing a PCI block driver and can use only MSI interrupt. During interrupt initialization, I called the pci_enable_msi and request_irq with following sample irq initialization function -
static int mydev_init_irq(struct mydevice *dev_ptr)
{
int error;
struct pci_dev *pdev = dev_ptr->pdev;
const char *mydev_irq = "mydev_irq";
error = pci_enable_msi(pdev);
if (error) {
printk(KERN_WARNING "Failed to enable MSI.");
return error;
}
error = request_irq(pdev->irq, mydev_irq_handler, IRQF_SHARED,
mydev_irq, dev_ptr);
return error;
}
After the request_irq executes, I always see from my debug trace that my driver is interrupted i.e. mydev_irq_handler got called. I don't think it's proper behavior, because I'm sure at this point of the initialization the device is not fully initialized as well and hasn't sent me an interrupt yet (didn't see this behavior in our Windows driver). At this point in initialization, since the device is not yet fully initialized and can't provide other info to the spurious interrupt I received, the IRQ handler will skip most of the handler function body and go straight to return IRQ_HANDLED, but I'm concerned with this bug.
What could be causing that, and did I miss anything during interrupt initialization that caused it? Right now it's harmless, but I'm worried that it may cause problems in the future, like if I ported it to another Linux distro, and so I want to be able to prevent this.
Sent from Samsung Mobile
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20140526/318ad4eb/attachment-0001.html
More information about the Kernelnewbies
mailing list