aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2011-12-08 13:22:06 -0500
committerTejun Heo <tj@kernel.org>2011-12-08 13:22:06 -0500
commit9c8c27e2b89b020fd33dd3f2b18405d3f027e6ac (patch)
treea537ca38c9b699cb477cc2c093b0c5a9b2286b09 /mm
parent581adcbe121872429de76ff9884762de71a76200 (diff)
memblock: Use memblock_reserve() in memblock internal functions
Make memblock_double_array(), __memblock_alloc_base() and memblock_alloc_nid() use memblock_reserve() instead of calling memblock_add_region() with reserved array directly. This eases debugging and updates to memblock_add_region(). Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Yinghai Lu <yinghai@kernel.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/memblock.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/mm/memblock.c b/mm/memblock.c
index 948036718245..d0506183c5b1 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -175,9 +175,6 @@ static void __init_memblock memblock_remove_region(struct memblock_type *type, u
175 } 175 }
176} 176}
177 177
178/* Defined below but needed now */
179static int memblock_add_region(struct memblock_type *type, phys_addr_t base, phys_addr_t size);
180
181static int __init_memblock memblock_double_array(struct memblock_type *type) 178static int __init_memblock memblock_double_array(struct memblock_type *type)
182{ 179{
183 struct memblock_region *new_array, *old_array; 180 struct memblock_region *new_array, *old_array;
@@ -235,7 +232,7 @@ static int __init_memblock memblock_double_array(struct memblock_type *type)
235 return 0; 232 return 0;
236 233
237 /* Add the new reserved region now. Should not fail ! */ 234 /* Add the new reserved region now. Should not fail ! */
238 BUG_ON(memblock_add_region(&memblock.reserved, addr, new_size)); 235 BUG_ON(memblock_reserve(addr, new_size));
239 236
240 /* If the array wasn't our static init one, then free it. We only do 237 /* If the array wasn't our static init one, then free it. We only do
241 * that before SLAB is available as later on, we don't know whether 238 * that before SLAB is available as later on, we don't know whether
@@ -652,7 +649,7 @@ phys_addr_t __init __memblock_alloc_base(phys_addr_t size, phys_addr_t align, ph
652 size = round_up(size, align); 649 size = round_up(size, align);
653 650
654 found = memblock_find_in_range(0, max_addr, size, align); 651 found = memblock_find_in_range(0, max_addr, size, align);
655 if (found && !memblock_add_region(&memblock.reserved, found, size)) 652 if (found && !memblock_reserve(found, size))
656 return found; 653 return found;
657 654
658 return 0; 655 return 0;
@@ -748,7 +745,7 @@ phys_addr_t __init memblock_alloc_nid(phys_addr_t size, phys_addr_t align, int n
748 745
749 found = memblock_find_in_range_node(0, MEMBLOCK_ALLOC_ACCESSIBLE, 746 found = memblock_find_in_range_node(0, MEMBLOCK_ALLOC_ACCESSIBLE,
750 size, align, nid); 747 size, align, nid);
751 if (found && !memblock_add_region(&memblock.reserved, found, size)) 748 if (found && !memblock_reserve(found, size))
752 return found; 749 return found;
753 750
754 return 0; 751 return 0;