Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755877AbYGVIme (ORCPT ); Tue, 22 Jul 2008 04:42:34 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752687AbYGVIm0 (ORCPT ); Tue, 22 Jul 2008 04:42:26 -0400 Received: from rv-out-0506.google.com ([209.85.198.238]:52240 "EHLO rv-out-0506.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752660AbYGVImY (ORCPT ); Tue, 22 Jul 2008 04:42:24 -0400 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:mime-version:content-type; b=qFYLNUhqqSpZ38/W6r1sHNUqj5w4yINTYqE2q+gllxw9XVTUbm8uKdDJt7j9RVEurm jvq6ubw3s/IVyfzbcy23UBsy3ol5GDHKNPDET0/+v0y10FjpLaxHLlp5zuLlxpWUNfMa ULCejmfA7fnmUG6AqPIUc5HzdWPvuC8lUMY+A= Message-ID: Date: Tue, 22 Jul 2008 14:12:23 +0530 From: "sasa sasa" To: linux-kernel@vger.kernel.org Subject: [PATCH] IRQ : bug fix in setup_irq Cc: "Thomas Gleixner" MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_83119_21041192.1216716144076" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 5077 Lines: 112 ------=_Part_83119_21041192.1216716144076 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline >From cf76c764e891a90ab0aaf322327e47e3a3302492 Mon Sep 17 00:00:00 2001 From: Sandeep Kaushik Date: Tue, 22 Jul 2008 13:20:51 +0530 Subject: [PATCH] IRQ : bug fix in setup_irq 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 --- 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 RnJvbSBjZjc2Yzc2NGU4OTFhOTBhYjBhYWYzMjIzMjdlNDdlM2EzMzAyNDkyIE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBTYW5kZWVwIEthdXNoaWsgPHNhbmRlZXAtbW1jLmthdXNoaWtA c3QuY29tPgpEYXRlOiBUdWUsIDIyIEp1bCAyMDA4IDEzOjIwOjUxICswNTMwClN1YmplY3Q6IFtQ QVRDSF0gSVJRIDogYnVnIGZpeCBpbiBzZXR1cF9pcnE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JCQkJICogSVJRRl9UUklHR0VSXyogYnV0IHRoZSBQSUMg ZG9lcyBub3Qgc3VwcG9ydAotLSAKMS41LjYuR0lUCgo= ------=_Part_83119_21041192.1216716144076-- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/