[PATCH 09/43] memblock/sh: Use new accessors

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Benjamin Herrenschmidt
Date: Thursday, August 5, 2010 - 10:14 pm

CC: Paul Mundt <lethal@linux-sh.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
 arch/sh/mm/init.c |   17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/arch/sh/mm/init.c b/arch/sh/mm/init.c
index d0e2491..b977475 100644
--- a/arch/sh/mm/init.c
+++ b/arch/sh/mm/init.c
@@ -200,7 +200,6 @@ static void __init bootmem_init_one_node(unsigned int nid)
 	unsigned long total_pages, paddr;
 	unsigned long end_pfn;
 	struct pglist_data *p;
-	int i;
 
 	p = NODE_DATA(nid);
 
@@ -226,11 +225,12 @@ static void __init bootmem_init_one_node(unsigned int nid)
 	 * reservations in other nodes.
 	 */
 	if (nid == 0) {
+		struct memblock_region *reg;
+
 		/* Reserve the sections we're already using. */
-		for (i = 0; i < memblock.reserved.cnt; i++)
-			reserve_bootmem(memblock.reserved.region[i].base,
-					memblock_size_bytes(&memblock.reserved, i),
-					BOOTMEM_DEFAULT);
+		for_each_memblock(reserved, reg) {
+			reserve_bootmem(reg->base, reg->size, BOOTMEM_DEFAULT);
+		}
 	}
 
 	sparse_memory_present_with_active_regions(nid);
@@ -238,13 +238,14 @@ static void __init bootmem_init_one_node(unsigned int nid)
 
 static void __init do_init_bootmem(void)
 {
+	struct memblock_region *reg;
 	int i;
 
 	/* Add active regions with valid PFNs. */
-	for (i = 0; i < memblock.memory.cnt; i++) {
+	for_each_memblock(memory, reg) {
 		unsigned long start_pfn, end_pfn;
-		start_pfn = memblock.memory.region[i].base >> PAGE_SHIFT;
-		end_pfn = start_pfn + memblock_size_pages(&memblock.memory, i);
+		start_pfn = memblock_region_base_pfn(reg);
+		end_pfn = memblock_region_end_pfn(reg);
 		__add_active_range(0, start_pfn, end_pfn);
 	}
 
-- 
1.7.0.4

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
memblock updates, Benjamin Herrenschmidt, (Thu Aug 5, 10:14 pm)
[PATCH 01/43] memblock: Fix memblock_is_region_reserved() ..., Benjamin Herrenschmidt, (Thu Aug 5, 10:14 pm)
[PATCH 02/43] memblock: Rename memblock_region to memblock ..., Benjamin Herrenschmidt, (Thu Aug 5, 10:14 pm)
[PATCH 04/43] memblock: Implement memblock_is_memory and m ..., Benjamin Herrenschmidt, (Thu Aug 5, 10:14 pm)
[PATCH 05/43] memblock/arm: pfn_valid uses memblock_is_mem ..., Benjamin Herrenschmidt, (Thu Aug 5, 10:14 pm)
[PATCH 06/43] memblock/arm: Use memblock_region_is_memory( ..., Benjamin Herrenschmidt, (Thu Aug 5, 10:14 pm)
[PATCH 08/43] memblock/microblaze: Use new accessors, Benjamin Herrenschmidt, (Thu Aug 5, 10:14 pm)
[PATCH 09/43] memblock/sh: Use new accessors, Benjamin Herrenschmidt, (Thu Aug 5, 10:14 pm)
[PATCH 11/43] memblock/powerpc: Use new accessors, Benjamin Herrenschmidt, (Thu Aug 5, 10:14 pm)
[PATCH 12/43] memblock/arm: Use new accessors, Benjamin Herrenschmidt, (Thu Aug 5, 10:14 pm)
[PATCH 13/43] memblock: Remove obsolete accessors, Benjamin Herrenschmidt, (Thu Aug 5, 10:14 pm)
[PATCH 14/43] memblock: Remove memblock_find(), Benjamin Herrenschmidt, (Thu Aug 5, 10:14 pm)
[PATCH 15/43] memblock: Remove nid_range argument, arch pr ..., Benjamin Herrenschmidt, (Thu Aug 5, 10:14 pm)
[PATCH 16/43] memblock: Factor the lowest level alloc function, Benjamin Herrenschmidt, (Thu Aug 5, 10:14 pm)
[PATCH 17/43] memblock: Expose MEMBLOCK_ALLOC_ANYWHERE, Benjamin Herrenschmidt, (Thu Aug 5, 10:14 pm)
[PATCH 21/43] memblock: Remove unused memblock.debug struc ..., Benjamin Herrenschmidt, (Thu Aug 5, 10:15 pm)
Re: [PATCH 08/43] memblock/microblaze: Use new accessors, Benjamin Herrenschmidt, (Fri Aug 6, 3:50 pm)
Re: [PATCH 12/43] memblock/arm: Use new accessors, Russell King - ARM Linux, (Tue Aug 10, 12:11 am)
Re: [PATCH 08/43] memblock/microblaze: Use new accessors, Stephen Rothwell, (Thu Sep 9, 4:06 am)
Re: [PATCH 08/43] memblock/microblaze: Use new accessors, Benjamin Herrenschmidt, (Fri Sep 10, 1:17 am)
Re: [PATCH 08/43] memblock/microblaze: Use new accessors, Benjamin Herrenschmidt, (Fri Sep 10, 1:18 am)
[PATCH] microblaze, memblock: fix compiling, Yinghai Lu, (Sat Sep 11, 12:07 am)
[PATCH] powerpc, memblock: fix will memblock reference, Yinghai Lu, (Sat Sep 11, 12:08 am)
[tip:core/memblock] memblock, microblaze: Fix memblock API ..., tip-bot for Yinghai Lu, (Sat Sep 11, 12:34 am)
[tip:core/memblock] powerpc, memblock: Fix memblock API ch ..., tip-bot for Yinghai Lu, (Sat Sep 11, 12:34 am)
[tip:core/memblock] memblock, microblaze: Fix memblock API ..., tip-bot for Michal Simek, (Sat Sep 11, 1:34 am)
[tip:core/memblock] powerpc, memblock: Fix memblock API ch ..., tip-bot for Yinghai Lu, (Sat Sep 11, 1:34 am)