Skip to content

Commit c8f8cca

Browse files
Ard Biesheuvelwildea01
authored andcommitted
arm64: ptdump: use static initializers for vmemmap region boundaries
There is no need to initialize the vmemmap region boundaries dynamically, since they are compile time constants. So just add these constants to the global struct initializer, and drop the dynamic assignment and related code. Acked-by: Mark Rutland <mark.rutland@arm.com> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Signed-off-by: Will Deacon <will.deacon@arm.com>
1 parent 1dff808 commit c8f8cca

File tree

1 file changed

+13
-36
lines changed

1 file changed

+13
-36
lines changed

arch/arm64/mm/dump.c

Lines changed: 13 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -32,37 +32,21 @@ struct addr_marker {
3232
const char *name;
3333
};
3434

35-
enum address_markers_idx {
36-
MODULES_START_NR = 0,
37-
MODULES_END_NR,
38-
VMALLOC_START_NR,
39-
VMALLOC_END_NR,
40-
FIXADDR_START_NR,
41-
FIXADDR_END_NR,
42-
PCI_START_NR,
43-
PCI_END_NR,
35+
static const struct addr_marker address_markers[] = {
36+
{ MODULES_VADDR, "Modules start" },
37+
{ MODULES_END, "Modules end" },
38+
{ VMALLOC_START, "vmalloc() Area" },
39+
{ VMALLOC_END, "vmalloc() End" },
40+
{ FIXADDR_START, "Fixmap start" },
41+
{ FIXADDR_TOP, "Fixmap end" },
42+
{ PCI_IO_START, "PCI I/O start" },
43+
{ PCI_IO_END, "PCI I/O end" },
4444
#ifdef CONFIG_SPARSEMEM_VMEMMAP
45-
VMEMMAP_START_NR,
46-
VMEMMAP_END_NR,
45+
{ VMEMMAP_START, "vmemmap start" },
46+
{ VMEMMAP_START + VMEMMAP_SIZE, "vmemmap end" },
4747
#endif
48-
KERNEL_SPACE_NR,
49-
};
50-
51-
static struct addr_marker address_markers[] = {
52-
{ MODULES_VADDR, "Modules start" },
53-
{ MODULES_END, "Modules end" },
54-
{ VMALLOC_START, "vmalloc() Area" },
55-
{ VMALLOC_END, "vmalloc() End" },
56-
{ FIXADDR_START, "Fixmap start" },
57-
{ FIXADDR_TOP, "Fixmap end" },
58-
{ PCI_IO_START, "PCI I/O start" },
59-
{ PCI_IO_END, "PCI I/O end" },
60-
#ifdef CONFIG_SPARSEMEM_VMEMMAP
61-
{ 0, "vmemmap start" },
62-
{ 0, "vmemmap end" },
63-
#endif
64-
{ PAGE_OFFSET, "Linear Mapping" },
65-
{ -1, NULL },
48+
{ PAGE_OFFSET, "Linear Mapping" },
49+
{ -1, NULL },
6650
};
6751

6852
/*
@@ -347,13 +331,6 @@ static int ptdump_init(void)
347331
for (j = 0; j < pg_level[i].num; j++)
348332
pg_level[i].mask |= pg_level[i].bits[j].mask;
349333

350-
#ifdef CONFIG_SPARSEMEM_VMEMMAP
351-
address_markers[VMEMMAP_START_NR].start_address =
352-
(unsigned long)virt_to_page(PAGE_OFFSET);
353-
address_markers[VMEMMAP_END_NR].start_address =
354-
(unsigned long)virt_to_page(high_memory);
355-
#endif
356-
357334
pe = debugfs_create_file("kernel_page_tables", 0400, NULL, NULL,
358335
&ptdump_fops);
359336
return pe ? 0 : -ENOMEM;

0 commit comments

Comments
 (0)