Skip to content

Commit 3ecc683

Browse files
rppttorvalds
authored andcommitted
memblock: rename memblock_free to memblock_phys_free
Since memblock_free() operates on a physical range, make its name reflect it and rename it to memblock_phys_free(), so it will be a logical counterpart to memblock_phys_alloc(). The callers are updated with the below semantic patch: @@ expression addr; expression size; @@ - memblock_free(addr, size); + memblock_phys_free(addr, size); Link: https://lkml.kernel.org/r/20210930185031.18648-6-rppt@kernel.org Signed-off-by: Mike Rapoport <rppt@linux.ibm.com> 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>
1 parent 621d973 commit 3ecc683

File tree

45 files changed

+79
-76
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+79
-76
lines changed

arch/alpha/kernel/core_irongate.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,8 @@ albacore_init_arch(void)
233233
unsigned long size;
234234

235235
size = initrd_end - initrd_start;
236-
memblock_free(__pa(initrd_start), PAGE_ALIGN(size));
236+
memblock_phys_free(__pa(initrd_start),
237+
PAGE_ALIGN(size));
237238
if (!move_initrd(pci_mem))
238239
printk("irongate_init_arch: initrd too big "
239240
"(%ldK)\ndisabling initrd\n",

arch/arc/mm/init.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ static void __init highmem_init(void)
173173
#ifdef CONFIG_HIGHMEM
174174
unsigned long tmp;
175175

176-
memblock_free(high_mem_start, high_mem_sz);
176+
memblock_phys_free(high_mem_start, high_mem_sz);
177177
for (tmp = min_high_pfn; tmp < max_high_pfn; tmp++)
178178
free_highmem_page(pfn_to_page(tmp));
179179
#endif

arch/arm/mach-hisi/platmcpm.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ static int __init hip04_smp_init(void)
339339
err_sysctrl:
340340
iounmap(relocation);
341341
err_reloc:
342-
memblock_free(hip04_boot_method[0], hip04_boot_method[1]);
342+
memblock_phys_free(hip04_boot_method[0], hip04_boot_method[1]);
343343
err:
344344
return ret;
345345
}

arch/arm/mm/init.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ phys_addr_t __init arm_memblock_steal(phys_addr_t size, phys_addr_t align)
158158
panic("Failed to steal %pa bytes at %pS\n",
159159
&size, (void *)_RET_IP_);
160160

161-
memblock_free(phys, size);
161+
memblock_phys_free(phys, size);
162162
memblock_remove(phys, size);
163163

164164
return phys;

arch/arm64/mm/mmu.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -738,8 +738,8 @@ void __init paging_init(void)
738738
cpu_replace_ttbr1(lm_alias(swapper_pg_dir));
739739
init_mm.pgd = swapper_pg_dir;
740740

741-
memblock_free(__pa_symbol(init_pg_dir),
742-
__pa_symbol(init_pg_end) - __pa_symbol(init_pg_dir));
741+
memblock_phys_free(__pa_symbol(init_pg_dir),
742+
__pa_symbol(init_pg_end) - __pa_symbol(init_pg_dir));
743743

744744
memblock_allow_resize();
745745
}

arch/mips/mm/init.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ static void * __init pcpu_fc_alloc(unsigned int cpu, size_t size,
529529

530530
static void __init pcpu_fc_free(void *ptr, size_t size)
531531
{
532-
memblock_free(__pa(ptr), size);
532+
memblock_phys_free(__pa(ptr), size);
533533
}
534534

535535
void __init setup_per_cpu_areas(void)

arch/mips/sgi-ip30/ip30-setup.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,10 @@ static void __init ip30_mem_init(void)
6969
total_mem += size;
7070

7171
if (addr >= IP30_REAL_MEMORY_START)
72-
memblock_free(addr, size);
72+
memblock_phys_free(addr, size);
7373
else if ((addr + size) > IP30_REAL_MEMORY_START)
74-
memblock_free(IP30_REAL_MEMORY_START,
75-
size - IP30_MAX_PROM_MEMORY);
74+
memblock_phys_free(IP30_REAL_MEMORY_START,
75+
size - IP30_MAX_PROM_MEMORY);
7676
}
7777
pr_info("Detected %luMB of physical memory.\n", MEM_SHIFT(total_mem));
7878
}

arch/powerpc/kernel/dt_cpu_ftrs.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -1095,8 +1095,8 @@ static int __init dt_cpu_ftrs_scan_callback(unsigned long node, const char
10951095

10961096
cpufeatures_setup_finished();
10971097

1098-
memblock_free(__pa(dt_cpu_features),
1099-
sizeof(struct dt_cpu_feature)*nr_dt_cpu_features);
1098+
memblock_phys_free(__pa(dt_cpu_features),
1099+
sizeof(struct dt_cpu_feature) * nr_dt_cpu_features);
11001100

11011101
return 0;
11021102
}

arch/powerpc/kernel/paca.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -322,17 +322,17 @@ void __init free_unused_pacas(void)
322322

323323
new_ptrs_size = sizeof(struct paca_struct *) * nr_cpu_ids;
324324
if (new_ptrs_size < paca_ptrs_size)
325-
memblock_free(__pa(paca_ptrs) + new_ptrs_size,
326-
paca_ptrs_size - new_ptrs_size);
325+
memblock_phys_free(__pa(paca_ptrs) + new_ptrs_size,
326+
paca_ptrs_size - new_ptrs_size);
327327

328328
paca_nr_cpu_ids = nr_cpu_ids;
329329
paca_ptrs_size = new_ptrs_size;
330330

331331
#ifdef CONFIG_PPC_BOOK3S_64
332332
if (early_radix_enabled()) {
333333
/* Ugly fixup, see new_slb_shadow() */
334-
memblock_free(__pa(paca_ptrs[boot_cpuid]->slb_shadow_ptr),
335-
sizeof(struct slb_shadow));
334+
memblock_phys_free(__pa(paca_ptrs[boot_cpuid]->slb_shadow_ptr),
335+
sizeof(struct slb_shadow));
336336
paca_ptrs[boot_cpuid]->slb_shadow_ptr = NULL;
337337
}
338338
#endif

arch/powerpc/kernel/setup-common.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -825,7 +825,7 @@ static void __init smp_setup_pacas(void)
825825
set_hard_smp_processor_id(cpu, cpu_to_phys_id[cpu]);
826826
}
827827

828-
memblock_free(__pa(cpu_to_phys_id), nr_cpu_ids * sizeof(u32));
828+
memblock_phys_free(__pa(cpu_to_phys_id), nr_cpu_ids * sizeof(u32));
829829
cpu_to_phys_id = NULL;
830830
}
831831
#endif

arch/powerpc/kernel/setup_64.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -812,7 +812,7 @@ static void * __init pcpu_alloc_bootmem(unsigned int cpu, size_t size,
812812

813813
static void __init pcpu_free_bootmem(void *ptr, size_t size)
814814
{
815-
memblock_free(__pa(ptr), size);
815+
memblock_phys_free(__pa(ptr), size);
816816
}
817817

818818
static int pcpu_cpu_distance(unsigned int from, unsigned int to)

arch/powerpc/platforms/powernv/pci-ioda.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -2981,7 +2981,7 @@ static void __init pnv_pci_init_ioda_phb(struct device_node *np,
29812981
if (!phb->hose) {
29822982
pr_err(" Can't allocate PCI controller for %pOF\n",
29832983
np);
2984-
memblock_free(__pa(phb), sizeof(struct pnv_phb));
2984+
memblock_phys_free(__pa(phb), sizeof(struct pnv_phb));
29852985
return;
29862986
}
29872987

arch/powerpc/platforms/pseries/svm.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ void __init svm_swiotlb_init(void)
5656
return;
5757

5858

59-
memblock_free(__pa(vstart), PAGE_ALIGN(io_tlb_nslabs << IO_TLB_SHIFT));
59+
memblock_phys_free(__pa(vstart),
60+
PAGE_ALIGN(io_tlb_nslabs << IO_TLB_SHIFT));
6061
panic("SVM: Cannot allocate SWIOTLB buffer");
6162
}
6263

arch/riscv/kernel/setup.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -230,13 +230,14 @@ static void __init init_resources(void)
230230

231231
/* Clean-up any unused pre-allocated resources */
232232
if (res_idx >= 0)
233-
memblock_free(__pa(mem_res), (res_idx + 1) * sizeof(*mem_res));
233+
memblock_phys_free(__pa(mem_res),
234+
(res_idx + 1) * sizeof(*mem_res));
234235
return;
235236

236237
error:
237238
/* Better an empty resource tree than an inconsistent one */
238239
release_child_resources(&iomem_resource);
239-
memblock_free(__pa(mem_res), mem_res_sz);
240+
memblock_phys_free(__pa(mem_res), mem_res_sz);
240241
}
241242

242243

arch/s390/kernel/setup.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -693,7 +693,7 @@ static void __init reserve_crashkernel(void)
693693
}
694694

695695
if (register_memory_notifier(&kdump_mem_nb)) {
696-
memblock_free(crash_base, crash_size);
696+
memblock_phys_free(crash_base, crash_size);
697697
return;
698698
}
699699

@@ -748,7 +748,7 @@ static void __init free_mem_detect_info(void)
748748

749749
get_mem_detect_reserved(&start, &size);
750750
if (size)
751-
memblock_free(start, size);
751+
memblock_phys_free(start, size);
752752
}
753753

754754
static const char * __init get_mem_info_source(void)
@@ -793,7 +793,7 @@ static void __init check_initrd(void)
793793
if (initrd_data.start && initrd_data.size &&
794794
!memblock_is_region_memory(initrd_data.start, initrd_data.size)) {
795795
pr_err("The initial RAM disk does not fit into the memory\n");
796-
memblock_free(initrd_data.start, initrd_data.size);
796+
memblock_phys_free(initrd_data.start, initrd_data.size);
797797
initrd_start = initrd_end = 0;
798798
}
799799
#endif
@@ -890,7 +890,7 @@ static void __init setup_randomness(void)
890890

891891
if (stsi(vmms, 3, 2, 2) == 0 && vmms->count)
892892
add_device_randomness(&vmms->vm, sizeof(vmms->vm[0]) * vmms->count);
893-
memblock_free((unsigned long) vmms, PAGE_SIZE);
893+
memblock_phys_free((unsigned long)vmms, PAGE_SIZE);
894894
}
895895

896896
/*

arch/s390/kernel/smp.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -723,7 +723,7 @@ void __init smp_save_dump_cpus(void)
723723
/* Get the CPU registers */
724724
smp_save_cpu_regs(sa, addr, is_boot_cpu, page);
725725
}
726-
memblock_free(page, PAGE_SIZE);
726+
memblock_phys_free(page, PAGE_SIZE);
727727
diag_amode31_ops.diag308_reset();
728728
pcpu_set_smt(0);
729729
}
@@ -880,7 +880,7 @@ void __init smp_detect_cpus(void)
880880

881881
/* Add CPUs present at boot */
882882
__smp_rescan_cpus(info, true);
883-
memblock_free((unsigned long)info, sizeof(*info));
883+
memblock_phys_free((unsigned long)info, sizeof(*info));
884884
}
885885

886886
/*

arch/s390/kernel/uv.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ void __init setup_uv(void)
6464
}
6565

6666
if (uv_init(uv_stor_base, uv_info.uv_base_stor_len)) {
67-
memblock_free(uv_stor_base, uv_info.uv_base_stor_len);
67+
memblock_phys_free(uv_stor_base, uv_info.uv_base_stor_len);
6868
goto fail;
6969
}
7070

arch/s390/mm/kasan_init.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -399,5 +399,5 @@ void __init kasan_copy_shadow_mapping(void)
399399

400400
void __init kasan_free_early_identity(void)
401401
{
402-
memblock_free(pgalloc_pos, pgalloc_freeable - pgalloc_pos);
402+
memblock_phys_free(pgalloc_pos, pgalloc_freeable - pgalloc_pos);
403403
}

arch/sh/boards/mach-ap325rxa/setup.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ static void __init ap325rxa_mv_mem_reserve(void)
560560
if (!phys)
561561
panic("Failed to allocate CEU memory\n");
562562

563-
memblock_free(phys, size);
563+
memblock_phys_free(phys, size);
564564
memblock_remove(phys, size);
565565

566566
ceu_dma_membase = phys;

arch/sh/boards/mach-ecovec24/setup.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -1502,15 +1502,15 @@ static void __init ecovec_mv_mem_reserve(void)
15021502
if (!phys)
15031503
panic("Failed to allocate CEU0 memory\n");
15041504

1505-
memblock_free(phys, size);
1505+
memblock_phys_free(phys, size);
15061506
memblock_remove(phys, size);
15071507
ceu0_dma_membase = phys;
15081508

15091509
phys = memblock_phys_alloc(size, PAGE_SIZE);
15101510
if (!phys)
15111511
panic("Failed to allocate CEU1 memory\n");
15121512

1513-
memblock_free(phys, size);
1513+
memblock_phys_free(phys, size);
15141514
memblock_remove(phys, size);
15151515
ceu1_dma_membase = phys;
15161516
}

arch/sh/boards/mach-kfr2r09/setup.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,7 @@ static void __init kfr2r09_mv_mem_reserve(void)
633633
if (!phys)
634634
panic("Failed to allocate CEU memory\n");
635635

636-
memblock_free(phys, size);
636+
memblock_phys_free(phys, size);
637637
memblock_remove(phys, size);
638638

639639
ceu_dma_membase = phys;

arch/sh/boards/mach-migor/setup.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,7 @@ static void __init migor_mv_mem_reserve(void)
633633
if (!phys)
634634
panic("Failed to allocate CEU memory\n");
635635

636-
memblock_free(phys, size);
636+
memblock_phys_free(phys, size);
637637
memblock_remove(phys, size);
638638

639639
ceu_dma_membase = phys;

arch/sh/boards/mach-se/7724/setup.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -966,15 +966,15 @@ static void __init ms7724se_mv_mem_reserve(void)
966966
if (!phys)
967967
panic("Failed to allocate CEU0 memory\n");
968968

969-
memblock_free(phys, size);
969+
memblock_phys_free(phys, size);
970970
memblock_remove(phys, size);
971971
ceu0_dma_membase = phys;
972972

973973
phys = memblock_phys_alloc(size, PAGE_SIZE);
974974
if (!phys)
975975
panic("Failed to allocate CEU1 memory\n");
976976

977-
memblock_free(phys, size);
977+
memblock_phys_free(phys, size);
978978
memblock_remove(phys, size);
979979
ceu1_dma_membase = phys;
980980
}

arch/sparc/kernel/smp_64.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1567,7 +1567,7 @@ static void * __init pcpu_alloc_bootmem(unsigned int cpu, size_t size,
15671567

15681568
static void __init pcpu_free_bootmem(void *ptr, size_t size)
15691569
{
1570-
memblock_free(__pa(ptr), size);
1570+
memblock_phys_free(__pa(ptr), size);
15711571
}
15721572

15731573
static int __init pcpu_cpu_distance(unsigned int from, unsigned int to)

arch/um/kernel/mem.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ void __init mem_init(void)
4747
*/
4848
brk_end = (unsigned long) UML_ROUND_UP(sbrk(0));
4949
map_memory(brk_end, __pa(brk_end), uml_reserved - brk_end, 1, 1, 0);
50-
memblock_free(__pa(brk_end), uml_reserved - brk_end);
50+
memblock_phys_free(__pa(brk_end), uml_reserved - brk_end);
5151
uml_reserved = brk_end;
5252

5353
/* this will put all low memory onto the freelists */

arch/x86/kernel/setup.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ static void __init reserve_initrd(void)
322322

323323
relocate_initrd();
324324

325-
memblock_free(ramdisk_image, ramdisk_end - ramdisk_image);
325+
memblock_phys_free(ramdisk_image, ramdisk_end - ramdisk_image);
326326
}
327327

328328
#else
@@ -521,7 +521,7 @@ static void __init reserve_crashkernel(void)
521521
}
522522

523523
if (crash_base >= (1ULL << 32) && reserve_crashkernel_low()) {
524-
memblock_free(crash_base, crash_size);
524+
memblock_phys_free(crash_base, crash_size);
525525
return;
526526
}
527527

arch/x86/mm/init.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,7 @@ static void __init memory_map_top_down(unsigned long map_start,
618618
*/
619619
addr = memblock_phys_alloc_range(PMD_SIZE, PMD_SIZE, map_start,
620620
map_end);
621-
memblock_free(addr, PMD_SIZE);
621+
memblock_phys_free(addr, PMD_SIZE);
622622
real_end = addr + PMD_SIZE;
623623

624624
/* step_size need to be small so pgt_buf from BRK could cover it */

arch/x86/xen/mmu_pv.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -1025,7 +1025,7 @@ static void __init xen_free_ro_pages(unsigned long paddr, unsigned long size)
10251025
for (; vaddr < vaddr_end; vaddr += PAGE_SIZE)
10261026
make_lowmem_page_readwrite(vaddr);
10271027

1028-
memblock_free(paddr, size);
1028+
memblock_phys_free(paddr, size);
10291029
}
10301030

10311031
static void __init xen_cleanmfnmap_free_pgtbl(void *pgtbl, bool unpin)
@@ -1151,7 +1151,7 @@ static void __init xen_pagetable_p2m_free(void)
11511151
xen_cleanhighmap(addr, addr + size);
11521152
size = PAGE_ALIGN(xen_start_info->nr_pages *
11531153
sizeof(unsigned long));
1154-
memblock_free(__pa(addr), size);
1154+
memblock_phys_free(__pa(addr), size);
11551155
} else {
11561156
xen_cleanmfnmap(addr);
11571157
}
@@ -1955,7 +1955,7 @@ void __init xen_relocate_p2m(void)
19551955
pfn_end = p2m_pfn_end;
19561956
}
19571957

1958-
memblock_free(PFN_PHYS(pfn), PAGE_SIZE * (pfn_end - pfn));
1958+
memblock_phys_free(PFN_PHYS(pfn), PAGE_SIZE * (pfn_end - pfn));
19591959
while (pfn < pfn_end) {
19601960
if (pfn == p2m_pfn) {
19611961
pfn = p2m_pfn_end;

arch/x86/xen/setup.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ static void __init xen_del_extra_mem(unsigned long start_pfn,
153153
break;
154154
}
155155
}
156-
memblock_free(PFN_PHYS(start_pfn), PFN_PHYS(n_pfns));
156+
memblock_phys_free(PFN_PHYS(start_pfn), PFN_PHYS(n_pfns));
157157
}
158158

159159
/*
@@ -719,7 +719,7 @@ static void __init xen_reserve_xen_mfnlist(void)
719719
return;
720720

721721
xen_relocate_p2m();
722-
memblock_free(start, size);
722+
memblock_phys_free(start, size);
723723
}
724724

725725
/**
@@ -885,7 +885,7 @@ char * __init xen_memory_setup(void)
885885
xen_phys_memcpy(new_area, start, size);
886886
pr_info("initrd moved from [mem %#010llx-%#010llx] to [mem %#010llx-%#010llx]\n",
887887
start, start + size, new_area, new_area + size);
888-
memblock_free(start, size);
888+
memblock_phys_free(start, size);
889889
boot_params.hdr.ramdisk_image = new_area;
890890
boot_params.ext_ramdisk_image = new_area >> 32;
891891
}

drivers/base/arch_numa.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ static void * __init pcpu_fc_alloc(unsigned int cpu, size_t size,
166166

167167
static void __init pcpu_fc_free(void *ptr, size_t size)
168168
{
169-
memblock_free(__pa(ptr), size);
169+
memblock_phys_free(__pa(ptr), size);
170170
}
171171

172172
#ifdef CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK

0 commit comments

Comments
 (0)