arm64: ptdump: use static initializers for vmemmap region boundaries
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Fri, 22 Apr 2016 16:48:03 +0000 (18:48 +0200)
committerWill Deacon <will.deacon@arm.com>
Mon, 25 Apr 2016 11:04:39 +0000 (12:04 +0100)
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>
arch/arm64/mm/dump.c

index a21f47421b0cf0be5a36a014fc6d3add78113704..493461159462149fdced97e82c80e2b0f4042fec 100644 (file)
@@ -32,37 +32,21 @@ struct addr_marker {
        const char *name;
 };
 
-enum address_markers_idx {
-       MODULES_START_NR = 0,
-       MODULES_END_NR,
-       VMALLOC_START_NR,
-       VMALLOC_END_NR,
-       FIXADDR_START_NR,
-       FIXADDR_END_NR,
-       PCI_START_NR,
-       PCI_END_NR,
+static const struct addr_marker address_markers[] = {
+       { MODULES_VADDR,                "Modules start" },
+       { MODULES_END,                  "Modules end" },
+       { VMALLOC_START,                "vmalloc() Area" },
+       { VMALLOC_END,                  "vmalloc() End" },
+       { FIXADDR_START,                "Fixmap start" },
+       { FIXADDR_TOP,                  "Fixmap end" },
+       { PCI_IO_START,                 "PCI I/O start" },
+       { PCI_IO_END,                   "PCI I/O end" },
 #ifdef CONFIG_SPARSEMEM_VMEMMAP
-       VMEMMAP_START_NR,
-       VMEMMAP_END_NR,
+       { VMEMMAP_START,                "vmemmap start" },
+       { VMEMMAP_START + VMEMMAP_SIZE, "vmemmap end" },
 #endif
-       KERNEL_SPACE_NR,
-};
-
-static struct addr_marker address_markers[] = {
-       { MODULES_VADDR,        "Modules start" },
-       { MODULES_END,          "Modules end" },
-       { VMALLOC_START,        "vmalloc() Area" },
-       { VMALLOC_END,          "vmalloc() End" },
-       { FIXADDR_START,        "Fixmap start" },
-       { FIXADDR_TOP,          "Fixmap end" },
-       { PCI_IO_START,         "PCI I/O start" },
-       { PCI_IO_END,           "PCI I/O end" },
-#ifdef CONFIG_SPARSEMEM_VMEMMAP
-       { 0,                    "vmemmap start" },
-       { 0,                    "vmemmap end" },
-#endif
-       { PAGE_OFFSET,          "Linear Mapping" },
-       { -1,                   NULL },
+       { PAGE_OFFSET,                  "Linear Mapping" },
+       { -1,                           NULL },
 };
 
 /*
@@ -347,13 +331,6 @@ static int ptdump_init(void)
                        for (j = 0; j < pg_level[i].num; j++)
                                pg_level[i].mask |= pg_level[i].bits[j].mask;
 
-#ifdef CONFIG_SPARSEMEM_VMEMMAP
-       address_markers[VMEMMAP_START_NR].start_address =
-                               (unsigned long)virt_to_page(PAGE_OFFSET);
-       address_markers[VMEMMAP_END_NR].start_address =
-                               (unsigned long)virt_to_page(high_memory);
-#endif
-
        pe = debugfs_create_file("kernel_page_tables", 0400, NULL, NULL,
                                 &ptdump_fops);
        return pe ? 0 : -ENOMEM;