Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=5669c3cf19fbadaa9120b59914beec8431277efe
Commit:     5669c3cf19fbadaa9120b59914beec8431277efe
Parent:     88de3cab98ff6c794b840969427e61605d0cc1ea
Author:     Stephen Rothwell <[EMAIL PROTECTED]>
AuthorDate: Tue Oct 2 13:37:53 2007 +1000
Committer:  Paul Mackerras <[EMAIL PROTECTED]>
CommitDate: Wed Oct 3 11:48:44 2007 +1000

    [POWERPC] Limit range of __init_ref_ok somewhat
    
    This patch introduces zalloc_maybe_bootmem and uses it so that we don't
    have to mark a whole (largish) routine as __init_ref_ok.
    
    Signed-off-by: Stephen Rothwell <[EMAIL PROTECTED]>
    Signed-off-by: Paul Mackerras <[EMAIL PROTECTED]>
---
 arch/powerpc/kernel/irq.c    |   10 ++--------
 arch/powerpc/lib/alloc.c     |   15 +++++++++++++++
 include/asm-powerpc/system.h |    1 +
 3 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index 0e47c8c..151b131 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -424,7 +424,7 @@ static int default_irq_host_match(struct irq_host *h, 
struct device_node *np)
        return h->of_node != NULL && h->of_node == np;
 }
 
-__init_refok struct irq_host *irq_alloc_host(struct device_node *of_node,
+struct irq_host *irq_alloc_host(struct device_node *of_node,
                                unsigned int revmap_type,
                                unsigned int revmap_arg,
                                struct irq_host_ops *ops,
@@ -439,13 +439,7 @@ __init_refok struct irq_host *irq_alloc_host(struct 
device_node *of_node,
        /* Allocate structure and revmap table if using linear mapping */
        if (revmap_type == IRQ_HOST_MAP_LINEAR)
                size += revmap_arg * sizeof(unsigned int);
-       if (mem_init_done)
-               host = kzalloc(size, GFP_KERNEL);
-       else {
-               host = alloc_bootmem(size);
-               if (host)
-                       memset(host, 0, size);
-       }
+       host = zalloc_maybe_bootmem(size, GFP_KERNEL);
        if (host == NULL)
                return NULL;
 
diff --git a/arch/powerpc/lib/alloc.c b/arch/powerpc/lib/alloc.c
index e58c805..f53e09c 100644
--- a/arch/powerpc/lib/alloc.c
+++ b/arch/powerpc/lib/alloc.c
@@ -2,6 +2,7 @@
 #include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/bootmem.h>
+#include <linux/string.h>
 
 #include <asm/system.h>
 
@@ -12,3 +13,17 @@ void * __init_refok alloc_maybe_bootmem(size_t size, gfp_t 
mask)
        else
                return alloc_bootmem(size);
 }
+
+void * __init_refok zalloc_maybe_bootmem(size_t size, gfp_t mask)
+{
+       void *p;
+
+       if (mem_init_done)
+               p = kzalloc(size, mask);
+       else {
+               p = alloc_bootmem(size);
+               if (p)
+                       memset(p, 0, size);
+       }
+       return p;
+}
diff --git a/include/asm-powerpc/system.h b/include/asm-powerpc/system.h
index f7879fc..d10e99b 100644
--- a/include/asm-powerpc/system.h
+++ b/include/asm-powerpc/system.h
@@ -190,6 +190,7 @@ extern unsigned long memory_limit;
 extern unsigned long klimit;
 
 extern void *alloc_maybe_bootmem(size_t size, gfp_t mask);
+extern void *zalloc_maybe_bootmem(size_t size, gfp_t mask);
 
 extern int powersave_nap;      /* set if nap mode can be used in idle loop */
 
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to