request_irq- irq标志设置为0;这有效吗?

时间:2011-11-29 05:28:40

标签: linux linux-kernel linux-device-driver

在浏览2.6.35时的某些驱动程序中,观察到request_irq为irq标志传递了值0。在interrupt.h中看到 - 0对应IRQ_TRIGGER_NONE;

这相当于以前内核中IRQ_NONE的情况吗?

感谢。

2 个答案:

答案 0 :(得分:6)

传递到request_irq()的实际标志在以下注释中定义:

/*
 * These flags used only by the kernel as part of the
 * irq handling routines.
 *
 * IRQF_DISABLED - keep irqs disabled when calling the action handler.
 *                 DEPRECATED. This flag is a NOOP and scheduled to be removed
 * IRQF_SAMPLE_RANDOM - irq is used to feed the random generator
 * IRQF_SHARED - allow sharing the irq among several devices
 * IRQF_PROBE_SHARED - set by callers when they expect sharing mismatches to occur
 * IRQF_TIMER - Flag to mark this interrupt as timer interrupt
 * IRQF_PERCPU - Interrupt is per cpu
 * IRQF_NOBALANCING - Flag to exclude this interrupt from irq balancing
 * IRQF_IRQPOLL - Interrupt is used for polling (only the interrupt that is
 *                registered first in an shared interrupt is considered for
 *                performance reasons)
 * IRQF_ONESHOT - Interrupt is not reenabled after the hardirq handler finished.
 *                Used by threaded interrupts which need to keep the
 *                irq line disabled until the threaded handler has been run.
 * IRQF_NO_SUSPEND - Do not disable this IRQ during suspend
 * IRQF_FORCE_RESUME - Force enable it on resume even if IRQF_NO_SUSPEND is set
 * IRQF_NO_THREAD - Interrupt cannot be threaded
 * IRQF_EARLY_RESUME - Resume IRQ early during syscore instead of at device
 *                resume time.
 */

这些是位,因此可以传入这些子集的逻辑OR(即|);如果不适用,则空集完全正常 - 即flags参数的值为0.

由于IRQF_TRIGGER_NONE为0,将0传递给request_irq()只是说保留IRQ的触发配置 - 即硬件/固件配置它。

IRQ_NONE位于不同的命名空间中;它是中断处理程序的可能返回值之一(传递给request_irq()的函数),这意味着中断处理程序没有处理中断。

答案 1 :(得分:0)

IRQ_NONE是IRQ处理程序返回值的常量。它仍然可以在include/linux/irqreturn.h中找到。

IRQ_TRIGGER_NONE是中断线行为的说明符。

所以他们相当。