From: "sasa sasa" <sasak.1983@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: "Thomas Gleixner" <tglx@linutronix.de>
Subject: [PATCH] IRQ : bug fix in setup_irq
Date: Tue, 22 Jul 2008 14:12:23 +0530 [thread overview]
Message-ID: <aecf5e530807220142k4d53aa7aq568385cfc6cd44a0@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1853 bytes --]
>From cf76c764e891a90ab0aaf322327e47e3a3302492 Mon Sep 17 00:00:00 2001
From: Sandeep Kaushik <sandeep-mmc.kaushik@st.com>
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 <sandeep-mmc.kaushik@st.com>
---
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
[-- Attachment #2: 0001-IRQ-bug-fix-in-setup_irq_new1.patch --]
[-- Type: application/octet-stream, Size: 1856 bytes --]
From cf76c764e891a90ab0aaf322327e47e3a3302492 Mon Sep 17 00:00:00 2001
From: Sandeep Kaushik <sandeep-mmc.kaushik@st.com>
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 <sandeep-mmc.kaushik@st.com>
---
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
next reply other threads:[~2008-07-22 8:42 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-22 8:42 sasa sasa [this message]
2008-07-22 11:23 ` Uwe Kleine-König
-- strict thread matches above, loose matches on Subject: below --
2008-07-18 10:21 sasa sasa
2008-07-18 22:18 ` Thomas Gleixner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aecf5e530807220142k4d53aa7aq568385cfc6cd44a0@mail.gmail.com \
--to=sasak.1983@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®