diff options
-rw-r--r-- | arch/powerpc/kernel/irq.c | 10 | ||||
-rw-r--r-- | arch/powerpc/lib/alloc.c | 15 | ||||
-rw-r--r-- | 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 0e47c8cfc979..151b13119208 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) | |||
424 | return h->of_node != NULL && h->of_node == np; | 424 | return h->of_node != NULL && h->of_node == np; |
425 | } | 425 | } |
426 | 426 | ||
427 | __init_refok struct irq_host *irq_alloc_host(struct device_node *of_node, | 427 | struct irq_host *irq_alloc_host(struct device_node *of_node, |
428 | unsigned int revmap_type, | 428 | unsigned int revmap_type, |
429 | unsigned int revmap_arg, | 429 | unsigned int revmap_arg, |
430 | struct irq_host_ops *ops, | 430 | struct irq_host_ops *ops, |
@@ -439,13 +439,7 @@ __init_refok struct irq_host *irq_alloc_host(struct device_node *of_node, | |||
439 | /* Allocate structure and revmap table if using linear mapping */ | 439 | /* Allocate structure and revmap table if using linear mapping */ |
440 | if (revmap_type == IRQ_HOST_MAP_LINEAR) | 440 | if (revmap_type == IRQ_HOST_MAP_LINEAR) |
441 | size += revmap_arg * sizeof(unsigned int); | 441 | size += revmap_arg * sizeof(unsigned int); |
442 | if (mem_init_done) | 442 | host = zalloc_maybe_bootmem(size, GFP_KERNEL); |
443 | host = kzalloc(size, GFP_KERNEL); | ||
444 | else { | ||
445 | host = alloc_bootmem(size); | ||
446 | if (host) | ||
447 | memset(host, 0, size); | ||
448 | } | ||
449 | if (host == NULL) | 443 | if (host == NULL) |
450 | return NULL; | 444 | return NULL; |
451 | 445 | ||
diff --git a/arch/powerpc/lib/alloc.c b/arch/powerpc/lib/alloc.c index e58c80590ebc..f53e09c7dac7 100644 --- a/arch/powerpc/lib/alloc.c +++ b/arch/powerpc/lib/alloc.c | |||
@@ -2,6 +2,7 @@ | |||
2 | #include <linux/init.h> | 2 | #include <linux/init.h> |
3 | #include <linux/slab.h> | 3 | #include <linux/slab.h> |
4 | #include <linux/bootmem.h> | 4 | #include <linux/bootmem.h> |
5 | #include <linux/string.h> | ||
5 | 6 | ||
6 | #include <asm/system.h> | 7 | #include <asm/system.h> |
7 | 8 | ||
@@ -12,3 +13,17 @@ void * __init_refok alloc_maybe_bootmem(size_t size, gfp_t mask) | |||
12 | else | 13 | else |
13 | return alloc_bootmem(size); | 14 | return alloc_bootmem(size); |
14 | } | 15 | } |
16 | |||
17 | void * __init_refok zalloc_maybe_bootmem(size_t size, gfp_t mask) | ||
18 | { | ||
19 | void *p; | ||
20 | |||
21 | if (mem_init_done) | ||
22 | p = kzalloc(size, mask); | ||
23 | else { | ||
24 | p = alloc_bootmem(size); | ||
25 | if (p) | ||
26 | memset(p, 0, size); | ||
27 | } | ||
28 | return p; | ||
29 | } | ||
diff --git a/include/asm-powerpc/system.h b/include/asm-powerpc/system.h index f7879fc530f1..d10e99bf5001 100644 --- a/include/asm-powerpc/system.h +++ b/include/asm-powerpc/system.h | |||
@@ -190,6 +190,7 @@ extern unsigned long memory_limit; | |||
190 | extern unsigned long klimit; | 190 | extern unsigned long klimit; |
191 | 191 | ||
192 | extern void *alloc_maybe_bootmem(size_t size, gfp_t mask); | 192 | extern void *alloc_maybe_bootmem(size_t size, gfp_t mask); |
193 | extern void *zalloc_maybe_bootmem(size_t size, gfp_t mask); | ||
193 | 194 | ||
194 | extern int powersave_nap; /* set if nap mode can be used in idle loop */ | 195 | extern int powersave_nap; /* set if nap mode can be used in idle loop */ |
195 | 196 | ||