Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powerpc: Drop zalloc_maybe_bootmem()

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

+3 -27
-1
arch/powerpc/include/asm/setup.h
··· 8 8 extern void ppc_printk_progress(char *s, unsigned short hex); 9 9 10 10 extern unsigned long long memory_limit; 11 - extern void *zalloc_maybe_bootmem(size_t size, gfp_t mask); 12 11 13 12 struct device_node; 14 13
+1 -1
arch/powerpc/kernel/pci-common.c
··· 125 125 { 126 126 struct pci_controller *phb; 127 127 128 - phb = zalloc_maybe_bootmem(sizeof(struct pci_controller), GFP_KERNEL); 128 + phb = kzalloc(sizeof(struct pci_controller), GFP_KERNEL); 129 129 if (phb == NULL) 130 130 return NULL; 131 131
+1 -1
arch/powerpc/lib/Makefile
··· 27 27 CFLAGS_code-patching.o += $(DISABLE_LATENT_ENTROPY_PLUGIN) 28 28 CFLAGS_feature-fixups.o += $(DISABLE_LATENT_ENTROPY_PLUGIN) 29 29 30 - obj-y += alloc.o code-patching.o feature-fixups.o pmem.o 30 + obj-y += code-patching.o feature-fixups.o pmem.o 31 31 32 32 obj-$(CONFIG_CODE_PATCHING_SELFTEST) += test-code-patching.o 33 33
-23
arch/powerpc/lib/alloc.c
··· 1 - // SPDX-License-Identifier: GPL-2.0 2 - #include <linux/types.h> 3 - #include <linux/init.h> 4 - #include <linux/slab.h> 5 - #include <linux/memblock.h> 6 - #include <linux/string.h> 7 - #include <asm/setup.h> 8 - 9 - 10 - void * __ref zalloc_maybe_bootmem(size_t size, gfp_t mask) 11 - { 12 - void *p; 13 - 14 - if (slab_is_available()) 15 - p = kzalloc(size, mask); 16 - else { 17 - p = memblock_alloc(size, SMP_CACHE_BYTES); 18 - if (!p) 19 - panic("%s: Failed to allocate %zu bytes\n", __func__, 20 - size); 21 - } 22 - return p; 23 - }
+1 -1
arch/powerpc/sysdev/fsl_pci.c
··· 767 767 u32 cfg_bar; 768 768 int ret = -ENOMEM; 769 769 770 - pcie = zalloc_maybe_bootmem(sizeof(*pcie), GFP_KERNEL); 770 + pcie = kzalloc(sizeof(*pcie), GFP_KERNEL); 771 771 if (!pcie) 772 772 return ret; 773 773