Skip to content

Commit 5d63f81

Browse files
milesdotchentorvalds
authored andcommitted
mm/memblock.c: remove unnecessary log and clean up
There is no variable named flags in memblock_add() and memblock_reserve() so remove it from the log messages. This patch also cleans up the type casting for phys_addr_t by using %pa to print them. Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Miles Chen <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 2351907 commit 5d63f81

File tree

1 file changed

+25
-29
lines changed

1 file changed

+25
-29
lines changed

mm/memblock.c

Lines changed: 25 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -611,10 +611,10 @@ int __init_memblock memblock_add_node(phys_addr_t base, phys_addr_t size,
611611

612612
int __init_memblock memblock_add(phys_addr_t base, phys_addr_t size)
613613
{
614-
memblock_dbg("memblock_add: [%#016llx-%#016llx] flags %#02lx %pF\n",
615-
(unsigned long long)base,
616-
(unsigned long long)base + size - 1,
617-
0UL, (void *)_RET_IP_);
614+
phys_addr_t end = base + size - 1;
615+
616+
memblock_dbg("memblock_add: [%pa-%pa] %pF\n",
617+
&base, &end, (void *)_RET_IP_);
618618

619619
return memblock_add_range(&memblock.memory, base, size, MAX_NUMNODES, 0);
620620
}
@@ -718,21 +718,21 @@ int __init_memblock memblock_remove(phys_addr_t base, phys_addr_t size)
718718

719719
int __init_memblock memblock_free(phys_addr_t base, phys_addr_t size)
720720
{
721-
memblock_dbg(" memblock_free: [%#016llx-%#016llx] %pF\n",
722-
(unsigned long long)base,
723-
(unsigned long long)base + size - 1,
724-
(void *)_RET_IP_);
721+
phys_addr_t end = base + size - 1;
722+
723+
memblock_dbg(" memblock_free: [%pa-%pa] %pF\n",
724+
&base, &end, (void *)_RET_IP_);
725725

726726
kmemleak_free_part_phys(base, size);
727727
return memblock_remove_range(&memblock.reserved, base, size);
728728
}
729729

730730
int __init_memblock memblock_reserve(phys_addr_t base, phys_addr_t size)
731731
{
732-
memblock_dbg("memblock_reserve: [%#016llx-%#016llx] flags %#02lx %pF\n",
733-
(unsigned long long)base,
734-
(unsigned long long)base + size - 1,
735-
0UL, (void *)_RET_IP_);
732+
phys_addr_t end = base + size - 1;
733+
734+
memblock_dbg("memblock_reserve: [%pa-%pa] %pF\n",
735+
&base, &end, (void *)_RET_IP_);
736736

737737
return memblock_add_range(&memblock.reserved, base, size, MAX_NUMNODES, 0);
738738
}
@@ -1227,8 +1227,8 @@ phys_addr_t __init memblock_alloc_base(phys_addr_t size, phys_addr_t align, phys
12271227
alloc = __memblock_alloc_base(size, align, max_addr);
12281228

12291229
if (alloc == 0)
1230-
panic("ERROR: Failed to allocate 0x%llx bytes below 0x%llx.\n",
1231-
(unsigned long long) size, (unsigned long long) max_addr);
1230+
panic("ERROR: Failed to allocate %pa bytes below %pa.\n",
1231+
&size, &max_addr);
12321232

12331233
return alloc;
12341234
}
@@ -1695,7 +1695,7 @@ phys_addr_t __init_memblock memblock_get_current_limit(void)
16951695

16961696
static void __init_memblock memblock_dump(struct memblock_type *type, char *name)
16971697
{
1698-
unsigned long long base, size;
1698+
phys_addr_t base, end, size;
16991699
unsigned long flags;
17001700
int idx;
17011701
struct memblock_region *rgn;
@@ -1707,23 +1707,24 @@ static void __init_memblock memblock_dump(struct memblock_type *type, char *name
17071707

17081708
base = rgn->base;
17091709
size = rgn->size;
1710+
end = base + size - 1;
17101711
flags = rgn->flags;
17111712
#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP
17121713
if (memblock_get_region_node(rgn) != MAX_NUMNODES)
17131714
snprintf(nid_buf, sizeof(nid_buf), " on node %d",
17141715
memblock_get_region_node(rgn));
17151716
#endif
1716-
pr_info(" %s[%#x]\t[%#016llx-%#016llx], %#llx bytes%s flags: %#lx\n",
1717-
name, idx, base, base + size - 1, size, nid_buf, flags);
1717+
pr_info(" %s[%#x]\t[%pa-%pa], %pa bytes%s flags: %#lx\n",
1718+
name, idx, &base, &end, &size, nid_buf, flags);
17181719
}
17191720
}
17201721

17211722
void __init_memblock __memblock_dump_all(void)
17221723
{
17231724
pr_info("MEMBLOCK configuration:\n");
1724-
pr_info(" memory size = %#llx reserved size = %#llx\n",
1725-
(unsigned long long)memblock.memory.total_size,
1726-
(unsigned long long)memblock.reserved.total_size);
1725+
pr_info(" memory size = %pa reserved size = %pa\n",
1726+
&memblock.memory.total_size,
1727+
&memblock.reserved.total_size);
17271728

17281729
memblock_dump(&memblock.memory, "memory");
17291730
memblock_dump(&memblock.reserved, "reserved");
@@ -1749,19 +1750,14 @@ static int memblock_debug_show(struct seq_file *m, void *private)
17491750
struct memblock_type *type = m->private;
17501751
struct memblock_region *reg;
17511752
int i;
1753+
phys_addr_t end;
17521754

17531755
for (i = 0; i < type->cnt; i++) {
17541756
reg = &type->regions[i];
1755-
seq_printf(m, "%4d: ", i);
1756-
if (sizeof(phys_addr_t) == 4)
1757-
seq_printf(m, "0x%08lx..0x%08lx\n",
1758-
(unsigned long)reg->base,
1759-
(unsigned long)(reg->base + reg->size - 1));
1760-
else
1761-
seq_printf(m, "0x%016llx..0x%016llx\n",
1762-
(unsigned long long)reg->base,
1763-
(unsigned long long)(reg->base + reg->size - 1));
1757+
end = reg->base + reg->size - 1;
17641758

1759+
seq_printf(m, "%4d: ", i);
1760+
seq_printf(m, "%pa..%pa\n", &reg->base, &end);
17651761
}
17661762
return 0;
17671763
}

0 commit comments

Comments
 (0)