diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2010-08-03 23:43:31 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2010-08-04 00:39:00 -0400 |
commit | 08b84798819e54ba1d29be71a52afbb697c7b666 (patch) | |
tree | 02d68257725647b93ee400c174324603e6501170 /arch/sparc/mm | |
parent | 64106ca61cc73f3798497c76d2b7749b8e93ead4 (diff) |
memblock/sparc: Use new accessors
CC: David S. Miller <davem@davemloft.net>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/sparc/mm')
-rw-r--r-- | arch/sparc/mm/init_64.c | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c index 16d8bee889ba..dd68025ecdbe 100644 --- a/arch/sparc/mm/init_64.c +++ b/arch/sparc/mm/init_64.c | |||
@@ -972,13 +972,13 @@ int of_node_to_nid(struct device_node *dp) | |||
972 | 972 | ||
973 | static void __init add_node_ranges(void) | 973 | static void __init add_node_ranges(void) |
974 | { | 974 | { |
975 | int i; | 975 | struct memblock_region *reg; |
976 | 976 | ||
977 | for (i = 0; i < memblock.memory.cnt; i++) { | 977 | for_each_memblock(memory, reg) { |
978 | unsigned long size = memblock_size_bytes(&memblock.memory, i); | 978 | unsigned long size = reg->size; |
979 | unsigned long start, end; | 979 | unsigned long start, end; |
980 | 980 | ||
981 | start = memblock.memory.regions[i].base; | 981 | start = reg->base; |
982 | end = start + size; | 982 | end = start + size; |
983 | while (start < end) { | 983 | while (start < end) { |
984 | unsigned long this_end; | 984 | unsigned long this_end; |
@@ -1281,7 +1281,7 @@ static void __init bootmem_init_nonnuma(void) | |||
1281 | { | 1281 | { |
1282 | unsigned long top_of_ram = memblock_end_of_DRAM(); | 1282 | unsigned long top_of_ram = memblock_end_of_DRAM(); |
1283 | unsigned long total_ram = memblock_phys_mem_size(); | 1283 | unsigned long total_ram = memblock_phys_mem_size(); |
1284 | unsigned int i; | 1284 | struct memblock_region *reg; |
1285 | 1285 | ||
1286 | numadbg("bootmem_init_nonnuma()\n"); | 1286 | numadbg("bootmem_init_nonnuma()\n"); |
1287 | 1287 | ||
@@ -1292,15 +1292,14 @@ static void __init bootmem_init_nonnuma(void) | |||
1292 | 1292 | ||
1293 | init_node_masks_nonnuma(); | 1293 | init_node_masks_nonnuma(); |
1294 | 1294 | ||
1295 | for (i = 0; i < memblock.memory.cnt; i++) { | 1295 | for_each_memblock(memory, reg) { |
1296 | unsigned long size = memblock_size_bytes(&memblock.memory, i); | ||
1297 | unsigned long start_pfn, end_pfn; | 1296 | unsigned long start_pfn, end_pfn; |
1298 | 1297 | ||
1299 | if (!size) | 1298 | if (!reg->size) |
1300 | continue; | 1299 | continue; |
1301 | 1300 | ||
1302 | start_pfn = memblock.memory.regions[i].base >> PAGE_SHIFT; | 1301 | start_pfn = memblock_region_base_pfn(reg); |
1303 | end_pfn = start_pfn + memblock_size_pages(&memblock.memory, i); | 1302 | end_pfn = memblock_region_end_pfn(reg); |
1304 | add_active_range(0, start_pfn, end_pfn); | 1303 | add_active_range(0, start_pfn, end_pfn); |
1305 | } | 1304 | } |
1306 | 1305 | ||
@@ -1334,17 +1333,12 @@ static void __init reserve_range_in_node(int nid, unsigned long start, | |||
1334 | 1333 | ||
1335 | static void __init trim_reserved_in_node(int nid) | 1334 | static void __init trim_reserved_in_node(int nid) |
1336 | { | 1335 | { |
1337 | int i; | 1336 | struct memblock_region *reg; |
1338 | 1337 | ||
1339 | numadbg(" trim_reserved_in_node(%d)\n", nid); | 1338 | numadbg(" trim_reserved_in_node(%d)\n", nid); |
1340 | 1339 | ||
1341 | for (i = 0; i < memblock.reserved.cnt; i++) { | 1340 | for_each_memblock(reserved, reg) |
1342 | unsigned long start = memblock.reserved.regions[i].base; | 1341 | reserve_range_in_node(nid, reg->base, reg->base + reg->size); |
1343 | unsigned long size = memblock_size_bytes(&memblock.reserved, i); | ||
1344 | unsigned long end = start + size; | ||
1345 | |||
1346 | reserve_range_in_node(nid, start, end); | ||
1347 | } | ||
1348 | } | 1342 | } |
1349 | 1343 | ||
1350 | static void __init bootmem_init_one_node(int nid) | 1344 | static void __init bootmem_init_one_node(int nid) |