All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] genirq: fix trigger flags check for shared irqs
@ 2016-01-26 10:31 Brian Starkey
  2016-01-26 20:45 ` Thomas Gleixner
  0 siblings, 1 reply; 17+ messages in thread
From: Brian Starkey @ 2016-01-26 10:31 UTC (permalink / raw)
  To: tglx; +Cc: linux-kernel, marc.zyngier

For shared interrupts, if one requester passes in any IRQF_TRIGGER_*
flags whilst another doesn't, __setup_irq() can erroneously fail.

The no-flags case should be treated as "already configured", so change
__setup_irq() to only check that the flags match if any have been
provided.

Signed-off-by: Brian Starkey <brian.starkey@arm.com>
Reviewed-by: Marc Zyngier <marc.zyngier@arm.com>
---

 kernel/irq/manage.c |   17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index a79d267..032c8fa 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -995,14 +995,10 @@ __setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new)
 	old = *old_ptr;
 	if (old) {
 		/*
-		 * Can't share interrupts unless both agree to and are
-		 * the same type (level, edge, polarity). So both flag
-		 * fields must have IRQF_SHARED set and the bits which
-		 * set the trigger type must match. Also all must
-		 * agree on ONESHOT.
+		 * Can't share interrupts unless both agree to and all
+		 * must agree on ONESHOT
 		 */
 		if (!((old->flags & new->flags) & IRQF_SHARED) ||
-		    ((old->flags ^ new->flags) & IRQF_TRIGGER_MASK) ||
 		    ((old->flags ^ new->flags) & IRQF_ONESHOT))
 			goto mismatch;
 
@@ -1014,6 +1010,15 @@ __setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new)
 		/* add new interrupt at end of irq queue */
 		do {
 			/*
+			 * If 'new' requests a trigger type it must match all
+			 * previously requested trigger types.
+			 */
+			if (((new->flags & IRQF_TRIGGER_MASK) &&
+			     (old->flags & IRQF_TRIGGER_MASK)) &&
+			    ((new->flags ^ old->flags) & IRQF_TRIGGER_MASK))
+				goto mismatch;
+
+			/*
 			 * Or all existing action->thread_mask bits,
 			 * so we can find the next zero bit for this
 			 * new action.
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2016-02-08 11:02 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-26 10:31 [PATCH] genirq: fix trigger flags check for shared irqs Brian Starkey
2016-01-26 20:45 ` Thomas Gleixner
2016-01-28  9:59   ` Brian Starkey
2016-01-28 10:29     ` Thomas Gleixner
2016-01-28 11:10       ` Brian Starkey
2016-01-28 11:49         ` Thomas Gleixner
2016-01-28 12:22           ` Brian Starkey
2016-01-28 12:22             ` Brian Starkey
2016-01-28 13:37             ` Thomas Gleixner
2016-01-28 13:37               ` Thomas Gleixner
2016-02-08 11:02               ` Brian Starkey
2016-02-08 11:02                 ` Brian Starkey
2016-01-28 15:58           ` Rob Herring
2016-01-28 15:58             ` Rob Herring
2016-01-28 20:06             ` Thomas Gleixner
2016-01-29  4:17               ` Tomasz Figa
2016-01-29  4:17                 ` Tomasz Figa

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.