Skip to content

Commit

Permalink
memblock: remove _virt from APIs returning virtual address
Browse files Browse the repository at this point in the history
The conversion is done using

sed -i 's@memblock_virt_alloc@memblock_alloc@g' \
	$(git grep -l memblock_virt_alloc)

Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Mike Rapoport <[email protected]>
Cc: Catalin Marinas <[email protected]>
Cc: Chris Zankel <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Geert Uytterhoeven <[email protected]>
Cc: Greentime Hu <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
Cc: Guan Xuetao <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: "James E.J. Bottomley" <[email protected]>
Cc: Jonas Bonn <[email protected]>
Cc: Jonathan Corbet <[email protected]>
Cc: Ley Foon Tan <[email protected]>
Cc: Mark Salter <[email protected]>
Cc: Martin Schwidefsky <[email protected]>
Cc: Matt Turner <[email protected]>
Cc: Michael Ellerman <[email protected]>
Cc: Michal Hocko <[email protected]>
Cc: Michal Simek <[email protected]>
Cc: Palmer Dabbelt <[email protected]>
Cc: Paul Burton <[email protected]>
Cc: Richard Kuo <[email protected]>
Cc: Richard Weinberger <[email protected]>
Cc: Rich Felker <[email protected]>
Cc: Russell King <[email protected]>
Cc: Serge Semin <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Tony Luck <[email protected]>
Cc: Vineet Gupta <[email protected]>
Cc: Yoshinori Sato <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
rppt authored and torvalds committed Oct 31, 2018
1 parent 9a8dd70 commit eb31d55
Show file tree
Hide file tree
Showing 37 changed files with 105 additions and 105 deletions.
4 changes: 2 additions & 2 deletions arch/arm/kernel/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -857,15 +857,15 @@ static void __init request_standard_resources(const struct machine_desc *mdesc)
*/
boot_alias_start = phys_to_idmap(start);
if (arm_has_idmap_alias() && boot_alias_start != IDMAP_INVALID_ADDR) {
res = memblock_virt_alloc(sizeof(*res), 0);
res = memblock_alloc(sizeof(*res), 0);
res->name = "System RAM (boot alias)";
res->start = boot_alias_start;
res->end = phys_to_idmap(end);
res->flags = IORESOURCE_MEM | IORESOURCE_BUSY;
request_resource(&iomem_resource, res);
}

res = memblock_virt_alloc(sizeof(*res), 0);
res = memblock_alloc(sizeof(*res), 0);
res->name = "System RAM";
res->start = start;
res->end = end;
Expand Down
6 changes: 3 additions & 3 deletions arch/arm/mach-omap2/omap_hwmod.c
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,7 @@ static int __init _setup_clkctrl_provider(struct device_node *np)
u64 size;
int i;

provider = memblock_virt_alloc(sizeof(*provider), 0);
provider = memblock_alloc(sizeof(*provider), 0);
if (!provider)
return -ENOMEM;

Expand All @@ -736,12 +736,12 @@ static int __init _setup_clkctrl_provider(struct device_node *np)
of_property_count_elems_of_size(np, "reg", sizeof(u32)) / 2;

provider->addr =
memblock_virt_alloc(sizeof(void *) * provider->num_addrs, 0);
memblock_alloc(sizeof(void *) * provider->num_addrs, 0);
if (!provider->addr)
return -ENOMEM;

provider->size =
memblock_virt_alloc(sizeof(u32) * provider->num_addrs, 0);
memblock_alloc(sizeof(u32) * provider->num_addrs, 0);
if (!provider->size)
return -ENOMEM;

Expand Down
2 changes: 1 addition & 1 deletion arch/arm64/mm/kasan_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ static pgd_t tmp_pg_dir[PTRS_PER_PGD] __initdata __aligned(PGD_SIZE);

static phys_addr_t __init kasan_alloc_zeroed_page(int node)
{
void *p = memblock_virt_alloc_try_nid(PAGE_SIZE, PAGE_SIZE,
void *p = memblock_alloc_try_nid(PAGE_SIZE, PAGE_SIZE,
__pa(MAX_DMA_ADDRESS),
MEMBLOCK_ALLOC_ACCESSIBLE, node);
return __pa(p);
Expand Down
2 changes: 1 addition & 1 deletion arch/arm64/mm/numa.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ static void * __init pcpu_fc_alloc(unsigned int cpu, size_t size,
{
int nid = early_cpu_to_node(cpu);

return memblock_virt_alloc_try_nid(size, align,
return memblock_alloc_try_nid(size, align,
__pa(MAX_DMA_ADDRESS), MEMBLOCK_ALLOC_ACCESSIBLE, nid);
}

Expand Down
2 changes: 1 addition & 1 deletion arch/mips/kernel/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -859,7 +859,7 @@ static void __init arch_mem_init(char **cmdline_p)
* Prevent memblock from allocating high memory.
* This cannot be done before max_low_pfn is detected, so up
* to this point is possible to only reserve physical memory
* with memblock_reserve; memblock_virt_alloc* can be used
* with memblock_reserve; memblock_alloc* can be used
* only after this point
*/
memblock_set_current_limit(PFN_PHYS(max_low_pfn));
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/kernel/pci_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ pci_create_OF_bus_map(void)
struct property* of_prop;
struct device_node *dn;

of_prop = memblock_virt_alloc(sizeof(struct property) + 256, 0);
of_prop = memblock_alloc(sizeof(struct property) + 256, 0);
dn = of_find_node_by_path("/");
if (dn) {
memset(of_prop, -1, sizeof(struct property) + 256);
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/lib/alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ void * __ref zalloc_maybe_bootmem(size_t size, gfp_t mask)
if (slab_is_available())
p = kzalloc(size, mask);
else {
p = memblock_virt_alloc(size, 0);
p = memblock_alloc(size, 0);
}
return p;
}
6 changes: 3 additions & 3 deletions arch/powerpc/mm/mmu_context_nohash.c
Original file line number Diff line number Diff line change
Expand Up @@ -461,10 +461,10 @@ void __init mmu_context_init(void)
/*
* Allocate the maps used by context management
*/
context_map = memblock_virt_alloc(CTX_MAP_SIZE, 0);
context_mm = memblock_virt_alloc(sizeof(void *) * (LAST_CONTEXT + 1), 0);
context_map = memblock_alloc(CTX_MAP_SIZE, 0);
context_mm = memblock_alloc(sizeof(void *) * (LAST_CONTEXT + 1), 0);
#ifdef CONFIG_SMP
stale_map[boot_cpuid] = memblock_virt_alloc(CTX_MAP_SIZE, 0);
stale_map[boot_cpuid] = memblock_alloc(CTX_MAP_SIZE, 0);

cpuhp_setup_state_nocalls(CPUHP_POWERPC_MMU_CTX_PREPARE,
"powerpc/mmu/ctx:prepare",
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/platforms/powermac/nvram.c
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ static int __init core99_nvram_setup(struct device_node *dp, unsigned long addr)
printk(KERN_ERR "nvram: no address\n");
return -EINVAL;
}
nvram_image = memblock_virt_alloc(NVRAM_SIZE, 0);
nvram_image = memblock_alloc(NVRAM_SIZE, 0);
nvram_data = ioremap(addr, NVRAM_SIZE*2);
nvram_naddrs = 1; /* Make sure we get the correct case */

Expand Down
6 changes: 3 additions & 3 deletions arch/powerpc/platforms/powernv/pci-ioda.c
Original file line number Diff line number Diff line change
Expand Up @@ -3770,7 +3770,7 @@ static void __init pnv_pci_init_ioda_phb(struct device_node *np,
phb_id = be64_to_cpup(prop64);
pr_debug(" PHB-ID : 0x%016llx\n", phb_id);

phb = memblock_virt_alloc(sizeof(*phb), 0);
phb = memblock_alloc(sizeof(*phb), 0);

/* Allocate PCI controller */
phb->hose = hose = pcibios_alloc_controller(np);
Expand Down Expand Up @@ -3816,7 +3816,7 @@ static void __init pnv_pci_init_ioda_phb(struct device_node *np,
else
phb->diag_data_size = PNV_PCI_DIAG_BUF_SIZE;

phb->diag_data = memblock_virt_alloc(phb->diag_data_size, 0);
phb->diag_data = memblock_alloc(phb->diag_data_size, 0);

/* Parse 32-bit and IO ranges (if any) */
pci_process_bridge_OF_ranges(hose, np, !hose->global_number);
Expand Down Expand Up @@ -3875,7 +3875,7 @@ static void __init pnv_pci_init_ioda_phb(struct device_node *np,
}
pemap_off = size;
size += phb->ioda.total_pe_num * sizeof(struct pnv_ioda_pe);
aux = memblock_virt_alloc(size, 0);
aux = memblock_alloc(size, 0);
phb->ioda.pe_alloc = aux;
phb->ioda.m64_segmap = aux + m64map_off;
phb->ioda.m32_segmap = aux + m32map_off;
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/platforms/ps3/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ static void __init prealloc(struct ps3_prealloc *p)
if (!p->size)
return;

p->address = memblock_virt_alloc(p->size, p->align);
p->address = memblock_alloc(p->size, p->align);

printk(KERN_INFO "%s: %lu bytes at %p\n", p->name, p->size,
p->address);
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/sysdev/msi_bitmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ int __ref msi_bitmap_alloc(struct msi_bitmap *bmp, unsigned int irq_count,
if (bmp->bitmap_from_slab)
bmp->bitmap = kzalloc(size, GFP_KERNEL);
else {
bmp->bitmap = memblock_virt_alloc(size, 0);
bmp->bitmap = memblock_alloc(size, 0);
/* the bitmap won't be freed from memblock allocator */
kmemleak_not_leak(bmp->bitmap);
}
Expand Down
8 changes: 4 additions & 4 deletions arch/s390/kernel/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ static void __init setup_lowcore(void)
* Setup lowcore for boot cpu
*/
BUILD_BUG_ON(sizeof(struct lowcore) != LC_PAGES * PAGE_SIZE);
lc = memblock_virt_alloc_low(sizeof(*lc), sizeof(*lc));
lc = memblock_alloc_low(sizeof(*lc), sizeof(*lc));
lc->restart_psw.mask = PSW_KERNEL_BITS;
lc->restart_psw.addr = (unsigned long) restart_int_handler;
lc->external_new_psw.mask = PSW_KERNEL_BITS |
Expand Down Expand Up @@ -422,7 +422,7 @@ static void __init setup_lowcore(void)
* Allocate the global restart stack which is the same for
* all CPUs in cast *one* of them does a PSW restart.
*/
restart_stack = memblock_virt_alloc(THREAD_SIZE, THREAD_SIZE);
restart_stack = memblock_alloc(THREAD_SIZE, THREAD_SIZE);
restart_stack += STACK_INIT_OFFSET;

/*
Expand Down Expand Up @@ -488,7 +488,7 @@ static void __init setup_resources(void)
bss_resource.end = (unsigned long) __bss_stop - 1;

for_each_memblock(memory, reg) {
res = memblock_virt_alloc(sizeof(*res), 8);
res = memblock_alloc(sizeof(*res), 8);
res->flags = IORESOURCE_BUSY | IORESOURCE_SYSTEM_RAM;

res->name = "System RAM";
Expand All @@ -502,7 +502,7 @@ static void __init setup_resources(void)
std_res->start > res->end)
continue;
if (std_res->end > res->end) {
sub_res = memblock_virt_alloc(sizeof(*sub_res), 8);
sub_res = memblock_alloc(sizeof(*sub_res), 8);
*sub_res = *std_res;
sub_res->end = res->end;
std_res->start = res->end + 1;
Expand Down
2 changes: 1 addition & 1 deletion arch/s390/kernel/smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,7 @@ void __init smp_detect_cpus(void)
u16 address;

/* Get CPU information */
info = memblock_virt_alloc(sizeof(*info), 8);
info = memblock_alloc(sizeof(*info), 8);
smp_get_core_info(info, 1);
/* Find boot CPU type */
if (sclp.has_core_type) {
Expand Down
4 changes: 2 additions & 2 deletions arch/s390/kernel/topology.c
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ static void __init alloc_masks(struct sysinfo_15_1_x *info,
nr_masks *= info->mag[TOPOLOGY_NR_MAG - offset - 1 - i];
nr_masks = max(nr_masks, 1);
for (i = 0; i < nr_masks; i++) {
mask->next = memblock_virt_alloc(sizeof(*mask->next), 8);
mask->next = memblock_alloc(sizeof(*mask->next), 8);
mask = mask->next;
}
}
Expand All @@ -537,7 +537,7 @@ void __init topology_init_early(void)
}
if (!MACHINE_HAS_TOPOLOGY)
goto out;
tl_info = memblock_virt_alloc(PAGE_SIZE, PAGE_SIZE);
tl_info = memblock_alloc(PAGE_SIZE, PAGE_SIZE);
info = tl_info;
store_topology(info);
pr_info("The CPU configuration topology of the machine is: %d %d %d %d %d %d / %d\n",
Expand Down
2 changes: 1 addition & 1 deletion arch/s390/numa/mode_emu.c
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ static void __ref create_core_to_node_map(void)
{
int i;

emu_cores = memblock_virt_alloc(sizeof(*emu_cores), 8);
emu_cores = memblock_alloc(sizeof(*emu_cores), 8);
for (i = 0; i < ARRAY_SIZE(emu_cores->to_node_id); i++)
emu_cores->to_node_id[i] = NODE_ID_FREE;
}
Expand Down
2 changes: 1 addition & 1 deletion arch/s390/numa/toptree.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ struct toptree __ref *toptree_alloc(int level, int id)
if (slab_is_available())
res = kzalloc(sizeof(*res), GFP_KERNEL);
else
res = memblock_virt_alloc(sizeof(*res), 8);
res = memblock_alloc(sizeof(*res), 8);
if (!res)
return res;

Expand Down
4 changes: 2 additions & 2 deletions arch/x86/mm/kasan_init_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ static p4d_t tmp_p4d_table[MAX_PTRS_PER_P4D] __initdata __aligned(PAGE_SIZE);
static __init void *early_alloc(size_t size, int nid, bool panic)
{
if (panic)
return memblock_virt_alloc_try_nid(size, size,
return memblock_alloc_try_nid(size, size,
__pa(MAX_DMA_ADDRESS), BOOTMEM_ALLOC_ACCESSIBLE, nid);
else
return memblock_virt_alloc_try_nid_nopanic(size, size,
return memblock_alloc_try_nid_nopanic(size, size,
__pa(MAX_DMA_ADDRESS), BOOTMEM_ALLOC_ACCESSIBLE, nid);
}

Expand Down
2 changes: 1 addition & 1 deletion arch/xtensa/mm/kasan_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ static void __init populate(void *start, void *end)
unsigned long vaddr = (unsigned long)start;
pgd_t *pgd = pgd_offset_k(vaddr);
pmd_t *pmd = pmd_offset(pgd, vaddr);
pte_t *pte = memblock_virt_alloc(n_pages * sizeof(pte_t), PAGE_SIZE);
pte_t *pte = memblock_alloc(n_pages * sizeof(pte_t), PAGE_SIZE);

pr_debug("%s: %p - %p\n", __func__, start, end);

Expand Down
2 changes: 1 addition & 1 deletion drivers/clk/ti/clk.c
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ void __init omap2_clk_legacy_provider_init(int index, void __iomem *mem)
{
struct clk_iomap *io;

io = memblock_virt_alloc(sizeof(*io), 0);
io = memblock_alloc(sizeof(*io), 0);

io->mem = mem;

Expand Down
2 changes: 1 addition & 1 deletion drivers/firmware/memmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ int __init firmware_map_add_early(u64 start, u64 end, const char *type)
{
struct firmware_map_entry *entry;

entry = memblock_virt_alloc(sizeof(struct firmware_map_entry), 0);
entry = memblock_alloc(sizeof(struct firmware_map_entry), 0);
if (WARN_ON(!entry))
return -ENOMEM;

Expand Down
2 changes: 1 addition & 1 deletion drivers/of/fdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -1179,7 +1179,7 @@ int __init __weak early_init_dt_reserve_memory_arch(phys_addr_t base,

static void * __init early_init_dt_alloc_memory_arch(u64 size, u64 align)
{
return memblock_virt_alloc(size, align);
return memblock_alloc(size, align);
}

bool __init early_init_dt_verify(void *params)
Expand Down
2 changes: 1 addition & 1 deletion drivers/of/unittest.c
Original file line number Diff line number Diff line change
Expand Up @@ -2192,7 +2192,7 @@ static struct device_node *overlay_base_root;

static void * __init dt_alloc_memory(u64 size, u64 align)
{
return memblock_virt_alloc(size, align);
return memblock_alloc(size, align);
}

/*
Expand Down
38 changes: 19 additions & 19 deletions include/linux/bootmem.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,78 +95,78 @@ extern void *__alloc_bootmem_low(unsigned long size,
#define BOOTMEM_ALLOC_ANYWHERE (~(phys_addr_t)0)

/* FIXME: Move to memblock.h at a point where we remove nobootmem.c */
void *memblock_virt_alloc_try_nid_raw(phys_addr_t size, phys_addr_t align,
void *memblock_alloc_try_nid_raw(phys_addr_t size, phys_addr_t align,
phys_addr_t min_addr,
phys_addr_t max_addr, int nid);
void *memblock_virt_alloc_try_nid_nopanic(phys_addr_t size,
void *memblock_alloc_try_nid_nopanic(phys_addr_t size,
phys_addr_t align, phys_addr_t min_addr,
phys_addr_t max_addr, int nid);
void *memblock_virt_alloc_try_nid(phys_addr_t size, phys_addr_t align,
void *memblock_alloc_try_nid(phys_addr_t size, phys_addr_t align,
phys_addr_t min_addr, phys_addr_t max_addr, int nid);
void __memblock_free_early(phys_addr_t base, phys_addr_t size);
void __memblock_free_late(phys_addr_t base, phys_addr_t size);

static inline void * __init memblock_virt_alloc(
static inline void * __init memblock_alloc(
phys_addr_t size, phys_addr_t align)
{
return memblock_virt_alloc_try_nid(size, align, BOOTMEM_LOW_LIMIT,
return memblock_alloc_try_nid(size, align, BOOTMEM_LOW_LIMIT,
BOOTMEM_ALLOC_ACCESSIBLE,
NUMA_NO_NODE);
}

static inline void * __init memblock_virt_alloc_raw(
static inline void * __init memblock_alloc_raw(
phys_addr_t size, phys_addr_t align)
{
return memblock_virt_alloc_try_nid_raw(size, align, BOOTMEM_LOW_LIMIT,
return memblock_alloc_try_nid_raw(size, align, BOOTMEM_LOW_LIMIT,
BOOTMEM_ALLOC_ACCESSIBLE,
NUMA_NO_NODE);
}

static inline void * __init memblock_virt_alloc_nopanic(
static inline void * __init memblock_alloc_nopanic(
phys_addr_t size, phys_addr_t align)
{
return memblock_virt_alloc_try_nid_nopanic(size, align,
return memblock_alloc_try_nid_nopanic(size, align,
BOOTMEM_LOW_LIMIT,
BOOTMEM_ALLOC_ACCESSIBLE,
NUMA_NO_NODE);
}

static inline void * __init memblock_virt_alloc_low(
static inline void * __init memblock_alloc_low(
phys_addr_t size, phys_addr_t align)
{
return memblock_virt_alloc_try_nid(size, align,
return memblock_alloc_try_nid(size, align,
BOOTMEM_LOW_LIMIT,
ARCH_LOW_ADDRESS_LIMIT,
NUMA_NO_NODE);
}
static inline void * __init memblock_virt_alloc_low_nopanic(
static inline void * __init memblock_alloc_low_nopanic(
phys_addr_t size, phys_addr_t align)
{
return memblock_virt_alloc_try_nid_nopanic(size, align,
return memblock_alloc_try_nid_nopanic(size, align,
BOOTMEM_LOW_LIMIT,
ARCH_LOW_ADDRESS_LIMIT,
NUMA_NO_NODE);
}

static inline void * __init memblock_virt_alloc_from_nopanic(
static inline void * __init memblock_alloc_from_nopanic(
phys_addr_t size, phys_addr_t align, phys_addr_t min_addr)
{
return memblock_virt_alloc_try_nid_nopanic(size, align, min_addr,
return memblock_alloc_try_nid_nopanic(size, align, min_addr,
BOOTMEM_ALLOC_ACCESSIBLE,
NUMA_NO_NODE);
}

static inline void * __init memblock_virt_alloc_node(
static inline void * __init memblock_alloc_node(
phys_addr_t size, int nid)
{
return memblock_virt_alloc_try_nid(size, 0, BOOTMEM_LOW_LIMIT,
return memblock_alloc_try_nid(size, 0, BOOTMEM_LOW_LIMIT,
BOOTMEM_ALLOC_ACCESSIBLE, nid);
}

static inline void * __init memblock_virt_alloc_node_nopanic(
static inline void * __init memblock_alloc_node_nopanic(
phys_addr_t size, int nid)
{
return memblock_virt_alloc_try_nid_nopanic(size, 0, BOOTMEM_LOW_LIMIT,
return memblock_alloc_try_nid_nopanic(size, 0, BOOTMEM_LOW_LIMIT,
BOOTMEM_ALLOC_ACCESSIBLE,
nid);
}
Expand Down
Loading

0 comments on commit eb31d55

Please sign in to comment.