lxusr
lxusr

Reputation: 1007

request_irq- irq flag set to 0 ; is this valid?

In some of the drivers while browsing 2.6.35, it is observed tht request_irq is passed a value 0 for irq flags. When seen in interrupt.h - 0 corresponds to IRQ_TRIGGER_NONE;

Is this equivalent to the case of IRQ_NONE in previous kernels?

Thanks.

Upvotes: 1

Views: 7526

Answers (2)

Roland
Roland

Reputation: 6543

The actual flags passed into request_irq() are defined in a comment in :

/*
 * 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.
 */

These are bits, so a logical OR (ie |) of a subset of these can be passed in; and if none apply, then the empty set is perfectly fine -- ie a value 0 for the flags parameter.

Since IRQF_TRIGGER_NONE is 0, passing 0 into request_irq() just says leave the triggering configuration of the IRQ alone -- ie however the hardware/firmware configured it.

IRQ_NONE is in a different namespace; it is one of the possible return values of an interrupt handler (the function passed into request_irq()), and it means that the interrupt handler did not handle an interrupt.

Upvotes: 7

Mircea
Mircea

Reputation: 1891

IRQ_NONE is a constant for the return values of IRQ handlers. It is still available in include/linux/irqreturn.h.

IRQ_TRIGGER_NONE is a specifier for the behaviour of the interrupt line.

So they are not equivalent.

Upvotes: 0

Related Questions