linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] Add irq_free_host() to free an irq_host
@ 2008-05-08  4:23 Michael Ellerman
  2008-05-08  4:23 ` [PATCH 2/2] Fix irq_alloc_host() reference counting and callers Michael Ellerman
  2008-05-15  6:55 ` [PATCH 1/2] Add irq_free_host() to free an irq_host Benjamin Herrenschmidt
  0 siblings, 2 replies; 6+ messages in thread
From: Michael Ellerman @ 2008-05-08  4:23 UTC (permalink / raw)
  To: linuxppc-dev

Currently there is no irq_free_host() routine, and that's
more or less OK - because all you need to do is free it.
However the next patch needs to introduce additional
tear down so we'll need a proper free routine.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---
 arch/powerpc/kernel/irq.c |   15 ++++++++-------
 include/asm-powerpc/irq.h |    8 ++++++++
 2 files changed, 16 insertions(+), 7 deletions(-)


ps.  This is 27 material.

diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index 2f73f70..8ba8fbf 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -442,6 +442,13 @@ static int default_irq_host_match(struct irq_host *h, struct device_node *np)
 	return h->of_node != NULL && h->of_node == np;
 }
 
+void irq_free_host(struct irq_host *host)
+{
+	/* If it's still very early in boot we can't free, oh well. */
+	if (mem_init_done)
+		kfree(host);
+}
+
 struct irq_host *irq_alloc_host(struct device_node *of_node,
 				unsigned int revmap_type,
 				unsigned int revmap_arg,
@@ -478,13 +485,7 @@ struct irq_host *irq_alloc_host(struct device_node *of_node,
 	if (revmap_type == IRQ_HOST_MAP_LEGACY) {
 		if (irq_map[0].host != NULL) {
 			spin_unlock_irqrestore(&irq_big_lock, flags);
-			/* If we are early boot, we can't free the structure,
-			 * too bad...
-			 * this will be fixed once slab is made available early
-			 * instead of the current cruft
-			 */
-			if (mem_init_done)
-				kfree(host);
+			irq_free_host(host);
 			return NULL;
 		}
 		irq_map[0].host = host;
diff --git a/include/asm-powerpc/irq.h b/include/asm-powerpc/irq.h
index 5089deb..7d9974a 100644
--- a/include/asm-powerpc/irq.h
+++ b/include/asm-powerpc/irq.h
@@ -165,6 +165,14 @@ extern struct irq_host *irq_alloc_host(struct device_node *of_node,
 				       struct irq_host_ops *ops,
 				       irq_hw_number_t inval_irq);
 
+/**
+ * irq_free_host - Free an irq_host data structure
+ * @host: The irq_host to free.
+ *
+ * Does any required cleanup and then frees the irq_host.
+ */
+extern void irq_free_host(struct irq_host *host);
+
 
 /**
  * irq_find_host - Locates a host for a given device node
-- 
1.5.5

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-05-15  7:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-08  4:23 [PATCH 1/2] Add irq_free_host() to free an irq_host Michael Ellerman
2008-05-08  4:23 ` [PATCH 2/2] Fix irq_alloc_host() reference counting and callers Michael Ellerman
2008-05-13 10:58   ` Paul Mackerras
2008-05-13 11:49     ` Michael Ellerman
2008-05-15  6:55 ` [PATCH 1/2] Add irq_free_host() to free an irq_host Benjamin Herrenschmidt
2008-05-15  7:00   ` Michael Ellerman

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).