linux-sh.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 05/10] irq: allow free_irq() after setup_irq()
@ 2008-12-01 10:33 Magnus Damm
  0 siblings, 0 replies; only message in thread
From: Magnus Damm @ 2008-12-01 10:33 UTC (permalink / raw)
  To: linux-sh

From: Magnus Damm <damm@igel.co.jp>

This patch adds support for using free_irq() on interrupts
allocated with setup_irq(). Without this patch the kernel
will try to kfree() the struct irqaction passed as argument
to setup_irq().

Signed-off-by: Magnus Damm <damm@igel.co.jp>
---

 include/linux/interrupt.h |    2 ++
 kernel/irq/manage.c       |    4 +++-
 2 files changed, 5 insertions(+), 1 deletion(-)

--- 0001/include/linux/interrupt.h
+++ work/include/linux/interrupt.h	2008-11-25 19:43:40.000000000 +0900
@@ -48,6 +48,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_STATIC - Interrupt requested with setup_irq(), do not kfree().
  */
 #define IRQF_DISABLED		0x00000020
 #define IRQF_SAMPLE_RANDOM	0x00000040
@@ -57,6 +58,7 @@
 #define IRQF_PERCPU		0x00000400
 #define IRQF_NOBALANCING	0x00000800
 #define IRQF_IRQPOLL		0x00001000
+#define IRQF_STATIC		0x00002000
 
 typedef irqreturn_t (*irq_handler_t)(int, void *);
 
--- 0001/kernel/irq/manage.c
+++ work/kernel/irq/manage.c	2008-11-25 19:44:14.000000000 +0900
@@ -509,6 +509,7 @@ int setup_irq(unsigned int irq, struct i
 {
 	struct irq_desc *desc = irq_to_desc(irq);
 
+	act->flags |= IRQF_STATIC;
 	return __setup_irq(irq, desc, act);
 }
 
@@ -585,7 +586,8 @@ void free_irq(unsigned int irq, void *de
 				local_irq_restore(flags);
 			}
 #endif
-			kfree(action);
+			if (!(action->flags & IRQF_STATIC))
+				kfree(action);
 			return;
 		}
 		printk(KERN_ERR "Trying to free already-free IRQ %d\n", irq);

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

only message in thread, other threads:[~2008-12-01 10:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-01 10:33 [PATCH 05/10] irq: allow free_irq() after setup_irq() Magnus Damm

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).