aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Rothwell <sfr@canb.auug.org.au>2007-09-17 00:08:06 -0400
committerPaul Mackerras <paulus@samba.org>2007-09-19 01:25:34 -0400
commit7b2c3c5b1d6dd77d7bb5a7d57ab7280e051c59bc (patch)
tree30fc4b8515f3838973386697e55647079a6921fa
parentee983079ce04641523b23b8ed02cc3503632351e (diff)
[POWERPC] Fix section mismatch in PCI code
Create a helper function (alloc_maybe_bootmem) that is marked __init_refok to limit the chances of mistakenly referring to other __init routines. WARNING: vmlinux.o(.text+0x2a9c4): Section mismatch: reference to .init.text:.__alloc_bootmem (between '.update_dn_pci_info' and '.pci_dn_reconfig_notifier') WARNING: vmlinux.o(.text+0x36430): Section mismatch: reference to .init.text:.__alloc_bootmem (between '.mpic_msi_init_allocator' and '.find_ht_magic_addr') WARNING: vmlinux.o(.text+0x5e804): Section mismatch: reference to .init.text:.__alloc_bootmem (between '.celleb_setup_phb' and '.celleb_fake_pci_write_config') WARNING: vmlinux.o(.text+0x5e8e8): Section mismatch: reference to .init.text:.__alloc_bootmem (between '.celleb_setup_phb' and '.celleb_fake_pci_write_config') WARNING: vmlinux.o(.text+0x5e968): Section mismatch: reference to .init.text:.__alloc_bootmem (between '.celleb_setup_phb' and '.celleb_fake_pci_write_config') Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Paul Mackerras <paulus@samba.org>
-rw-r--r--arch/powerpc/kernel/pci_dn.c7
-rw-r--r--arch/powerpc/lib/Makefile2
-rw-r--r--arch/powerpc/lib/alloc.c14
-rw-r--r--arch/powerpc/platforms/celleb/pci.c19
-rw-r--r--arch/powerpc/sysdev/mpic_msi.c6
-rw-r--r--include/asm-powerpc/system.h2
6 files changed, 24 insertions, 26 deletions
diff --git a/arch/powerpc/kernel/pci_dn.c b/arch/powerpc/kernel/pci_dn.c
index d7d36df9c053..b4839038613d 100644
--- a/arch/powerpc/kernel/pci_dn.c
+++ b/arch/powerpc/kernel/pci_dn.c
@@ -23,8 +23,6 @@
23#include <linux/pci.h> 23#include <linux/pci.h>
24#include <linux/string.h> 24#include <linux/string.h>
25#include <linux/init.h> 25#include <linux/init.h>
26#include <linux/slab.h>
27#include <linux/bootmem.h>
28 26
29#include <asm/io.h> 27#include <asm/io.h>
30#include <asm/prom.h> 28#include <asm/prom.h>
@@ -45,10 +43,7 @@ static void * __devinit update_dn_pci_info(struct device_node *dn, void *data)
45 const u32 *regs; 43 const u32 *regs;
46 struct pci_dn *pdn; 44 struct pci_dn *pdn;
47 45
48 if (mem_init_done) 46 pdn = alloc_maybe_bootmem(sizeof(*pdn), GFP_KERNEL);
49 pdn = kmalloc(sizeof(*pdn), GFP_KERNEL);
50 else
51 pdn = alloc_bootmem(sizeof(*pdn));
52 if (pdn == NULL) 47 if (pdn == NULL)
53 return NULL; 48 return NULL;
54 memset(pdn, 0, sizeof(*pdn)); 49 memset(pdn, 0, sizeof(*pdn));
diff --git a/arch/powerpc/lib/Makefile b/arch/powerpc/lib/Makefile
index 0a486d4b2547..23bbb1ea7f9f 100644
--- a/arch/powerpc/lib/Makefile
+++ b/arch/powerpc/lib/Makefile
@@ -7,7 +7,7 @@ EXTRA_CFLAGS += -mno-minimal-toc
7endif 7endif
8 8
9ifeq ($(CONFIG_PPC_MERGE),y) 9ifeq ($(CONFIG_PPC_MERGE),y)
10obj-y := string.o 10obj-y := string.o alloc.o
11obj-$(CONFIG_PPC32) += div64.o copy_32.o checksum_32.o 11obj-$(CONFIG_PPC32) += div64.o copy_32.o checksum_32.o
12endif 12endif
13 13
diff --git a/arch/powerpc/lib/alloc.c b/arch/powerpc/lib/alloc.c
new file mode 100644
index 000000000000..e58c80590ebc
--- /dev/null
+++ b/arch/powerpc/lib/alloc.c
@@ -0,0 +1,14 @@
1#include <linux/types.h>
2#include <linux/init.h>
3#include <linux/slab.h>
4#include <linux/bootmem.h>
5
6#include <asm/system.h>
7
8void * __init_refok alloc_maybe_bootmem(size_t size, gfp_t mask)
9{
10 if (mem_init_done)
11 return kmalloc(size, mask);
12 else
13 return alloc_bootmem(size);
14}
diff --git a/arch/powerpc/platforms/celleb/pci.c b/arch/powerpc/platforms/celleb/pci.c
index 11336b40feca..1348b23cbbc9 100644
--- a/arch/powerpc/platforms/celleb/pci.c
+++ b/arch/powerpc/platforms/celleb/pci.c
@@ -327,10 +327,7 @@ static int __init celleb_setup_fake_pci_device(struct device_node *node,
327 327
328 size = 256; 328 size = 256;
329 config = &private->fake_config[devno][fn]; 329 config = &private->fake_config[devno][fn];
330 if (mem_init_done) 330 *config = alloc_maybe_bootmem(size, GFP_KERNEL);
331 *config = kzalloc(size, GFP_KERNEL);
332 else
333 *config = alloc_bootmem(size);
334 if (*config == NULL) { 331 if (*config == NULL) {
335 printk(KERN_ERR "PCI: " 332 printk(KERN_ERR "PCI: "
336 "not enough memory for fake configuration space\n"); 333 "not enough memory for fake configuration space\n");
@@ -341,10 +338,7 @@ static int __init celleb_setup_fake_pci_device(struct device_node *node,
341 338
342 size = sizeof(struct celleb_pci_resource); 339 size = sizeof(struct celleb_pci_resource);
343 res = &private->res[devno][fn]; 340 res = &private->res[devno][fn];
344 if (mem_init_done) 341 *res = alloc_maybe_bootmem(size, GFP_KERNEL);
345 *res = kzalloc(size, GFP_KERNEL);
346 else
347 *res = alloc_bootmem(size);
348 if (*res == NULL) { 342 if (*res == NULL) {
349 printk(KERN_ERR 343 printk(KERN_ERR
350 "PCI: not enough memory for resource data space\n"); 344 "PCI: not enough memory for resource data space\n");
@@ -436,12 +430,9 @@ static int __init phb_set_bus_ranges(struct device_node *dev,
436 430
437static void __init celleb_alloc_private_mem(struct pci_controller *hose) 431static void __init celleb_alloc_private_mem(struct pci_controller *hose)
438{ 432{
439 if (mem_init_done) 433 hose->private_data =
440 hose->private_data = 434 alloc_maybe_bootmem(sizeof(struct celleb_pci_private),
441 kzalloc(sizeof(struct celleb_pci_private), GFP_KERNEL); 435 GFP_KERNEL);
442 else
443 hose->private_data =
444 alloc_bootmem(sizeof(struct celleb_pci_private));
445} 436}
446 437
447int __init celleb_setup_phb(struct pci_controller *phb) 438int __init celleb_setup_phb(struct pci_controller *phb)
diff --git a/arch/powerpc/sysdev/mpic_msi.c b/arch/powerpc/sysdev/mpic_msi.c
index 9ca4d8f444ff..d272a52ecd24 100644
--- a/arch/powerpc/sysdev/mpic_msi.c
+++ b/arch/powerpc/sysdev/mpic_msi.c
@@ -9,7 +9,6 @@
9 */ 9 */
10 10
11#include <linux/irq.h> 11#include <linux/irq.h>
12#include <linux/bootmem.h>
13#include <linux/bitmap.h> 12#include <linux/bitmap.h>
14#include <linux/msi.h> 13#include <linux/msi.h>
15#include <asm/mpic.h> 14#include <asm/mpic.h>
@@ -152,10 +151,7 @@ int mpic_msi_init_allocator(struct mpic *mpic)
152 size = BITS_TO_LONGS(mpic->irq_count) * sizeof(long); 151 size = BITS_TO_LONGS(mpic->irq_count) * sizeof(long);
153 pr_debug("mpic: allocator bitmap size is 0x%x bytes\n", size); 152 pr_debug("mpic: allocator bitmap size is 0x%x bytes\n", size);
154 153
155 if (mem_init_done) 154 mpic->hwirq_bitmap = alloc_maybe_bootmem(size, GFP_KERNEL);
156 mpic->hwirq_bitmap = kmalloc(size, GFP_KERNEL);
157 else
158 mpic->hwirq_bitmap = alloc_bootmem(size);
159 155
160 if (!mpic->hwirq_bitmap) { 156 if (!mpic->hwirq_bitmap) {
161 pr_debug("mpic: ENOMEM allocating allocator bitmap!\n"); 157 pr_debug("mpic: ENOMEM allocating allocator bitmap!\n");
diff --git a/include/asm-powerpc/system.h b/include/asm-powerpc/system.h
index 41520b7a7b76..f7879fc530f1 100644
--- a/include/asm-powerpc/system.h
+++ b/include/asm-powerpc/system.h
@@ -189,6 +189,8 @@ extern int mem_init_done; /* set on boot once kmalloc can be called */
189extern unsigned long memory_limit; 189extern unsigned long memory_limit;
190extern unsigned long klimit; 190extern unsigned long klimit;
191 191
192extern void *alloc_maybe_bootmem(size_t size, gfp_t mask);
193
192extern int powersave_nap; /* set if nap mode can be used in idle loop */ 194extern int powersave_nap; /* set if nap mode can be used in idle loop */
193 195
194/* 196/*