mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 02:32:09 -04:00
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 <[email protected]> Cc: Benjamin Herrenschmidt <[email protected]> Cc: Yinghai Lu <[email protected]> Cc: Russell King <[email protected]> Cc: Michal Simek <[email protected]> Cc: Paul Mundt <[email protected]> Cc: "David S. Miller" <[email protected]> Cc: Guan Xuetao <[email protected]> Cc: "H. Peter Anvin" <[email protected]>
This commit is contained in:
parent
c5a1cb284b
commit
fe091c208a
12 changed files with 14 additions and 50 deletions
|
|
@ -20,12 +20,23 @@
|
|||
#include <linux/seq_file.h>
|
||||
#include <linux/memblock.h>
|
||||
|
||||
struct memblock memblock __initdata_memblock;
|
||||
static struct memblock_region memblock_memory_init_regions[INIT_MEMBLOCK_REGIONS] __initdata_memblock;
|
||||
static struct memblock_region memblock_reserved_init_regions[INIT_MEMBLOCK_REGIONS] __initdata_memblock;
|
||||
|
||||
struct memblock memblock __initdata_memblock = {
|
||||
.memory.regions = memblock_memory_init_regions,
|
||||
.memory.cnt = 1, /* empty dummy entry */
|
||||
.memory.max = INIT_MEMBLOCK_REGIONS,
|
||||
|
||||
.reserved.regions = memblock_reserved_init_regions,
|
||||
.reserved.cnt = 1, /* empty dummy entry */
|
||||
.reserved.max = INIT_MEMBLOCK_REGIONS,
|
||||
|
||||
.current_limit = MEMBLOCK_ALLOC_ANYWHERE,
|
||||
};
|
||||
|
||||
int memblock_debug __initdata_memblock;
|
||||
int memblock_can_resize __initdata_memblock;
|
||||
static struct memblock_region memblock_memory_init_regions[INIT_MEMBLOCK_REGIONS] __initdata_memblock;
|
||||
static struct memblock_region memblock_reserved_init_regions[INIT_MEMBLOCK_REGIONS] __initdata_memblock;
|
||||
|
||||
/* inline so we don't get a warning when pr_debug is compiled out */
|
||||
static inline const char *memblock_type_name(struct memblock_type *type)
|
||||
|
|
@ -920,37 +931,6 @@ void __init memblock_analyze(void)
|
|||
memblock_can_resize = 1;
|
||||
}
|
||||
|
||||
void __init memblock_init(void)
|
||||
{
|
||||
static int init_done __initdata = 0;
|
||||
|
||||
if (init_done)
|
||||
return;
|
||||
init_done = 1;
|
||||
|
||||
/* Hookup the initial arrays */
|
||||
memblock.memory.regions = memblock_memory_init_regions;
|
||||
memblock.memory.max = INIT_MEMBLOCK_REGIONS;
|
||||
memblock.reserved.regions = memblock_reserved_init_regions;
|
||||
memblock.reserved.max = INIT_MEMBLOCK_REGIONS;
|
||||
|
||||
/* Create a dummy zero size MEMBLOCK which will get coalesced away later.
|
||||
* This simplifies the memblock_add() code below...
|
||||
*/
|
||||
memblock.memory.regions[0].base = 0;
|
||||
memblock.memory.regions[0].size = 0;
|
||||
memblock_set_region_node(&memblock.memory.regions[0], MAX_NUMNODES);
|
||||
memblock.memory.cnt = 1;
|
||||
|
||||
/* Ditto. */
|
||||
memblock.reserved.regions[0].base = 0;
|
||||
memblock.reserved.regions[0].size = 0;
|
||||
memblock_set_region_node(&memblock.reserved.regions[0], MAX_NUMNODES);
|
||||
memblock.reserved.cnt = 1;
|
||||
|
||||
memblock.current_limit = MEMBLOCK_ALLOC_ANYWHERE;
|
||||
}
|
||||
|
||||
static int __init early_memblock(char *p)
|
||||
{
|
||||
if (p && strstr(p, "debug"))
|
||||
|
|
|
|||
Loading…
Reference in a new issue