[PATCH] IRQ : bug fix in setup_irq
From: Sandeep Kaushik
Date: Tue Jul 22 2008 - 03:50:51 EST
This patch is for bug fix in setup_irq function.
Error handling is added in setup_irq function. This is required in case if some
architecture dependent pin's set_type function returned error.
Signed-off-by: Sandeep Kaushik <sandeep-mmc.kaushik@xxxxxx>
---
kernel/irq/manage.c | 24 ++++++++++++++++++++----
1 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index 1f31422..a90ed1c 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -339,6 +339,8 @@ int setup_irq(unsigned int irq, struct irqaction *new)
desc->status |= IRQ_NO_BALANCING;
if (!shared) {
+ int trigger_type;
+
irq_chip_set_defaults(desc->chip);
#if defined(CONFIG_IRQ_PER_CPU)
@@ -346,11 +348,25 @@ int setup_irq(unsigned int irq, struct irqaction *new)
desc->status |= IRQ_PER_CPU;
#endif
+ trigger_type = new->flags & IRQF_TRIGGER_MASK;
+
/* Setup the type (level, edge polarity) if configured: */
- if (new->flags & IRQF_TRIGGER_MASK) {
- if (desc->chip && desc->chip->set_type)
- desc->chip->set_type(irq,
- new->flags & IRQF_TRIGGER_MASK);
+ if (trigger_type) {
+ if (desc->chip && desc->chip->set_type) {
+ if ((desc->chip->set_type(irq, trigger_type))) {
+ printk(KERN_ERR "IRQF_TRIGGER set_type"
+ "function for IRQ"
+ "%d (%s) failed\n",
+ irq, desc->chip->name);
+ /*
+ * Action handler gets freed but
+ * last action handler on desc->action
+ * list also needs to bet to NULL.
+ */
+ *p = NULL;
+ goto mismatch;
+ }
+ }
else
/*
* IRQF_TRIGGER_* but the PIC does not support
--
1.5.6.GIT
------=_Part_83119_21041192.1216716144076
Content-Type: application/octet-stream;
name=0001-IRQ-bug-fix-in-setup_irq_new1.patch
Content-Transfer-Encoding: base64
X-Attachment-Id: f_fiy9awmf0
Content-Disposition: attachment;
filename=0001-IRQ-bug-fix-in-setup_irq_new1.patch
RnJvbSB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m5hbWUpOworCQkJCQkvKgorCQkJCQkgKiBB
Y3Rpb24gaGFuZGxlciBnZXRzIGZyZWVkIGJ1dAorCQkJCQkgKiBsYXN0IGFjdGlvbiBoYW5kbGVy
IG9uIGRlc2MtPmFjdGlvbgorCQkJCQkgKiBsaXN0IGFsc28gbmVlZHMgdG8gYmV0IHRvIE5VTEwu
CisJCQkJCSAqLworCQkJCQkqcCA9IE5VTEw7CisJCQkJCWdvdG8gbWlzbWF0Y2g7CisJCQkJfQor
CQkJfQogCQkJZWxzZQogCQkJCS8qCiAJCQkJICogSVJRRl9UUklHR0VSXyogYnV0IHRoZSBQSUMg
ZG9lcyBub3Qgc3VwcG9ydAotLSAKMS41LjYuR0lUCgo=
------=_Part_83119_21041192.1216716144076--
--
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/