mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [patch 2.6.28-rc2] genirq:  record IRQ_LEVEL in irq_desc[]
@ 2008-10-27 20:55 David Brownell
  0 siblings, 0 replies; only message in thread
From: David Brownell @ 2008-10-27 20:55 UTC (permalink / raw)
  To: lkml; +Cc: Thomas Gleixner, Ingo Molnar

From: David Brownell <dbrownell@users.sourceforge.net>

When recording the irq trigger type, let's also make sure
that IRQ_LEVEL gets set correctly.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
---
So long as IRQ_LEVEL exists and is used through enable_irq() and
setup_irq(), I suspect it should get set correctly!  However, now
that we record IRQ_TYPE_LEVEL_* maybe IRQ_LEVEL should vanish...

 kernel/irq/chip.c   |    1 +
 kernel/irq/manage.c |   15 +++++++++------
 2 files changed, 10 insertions(+), 6 deletions(-)

--- a/kernel/irq/chip.c
+++ b/kernel/irq/chip.c
@@ -124,6 +124,7 @@ int set_irq_type(unsigned int irq, unsig
 		return -ENODEV;
 	}
 
+	type &= IRQ_TYPE_SENSE_MASK;
 	if (type == IRQ_TYPE_NONE)
 		return 0;
 
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -332,16 +332,18 @@ int __irq_set_trigger(struct irq_desc *d
 		return 0;
 	}
 
-	ret = chip->set_type(irq, flags & IRQF_TRIGGER_MASK);
+	/* caller masked out all except trigger mode flags */
+	ret = chip->set_type(irq, flags);
 
 	if (ret)
 		pr_err("setting trigger mode %d for irq %u failed (%pF)\n",
-				(int)(flags & IRQF_TRIGGER_MASK),
-				irq, chip->set_type);
+				(int)flags, irq, chip->set_type);
 	else {
+		if (flags & (IRQ_TYPE_LEVEL_LOW | IRQ_TYPE_LEVEL_HIGH))
+			flags |= IRQ_LEVEL;
 		/* note that IRQF_TRIGGER_MASK == IRQ_TYPE_SENSE_MASK */
-		desc->status &= ~IRQ_TYPE_SENSE_MASK;
-		desc->status |= flags & IRQ_TYPE_SENSE_MASK;
+		desc->status &= ~(IRQ_LEVEL | IRQ_TYPE_SENSE_MASK);
+		desc->status |= flags;
 	}
 
 	return ret;
@@ -421,7 +423,8 @@ __setup_irq(unsigned int irq, struct irq
 
 		/* Setup the type (level, edge polarity) if configured: */
 		if (new->flags & IRQF_TRIGGER_MASK) {
-			ret = __irq_set_trigger(desc, irq, new->flags);
+			ret = __irq_set_trigger(desc, irq,
+					new->flags & IRQF_TRIGGER_MASK);
 
 			if (ret) {
 				spin_unlock_irqrestore(&desc->lock, flags);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-10-27 21:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-27 20:55 [patch 2.6.28-rc2] genirq: record IRQ_LEVEL in irq_desc[] David Brownell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome