memblock: use memblock_free for freeing virtual pointers
authorMike Rapoport <rppt@linux.ibm.com>
Fri, 5 Nov 2021 20:43:22 +0000 (13:43 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 6 Nov 2021 20:30:41 +0000 (13:30 -0700)
commit4421cca0a3e4833b3bf0f20de98eb580ab8c7290
tree82c77d76bbd854c45bb63746becc216d1b775fde
parent3ecc68349bbab6bff1d12cbc7951ca6019b2faf6
memblock: use memblock_free for freeing virtual pointers

Rename memblock_free_ptr() to memblock_free() and use memblock_free()
when freeing a virtual pointer so that memblock_free() will be a
counterpart of memblock_alloc()

The callers are updated with the below semantic patch and manual
addition of (void *) casting to pointers that are represented by
unsigned long variables.

    @@
    identifier vaddr;
    expression size;
    @@
    (
    - memblock_phys_free(__pa(vaddr), size);
    + memblock_free(vaddr, size);
    |
    - memblock_free_ptr(vaddr, size);
    + memblock_free(vaddr, size);
    )

[sfr@canb.auug.org.au: fixup]
Link: https://lkml.kernel.org/r/20211018192940.3d1d532f@canb.auug.org.au
Link: https://lkml.kernel.org/r/20210930185031.18648-7-rppt@kernel.org
Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: Juergen Gross <jgross@suse.com>
Cc: Shahab Vahedi <Shahab.Vahedi@synopsys.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
29 files changed:
arch/alpha/kernel/core_irongate.c
arch/mips/mm/init.c
arch/powerpc/kernel/dt_cpu_ftrs.c
arch/powerpc/kernel/setup-common.c
arch/powerpc/kernel/setup_64.c
arch/powerpc/platforms/powernv/pci-ioda.c
arch/powerpc/platforms/pseries/svm.c
arch/riscv/kernel/setup.c
arch/sparc/kernel/smp_64.c
arch/um/kernel/mem.c
arch/x86/kernel/setup_percpu.c
arch/x86/mm/kasan_init_64.c
arch/x86/mm/numa.c
arch/x86/mm/numa_emulation.c
arch/x86/xen/mmu_pv.c
arch/x86/xen/p2m.c
drivers/base/arch_numa.c
drivers/macintosh/smu.c
drivers/xen/swiotlb-xen.c
include/linux/memblock.h
init/initramfs.c
init/main.c
kernel/dma/swiotlb.c
kernel/printk/printk.c
lib/bootconfig.c
lib/cpumask.c
mm/memblock.c
mm/percpu.c
mm/sparse.c