diff options
author | Tejun Heo <tj@kernel.org> | 2011-12-08 13:22:07 -0500 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2011-12-08 13:22:07 -0500 |
commit | fe091c208a40299fba40e62292a610fb91e44b4e (patch) | |
tree | 72bf673f05a736cbf3555a4dcf428b95840fc9f7 /mm/memblock.c | |
parent | c5a1cb284b791fcc3c70962331a682452afaf6cd (diff) |
memblock: Kill memblock_init()
memblock_init() initializes arrays for regions and memblock itself;
however, all these can be done with struct initializers and
memblock_init() can be removed. This patch kills memblock_init() and
initializes memblock with struct initializer.
The only difference is that the first dummy entries don't have .nid
set to MAX_NUMNODES initially. This doesn't cause any behavior
difference.
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Michal Simek <monstr@monstr.eu>
Cc: Paul Mundt <lethal@linux-sh.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Guan Xuetao <gxt@mprc.pku.edu.cn>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Diffstat (limited to 'mm/memblock.c')
-rw-r--r-- | mm/memblock.c | 48 |
1 files changed, 14 insertions, 34 deletions
diff --git a/mm/memblock.c b/mm/memblock.c index e808df845bb..5bbb87f59ae 100644 --- a/mm/memblock.c +++ b/mm/memblock.c | |||
@@ -20,12 +20,23 @@ | |||
20 | #include <linux/seq_file.h> | 20 | #include <linux/seq_file.h> |
21 | #include <linux/memblock.h> | 21 | #include <linux/memblock.h> |
22 | 22 | ||
23 | struct memblock memblock __initdata_memblock; | 23 | static struct memblock_region memblock_memory_init_regions[INIT_MEMBLOCK_REGIONS] __initdata_memblock; |
24 | static struct memblock_region memblock_reserved_init_regions[INIT_MEMBLOCK_REGIONS] __initdata_memblock; | ||
25 | |||
26 | struct memblock memblock __initdata_memblock = { | ||
27 | .memory.regions = memblock_memory_init_regions, | ||
28 | .memory.cnt = 1, /* empty dummy entry */ | ||
29 | .memory.max = INIT_MEMBLOCK_REGIONS, | ||
30 | |||
31 | .reserved.regions = memblock_reserved_init_regions, | ||
32 | .reserved.cnt = 1, /* empty dummy entry */ | ||
33 | .reserved.max = INIT_MEMBLOCK_REGIONS, | ||
34 | |||
35 | .current_limit = MEMBLOCK_ALLOC_ANYWHERE, | ||
36 | }; | ||
24 | 37 | ||
25 | int memblock_debug __initdata_memblock; | 38 | int memblock_debug __initdata_memblock; |
26 | int memblock_can_resize __initdata_memblock; | 39 | int memblock_can_resize __initdata_memblock; |
27 | static struct memblock_region memblock_memory_init_regions[INIT_MEMBLOCK_REGIONS] __initdata_memblock; | ||
28 | static struct memblock_region memblock_reserved_init_regions[INIT_MEMBLOCK_REGIONS] __initdata_memblock; | ||
29 | 40 | ||
30 | /* inline so we don't get a warning when pr_debug is compiled out */ | 41 | /* inline so we don't get a warning when pr_debug is compiled out */ |
31 | static inline const char *memblock_type_name(struct memblock_type *type) | 42 | static inline const char *memblock_type_name(struct memblock_type *type) |
@@ -920,37 +931,6 @@ void __init memblock_analyze(void) | |||
920 | memblock_can_resize = 1; | 931 | memblock_can_resize = 1; |
921 | } | 932 | } |
922 | 933 | ||
923 | void __init memblock_init(void) | ||
924 | { | ||
925 | static int init_done __initdata = 0; | ||
926 | |||
927 | if (init_done) | ||
928 | return; | ||
929 | init_done = 1; | ||
930 | |||
931 | /* Hookup the initial arrays */ | ||
932 | memblock.memory.regions = memblock_memory_init_regions; | ||
933 | memblock.memory.max = INIT_MEMBLOCK_REGIONS; | ||
934 | memblock.reserved.regions = memblock_reserved_init_regions; | ||
935 | memblock.reserved.max = INIT_MEMBLOCK_REGIONS; | ||
936 | |||
937 | /* Create a dummy zero size MEMBLOCK which will get coalesced away later. | ||
938 | * This simplifies the memblock_add() code below... | ||
939 | */ | ||
940 | memblock.memory.regions[0].base = 0; | ||
941 | memblock.memory.regions[0].size = 0; | ||
942 | memblock_set_region_node(&memblock.memory.regions[0], MAX_NUMNODES); | ||
943 | memblock.memory.cnt = 1; | ||
944 | |||
945 | /* Ditto. */ | ||
946 | memblock.reserved.regions[0].base = 0; | ||
947 | memblock.reserved.regions[0].size = 0; | ||
948 | memblock_set_region_node(&memblock.reserved.regions[0], MAX_NUMNODES); | ||
949 | memblock.reserved.cnt = 1; | ||
950 | |||
951 | memblock.current_limit = MEMBLOCK_ALLOC_ANYWHERE; | ||
952 | } | ||
953 | |||
954 | static int __init early_memblock(char *p) | 934 | static int __init early_memblock(char *p) |
955 | { | 935 | { |
956 | if (p && strstr(p, "debug")) | 936 | if (p && strstr(p, "debug")) |