OSDN Git Service

powerpc: Drop zalloc_maybe_bootmem()
authorMichael Ellerman <mpe@ellerman.id.au>
Wed, 23 Aug 2023 05:54:30 +0000 (15:54 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 24 Aug 2023 12:33:16 +0000 (22:33 +1000)
The only callers of zalloc_maybe_bootmem() are PCI setup routines. These
used to be called early during boot before slab setup, and also during
runtime due to hotplug.

But commit 5537fcb319d0 ("powerpc/pci: Add ppc_md.discover_phbs()")
moved the boot-time calls later, after slab setup, meaning there's no
longer any need for zalloc_maybe_bootmem(), kzalloc() can be used in all
cases.

Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20230823055430.752550-1-mpe@ellerman.id.au
arch/powerpc/include/asm/setup.h
arch/powerpc/kernel/pci-common.c
arch/powerpc/lib/Makefile
arch/powerpc/lib/alloc.c [deleted file]
arch/powerpc/sysdev/fsl_pci.c

index e29e83f..eed74c1 100644 (file)
@@ -8,7 +8,6 @@
 extern void ppc_printk_progress(char *s, unsigned short hex);
 
 extern unsigned long long memory_limit;
-extern void *zalloc_maybe_bootmem(size_t size, gfp_t mask);
 
 struct device_node;
 
index e88d7c9..040255d 100644 (file)
@@ -125,7 +125,7 @@ struct pci_controller *pcibios_alloc_controller(struct device_node *dev)
 {
        struct pci_controller *phb;
 
-       phb = zalloc_maybe_bootmem(sizeof(struct pci_controller), GFP_KERNEL);
+       phb = kzalloc(sizeof(struct pci_controller), GFP_KERNEL);
        if (phb == NULL)
                return NULL;
 
index 9aa8286..51ad039 100644 (file)
@@ -27,7 +27,7 @@ endif
 CFLAGS_code-patching.o += $(DISABLE_LATENT_ENTROPY_PLUGIN)
 CFLAGS_feature-fixups.o += $(DISABLE_LATENT_ENTROPY_PLUGIN)
 
-obj-y += alloc.o code-patching.o feature-fixups.o pmem.o
+obj-y += code-patching.o feature-fixups.o pmem.o
 
 obj-$(CONFIG_CODE_PATCHING_SELFTEST) += test-code-patching.o
 
diff --git a/arch/powerpc/lib/alloc.c b/arch/powerpc/lib/alloc.c
deleted file mode 100644 (file)
index ce18087..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-#include <linux/types.h>
-#include <linux/init.h>
-#include <linux/slab.h>
-#include <linux/memblock.h>
-#include <linux/string.h>
-#include <asm/setup.h>
-
-
-void * __ref zalloc_maybe_bootmem(size_t size, gfp_t mask)
-{
-       void *p;
-
-       if (slab_is_available())
-               p = kzalloc(size, mask);
-       else {
-               p = memblock_alloc(size, SMP_CACHE_BYTES);
-               if (!p)
-                       panic("%s: Failed to allocate %zu bytes\n", __func__,
-                             size);
-       }
-       return p;
-}
index 5f7219d..3868483 100644 (file)
@@ -767,7 +767,7 @@ static int __init mpc83xx_pcie_setup(struct pci_controller *hose,
        u32 cfg_bar;
        int ret = -ENOMEM;
 
-       pcie = zalloc_maybe_bootmem(sizeof(*pcie), GFP_KERNEL);
+       pcie = kzalloc(sizeof(*pcie), GFP_KERNEL);
        if (!pcie)
                return ret;