From: Thomas Gleixner <tglx@linutronix.de>
To: Magnus Damm <magnus.damm@gmail.com>
Cc: linux-kernel@vger.kernel.org, lethal@linux-sh.org, mingo@elte.hu,
akpm@linux-foundation.org
Subject: Re: [PATCH] Free setup_irq() interrupt V2
Date: Tue, 10 Mar 2009 15:26:28 +0100 (CET) [thread overview]
Message-ID: <alpine.LFD.2.00.0903101510040.29264@localhost.localdomain> (raw)
In-Reply-To: <20090310102459.23422.80761.sendpatchset@rx1.opensource.se>
Magnus,
On Tue, 10 Mar 2009, Magnus Damm wrote:
> From: Magnus Damm <damm@igel.co.jp>
> This patch adds a __free_irq() function for releasing
> interrupts requested with setup_irq().
I think there is a simpler solution than adding yet another function
for the confusion of driver writers. See below.
> Why again are we not using struct list_head for the irqaction list?
Why should we ? The add/remove of interrupt handlers is not a high
frequency hot path operation.
Thanks,
tglx
--------
Subject: genirq: make free_irq() aware of static irqactions
From: Thomas Gleixner <tglx@linutronix.de>
Date: Tue, 10 Mar 2009 15:00:59 +0100
Impact: enhancement
Interrupts which are set up via setup_irq() with a static irqaction
can not be released via free_irq(). The irqs set up via request_irq()
use a kmalloc'ed irqaction. Mark them as allocated in irqaction->flags
and check the flag in free_irq().
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
include/linux/interrupt.h | 2 ++
kernel/irq/manage.c | 5 +++--
2 files changed, 5 insertions(+), 2 deletions(-)
Index: linux-2.6/include/linux/interrupt.h
===================================================================
--- linux-2.6.orig/include/linux/interrupt.h
+++ linux-2.6/include/linux/interrupt.h
@@ -49,6 +49,7 @@
* IRQF_IRQPOLL - Interrupt is used for polling (only the interrupt that is
* registered first in an shared interrupt is considered for
* performance reasons)
+ * IRQF_ALLOCATED - Mark the irqaction as allocated by request_irq
*/
#define IRQF_DISABLED 0x00000020
#define IRQF_SAMPLE_RANDOM 0x00000040
@@ -58,6 +59,7 @@
#define IRQF_PERCPU 0x00000400
#define IRQF_NOBALANCING 0x00000800
#define IRQF_IRQPOLL 0x00001000
+#define IRQF_ALLOCATED 0x00002000
typedef irqreturn_t (*irq_handler_t)(int, void *);
Index: linux-2.6/kernel/irq/manage.c
===================================================================
--- linux-2.6.orig/kernel/irq/manage.c
+++ linux-2.6/kernel/irq/manage.c
@@ -623,7 +623,8 @@ void free_irq(unsigned int irq, void *de
local_irq_restore(flags);
}
#endif
- kfree(action);
+ if (action->flags & IRQF_ALLOCATED)
+ kfree(action);
return;
}
printk(KERN_ERR "Trying to free already-free IRQ %d\n", irq);
@@ -714,7 +715,7 @@ int request_irq(unsigned int irq, irq_ha
return -ENOMEM;
action->handler = handler;
- action->flags = irqflags;
+ action->flags = irqflags | IRQF_ALLOCATED;
cpus_clear(action->mask);
action->name = devname;
action->next = NULL;
next prev parent reply other threads:[~2009-03-10 14:27 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-10 10:24 Magnus Damm
2009-03-10 12:41 ` Ingo Molnar
2009-03-10 14:26 ` Thomas Gleixner [this message]
2009-03-10 15:04 ` Ingo Molnar
2009-03-10 15:26 ` Thomas Gleixner
2009-03-10 15:33 ` Ingo Molnar
2009-03-11 2:32 ` Magnus Damm
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=alpine.LFD.2.00.0903101510040.29264@localhost.localdomain \
--to=tglx@linutronix.de \
--cc=akpm@linux-foundation.org \
--cc=lethal@linux-sh.org \
--cc=linux-kernel@vger.kernel.org \
--cc=magnus.damm@gmail.com \
--cc=mingo@elte.hu \
/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®