diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-03-25 14:47:20 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-05-15 10:03:49 -0400 |
commit | ceb683d3bc36f213aeef0c5d79e6fbb1e16bd459 (patch) | |
tree | a01d44449f12a866bd292d95a37db638820f0cd8 /arch | |
parent | 6262c92f51ffb074800d5a340ee16bc06758e037 (diff) |
ARM: Ensure meminfo is sorted prior to sanity_check_meminfo
Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mm/init.c | 10 | ||||
-rw-r--r-- | arch/arm/mm/mmu.c | 10 |
2 files changed, 10 insertions, 10 deletions
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c index 7829cb5425f5..8bbb9a972e71 100644 --- a/arch/arm/mm/init.c +++ b/arch/arm/mm/init.c | |||
@@ -15,7 +15,6 @@ | |||
15 | #include <linux/mman.h> | 15 | #include <linux/mman.h> |
16 | #include <linux/nodemask.h> | 16 | #include <linux/nodemask.h> |
17 | #include <linux/initrd.h> | 17 | #include <linux/initrd.h> |
18 | #include <linux/sort.h> | ||
19 | #include <linux/highmem.h> | 18 | #include <linux/highmem.h> |
20 | 19 | ||
21 | #include <asm/mach-types.h> | 20 | #include <asm/mach-types.h> |
@@ -387,21 +386,12 @@ static void arm_memory_present(struct meminfo *mi, int node) | |||
387 | } | 386 | } |
388 | #endif | 387 | #endif |
389 | 388 | ||
390 | static int __init meminfo_cmp(const void *_a, const void *_b) | ||
391 | { | ||
392 | const struct membank *a = _a, *b = _b; | ||
393 | long cmp = bank_pfn_start(a) - bank_pfn_start(b); | ||
394 | return cmp < 0 ? -1 : cmp > 0 ? 1 : 0; | ||
395 | } | ||
396 | |||
397 | void __init bootmem_init(void) | 389 | void __init bootmem_init(void) |
398 | { | 390 | { |
399 | struct meminfo *mi = &meminfo; | 391 | struct meminfo *mi = &meminfo; |
400 | unsigned long min, max_low, max_high; | 392 | unsigned long min, max_low, max_high; |
401 | int node, initrd_node; | 393 | int node, initrd_node; |
402 | 394 | ||
403 | sort(&mi->bank, mi->nr_banks, sizeof(mi->bank[0]), meminfo_cmp, NULL); | ||
404 | |||
405 | /* | 395 | /* |
406 | * Locate which node contains the ramdisk image, if any. | 396 | * Locate which node contains the ramdisk image, if any. |
407 | */ | 397 | */ |
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c index 9d4da6ac28eb..91547196915c 100644 --- a/arch/arm/mm/mmu.c +++ b/arch/arm/mm/mmu.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/bootmem.h> | 14 | #include <linux/bootmem.h> |
15 | #include <linux/mman.h> | 15 | #include <linux/mman.h> |
16 | #include <linux/nodemask.h> | 16 | #include <linux/nodemask.h> |
17 | #include <linux/sort.h> | ||
17 | 18 | ||
18 | #include <asm/cputype.h> | 19 | #include <asm/cputype.h> |
19 | #include <asm/mach-types.h> | 20 | #include <asm/mach-types.h> |
@@ -1013,6 +1014,13 @@ static void __init kmap_init(void) | |||
1013 | #endif | 1014 | #endif |
1014 | } | 1015 | } |
1015 | 1016 | ||
1017 | static int __init meminfo_cmp(const void *_a, const void *_b) | ||
1018 | { | ||
1019 | const struct membank *a = _a, *b = _b; | ||
1020 | long cmp = bank_pfn_start(a) - bank_pfn_start(b); | ||
1021 | return cmp < 0 ? -1 : cmp > 0 ? 1 : 0; | ||
1022 | } | ||
1023 | |||
1016 | /* | 1024 | /* |
1017 | * paging_init() sets up the page tables, initialises the zone memory | 1025 | * paging_init() sets up the page tables, initialises the zone memory |
1018 | * maps, and sets up the zero page, bad page and bad page tables. | 1026 | * maps, and sets up the zero page, bad page and bad page tables. |
@@ -1021,6 +1029,8 @@ void __init paging_init(struct machine_desc *mdesc) | |||
1021 | { | 1029 | { |
1022 | void *zero_page; | 1030 | void *zero_page; |
1023 | 1031 | ||
1032 | sort(&meminfo.bank, meminfo.nr_banks, sizeof(meminfo.bank[0]), meminfo_cmp, NULL); | ||
1033 | |||
1024 | build_mem_type_table(); | 1034 | build_mem_type_table(); |
1025 | sanity_check_meminfo(); | 1035 | sanity_check_meminfo(); |
1026 | prepare_page_table(); | 1036 | prepare_page_table(); |