2011-11-29 90 views

回答

4

送入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()的函數),這意味着中斷處理程序不處理中斷。

0

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

IRQ_TRIGGER_NONE是中斷行的行爲說明符。

所以他們是不是等效。