powerpc: Don't use alloc_bootmem() in init_IRQ() path
authorAnton Vorontsov <avorontsov@ru.mvista.com>
Wed, 1 Jul 2009 10:59:57 +0000 (10:59 +0000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Wed, 8 Jul 2009 03:50:25 +0000 (13:50 +1000)
This patch fixes various badnesses like this for all interrupt
controllers:

------------[ cut here ]------------
Badness at c04db9dc [verbose debug info unavailable]
NIP: c04db9dc LR: c04db9ac CTR: 00000000
REGS: c053de30 TRAP: 0700   Not tainted  (2.6.31-rc1-00432-ge69b2b5-dirty)
MSR: 00021000 <ME,CE>  CR: 22020084  XER: 00000000
TASK = c0500480[0] 'swapper' THREAD: c053c000
GPR00: 00000001 c053dee0 c0500480 00000000 00000050 00000020 3fffffff 00000000
GPR08: 00000001 c0540000 e0080080 00000000 22000084 64183600 3ff8f800 00000000
GPR16: 841b0240 449a0303 00000000 00000000 00000000 00000000 00000000 c04f5bf4
GPR24: 00000000 00000000 00000000 00000050 00000020 00000000 3fffffff 00000050
NIP [c04db9dc] alloc_arch_preferred_bootmem+0x48/0x74
LR [c04db9ac] alloc_arch_preferred_bootmem+0x18/0x74
Call Trace:
[c053dee0] [c000a5a4] __of_address_to_resource+0x44/0xd0 (unreliable)
[c053def0] [c04dba58] ___alloc_bootmem_nopanic+0x50/0x108
[c053df20] [c04dbb28] ___alloc_bootmem+0x18/0x50
[c053df30] [c04d5de0] qe_ic_init+0x5c/0x1b0
[c053df70] [c04d77b0] mpc85xx_mds_pic_init+0xb8/0x10c
[c053dfb0] [c04cf374] init_IRQ+0x28/0x3c

p.s. commit 85355bb272db31a3f2dd99d547eef794805e1319 ("powerpc: Fix
mpic alloc warning") missed some alloc_bootmem() instances, this is
now fixed.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Acked-by: Timur Tabi <timur@freescale.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/platforms/82xx/pq2ads-pci-pic.c
arch/powerpc/sysdev/ipic.c
arch/powerpc/sysdev/mpic.c
arch/powerpc/sysdev/qe_lib/qe_ic.c
arch/powerpc/sysdev/uic.c

index ddf0bdc0fc8ba1a6845fb283a5330d21ab0701ce..7ee979f323d18c2da64e8597973bba0823ed1e8b 100644 (file)
@@ -147,7 +147,7 @@ int __init pq2ads_pci_init_irq(void)
                goto out;
        }
 
-       priv = alloc_bootmem(sizeof(struct pq2ads_pci_pic));
+       priv = kzalloc(sizeof(*priv), GFP_KERNEL);
        if (!priv) {
                of_node_put(np);
                ret = -ENOMEM;
index a86d3ce01ead98293dcb0e28a14bf943163b40a2..69e2630c90624cf40690d0ecfd7643a75e1d4bf5 100644 (file)
@@ -728,12 +728,10 @@ struct ipic * __init ipic_init(struct device_node *node, unsigned int flags)
        if (ret)
                return NULL;
 
-       ipic = alloc_bootmem(sizeof(struct ipic));
+       ipic = kzalloc(sizeof(*ipic), GFP_KERNEL);
        if (ipic == NULL)
                return NULL;
 
-       memset(ipic, 0, sizeof(struct ipic));
-
        ipic->irqhost = irq_alloc_host(node, IRQ_HOST_MAP_LINEAR,
                                       NR_IPIC_INTS,
                                       &ipic_host_ops, 0);
index d46de1f0f3eed445a872ba2e98884469e5dd8468..3981ae4cb58e7f3f41fb7ffa25e9a4757bed3d6f 100644 (file)
@@ -508,9 +508,8 @@ static void __init mpic_scan_ht_pics(struct mpic *mpic)
        printk(KERN_INFO "mpic: Setting up HT PICs workarounds for U3/U4\n");
 
        /* Allocate fixups array */
-       mpic->fixups = alloc_bootmem(128 * sizeof(struct mpic_irq_fixup));
+       mpic->fixups = kzalloc(128 * sizeof(*mpic->fixups), GFP_KERNEL);
        BUG_ON(mpic->fixups == NULL);
-       memset(mpic->fixups, 0, 128 * sizeof(struct mpic_irq_fixup));
 
        /* Init spinlock */
        spin_lock_init(&mpic->fixup_lock);
@@ -1109,9 +1108,8 @@ struct mpic * __init mpic_alloc(struct device_node *node,
                        psize /= 4;
                        bits = intvec_top + 1;
                        mapsize = BITS_TO_LONGS(bits) * sizeof(unsigned long);
-                       mpic->protected = alloc_bootmem(mapsize);
+                       mpic->protected = kzalloc(mapsize, GFP_KERNEL);
                        BUG_ON(mpic->protected == NULL);
-                       memset(mpic->protected, 0, mapsize);
                        for (i = 0; i < psize; i++) {
                                if (psrc[i] > intvec_top)
                                        continue;
@@ -1353,7 +1351,8 @@ void __init mpic_init(struct mpic *mpic)
 
 #ifdef CONFIG_PM
        /* allocate memory to save mpic state */
-       mpic->save_data = alloc_bootmem(mpic->num_sources * sizeof(struct mpic_irq_save));
+       mpic->save_data = kmalloc(mpic->num_sources * sizeof(*mpic->save_data),
+                                 GFP_KERNEL);
        BUG_ON(mpic->save_data == NULL);
 #endif
 }
index 63cdf9887f3672dd4e16310b591b91d564de20bd..074905c3ee5a94d80fb3e0daa86e88b8f77f9650 100644 (file)
@@ -333,12 +333,10 @@ void __init qe_ic_init(struct device_node *node, unsigned int flags,
        if (ret)
                return;
 
-       qe_ic = alloc_bootmem(sizeof(struct qe_ic));
+       qe_ic = kzalloc(sizeof(*qe_ic), GFP_KERNEL);
        if (qe_ic == NULL)
                return;
 
-       memset(qe_ic, 0, sizeof(struct qe_ic));
-
        qe_ic->irqhost = irq_alloc_host(node, IRQ_HOST_MAP_LINEAR,
                                        NR_QE_IC_INTS, &qe_ic_host_ops, 0);
        if (qe_ic->irqhost == NULL)
index d35405c5943482c86efea86739099ed8c2f3da1e..466ce9ace1270ec881a4ae2f18e92a70648af40b 100644 (file)
@@ -258,11 +258,10 @@ static struct uic * __init uic_init_one(struct device_node *node)
 
        BUG_ON(! of_device_is_compatible(node, "ibm,uic"));
 
-       uic = alloc_bootmem(sizeof(*uic));
+       uic = kzalloc(sizeof(*uic), GFP_KERNEL);
        if (! uic)
                return NULL; /* FIXME: panic? */
 
-       memset(uic, 0, sizeof(*uic));
        spin_lock_init(&uic->lock);
        indexp = of_get_property(node, "cell-index", &len);
        if (!indexp || (len != sizeof(u32))) {