aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/irq/chip.c
diff options
context:
space:
mode:
authorDavid Brownell <dbrownell@users.sourceforge.net>2008-10-01 17:46:18 -0400
committerIngo Molnar <mingo@elte.hu>2008-10-02 04:24:09 -0400
commit0c5d1eb77a8be917b638344a22afe1398236482b (patch)
tree57d57c9b270cc10428f818cfec9725a1344b78ce /kernel/irq/chip.c
parentd6d5aeb661fc14655c417f3582ae7ec52985d2a8 (diff)
genirq: record trigger type
Genirq hasn't previously recorded the trigger type used by any given IRQ, although some irq_chip support has done so. That data can be useful when troubleshooting. This patch records it in the relevant irq_desc.status bits, and improves consistency between the two driver-visible calls affected: - Make set_irq_type() usage match request_irq() usage: * IRQ_TYPE_NONE should be a NOP; succeed, so irq_chip methods won't have to handle that case any more (many do it wrong). * IRQ_TYPE_PROBE is ignored; any buggy out-of-tree callers might need to switch over to the real IRQ probing code. * emit the same diagnostics (from shared utility code) - Their kerneldoc now reflects usage: * request_irq() flags include IRQF_TRIGGER_* to specify active edge(s)/level ... docs previously omitted that * set_irq_type() is declared in <linux/irq.h> so callers should use the (bit-equivalent) IRQ_TYPE_* symbols there Also: adds a warning about shared IRQs that don't end up using the requested trigger mode; and fix an unrelated "sparse" warning. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Acked-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/irq/chip.c')
-rw-r--r--kernel/irq/chip.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
index d663338cb4a8..5203a599d211 100644
--- a/kernel/irq/chip.c
+++ b/kernel/irq/chip.c
@@ -111,9 +111,9 @@ int set_irq_chip(unsigned int irq, struct irq_chip *chip)
111EXPORT_SYMBOL(set_irq_chip); 111EXPORT_SYMBOL(set_irq_chip);
112 112
113/** 113/**
114 * set_irq_type - set the irq type for an irq 114 * set_irq_type - set the irq trigger type for an irq
115 * @irq: irq number 115 * @irq: irq number
116 * @type: interrupt type - see include/linux/interrupt.h 116 * @type: IRQ_TYPE_{LEVEL,EDGE}_* value - see include/linux/irq.h
117 */ 117 */
118int set_irq_type(unsigned int irq, unsigned int type) 118int set_irq_type(unsigned int irq, unsigned int type)
119{ 119{
@@ -127,11 +127,12 @@ int set_irq_type(unsigned int irq, unsigned int type)
127 } 127 }
128 128
129 desc = irq_desc + irq; 129 desc = irq_desc + irq;
130 if (desc->chip->set_type) { 130 if (type == IRQ_TYPE_NONE)
131 spin_lock_irqsave(&desc->lock, flags); 131 return 0;
132 ret = desc->chip->set_type(irq, type); 132
133 spin_unlock_irqrestore(&desc->lock, flags); 133 spin_lock_irqsave(&desc->lock, flags);
134 } 134 ret = __irq_set_trigger(desc, irq, flags);
135 spin_unlock_irqrestore(&desc->lock, flags);
135 return ret; 136 return ret;
136} 137}
137EXPORT_SYMBOL(set_irq_type); 138EXPORT_SYMBOL(set_irq_type);