[PATCH] genirq: Fix the case of irqflag with IRQF_SHARED andIRQF_NO_THREAD

From: Chuansheng Liu
Date: Tue Nov 13 2012 - 03:01:22 EST



When one shared irq is requested as below:
req1: request_irq(irqnb, cb1, IRQF_SHARED, ...);
then:
req2: request_irq(irqnb, cb2, IRQF_SHARED|IRQF_NO_THREAD, ...);

Both req1 and req2 will be successful.

But if we passed threadirqs in commandline, and executing req1 and req2,
the req2 will fail. The reason is req1 without IRQF_NO_THREAD, then
the IRQF_ONESHOT will be added into flag, while req2 will has no IRQS_ONESHOT
flag, it cause type mismatch case for shared interrupt.

Here add the check of agreeing on NO_THREAD, to make sure the req1/req2
can work well for both scenerio.

Signed-off-by: liu chuansheng <chuansheng.liu@xxxxxxxxx>
---
kernel/irq/manage.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index 4c69326..dda0f26 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -971,7 +971,8 @@ __setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new)
*/
if (!((old->flags & new->flags) & IRQF_SHARED) ||
((old->flags ^ new->flags) & IRQF_TRIGGER_MASK) ||
- ((old->flags ^ new->flags) & IRQF_ONESHOT))
+ ((old->flags ^ new->flags) & IRQF_ONESHOT) ||
+ ((old->flags ^ new->flags) & IRQF_NO_THREAD))
goto mismatch;

/* All handlers must agree on per-cpuness */
--
1.7.0.4



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/