To tell the truth , I do not know exactly the methods to use the shared Irq in functions.It remains to be settled in the future.
int request_irq(unsigned int irq,
irqreturn_t (*handler)(int, void *, struct pt_regs *),
unsigned long irqflags,
const char *devname,
void *dev_id)
The third parameter, irqflags, might be either zero or a bit mask of one or more of the
following flags:
SA_INTERRUPT
SA_SAMPLE_RANDOM
SA_SHIRQ
The fifth parameter, dev_id, is used primarily for shared interrupt lines. When an interrupt handler is freed (discussed later), dev_id provides a unique cookie to allow the removal of only the desired interrupt handler from the interrupt line. Without this parameter, it would be impossible for the kernel to know which handler to remove on a given
interrupt line. You can pass NULL here if the line is not shared。
A shared handler is registered and executed much like a non-shared handler. There are three main differences:
1.The SA_SHIRQ flag must be set in the flags argument to request_irq().
2.The dev_id argument must be unique to each registered handler. A pointer to any per-device structure is sufficient; a common choice is the device structure as it is both unique and potentially useful to the handler. ( This means dev_id can points to device struct you have defined defore!)You cannot pass NULL for a shared handler!
3.The interrupt handler must be capable of distinguishing whether its device actually generated an interrupt. This requires both hardware support and associated logic in the interrupt handler(how to achieve it?). If the hardware did not offer this capability, there would be no way for the interrupt handler to know whether its associated device or some other device sharing the line caused the interrupt.All drivers sharing the interrupt line must meet the previous requirements. If any one device does not share fairly, none can share the line. When request_irq() is called with SA_SHIRQ specified, the call succeeds only if the interrupt line is currently not registered, or if all registered handlers on the line also specified SA_SHIRQ.