user3318922
user3318922

Reputation: 51

interrupt handling by C code

I am trying to disable interrupts through C code but stuck at request_irq(). One argument to request_irq() is flag and SA_INTERRUPT flag is now deprecated. Can anyone tell me alternative to SA_INTERRUPT?. I am using kernel version 3.8.

Any other alternative to request_irq() for disabling interrupts?

Upvotes: 0

Views: 1599

Answers (1)

Alexey Polonsky
Alexey Polonsky

Reputation: 1201

request_irq() does not "disable" an interrupt. It is called by a driver that wants to attach an interrupt service routine to an IRQ. The flag is IRQF_SHARED if the interrupt is shared or 0 otherwise.

Here is an example from a driver for Realtek 8169 PCIe network adapter: http://lxr.free-electrons.com/source/drivers/net/ethernet/realtek/r8169.c

 retval = request_irq(pdev->irq, rtl8169_interrupt,
      (tp->features & RTL_FEATURE_MSI) ? 0 : IRQF_SHARED,
      dev->name, dev);

In the example above, rtl8169_interrupt is the interrupt service routine (ISR) that will be invoked each time an IRQ is raised.

It is the job of the ISR to find out if the interrupt was indeed fired by the "owned" device (relevant for shared interrupts) then if the device indeed fired the interrupt, the ISR reads interrupt status then clears the interrupt.

Upvotes: 1

Related Questions