From b77deb6ac5d8a97103b884adc096c1ec799d698c Mon Sep 17 00:00:00 2001 From: Paul Mackerras Date: Mon, 5 Dec 2005 15:50:39 +1100 Subject: [PATCH] --- yaml --- r: 17156 b: refs/heads/master c: 54c233102f3680c7f08b6f06d229cc48503b79c4 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/arch/powerpc/mm/numa.c | 35 ++++++++++++++++++++++++----------- 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/[refs] b/[refs] index 0bad60b901ae..5aefc43d87fb 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: d2dd482bc17c3bc240045f80a7c4b4d5cea5e29c +refs/heads/master: 54c233102f3680c7f08b6f06d229cc48503b79c4 diff --git a/trunk/arch/powerpc/mm/numa.c b/trunk/arch/powerpc/mm/numa.c index 30b5d6a1d838..ba7a3055a9fc 100644 --- a/trunk/arch/powerpc/mm/numa.c +++ b/trunk/arch/powerpc/mm/numa.c @@ -254,17 +254,29 @@ static int __init find_min_common_depth(void) return depth; } -static void __init get_n_mem_cells(int *n_addr_cells, int *n_size_cells) +static int __init get_mem_addr_cells(void) { struct device_node *memory = NULL; + int rc; memory = of_find_node_by_type(memory, "memory"); - if (memory) { - *n_addr_cells = prom_n_addr_cells(memory); - *n_size_cells = prom_n_size_cells(memory); - of_node_put(memory); - } - /* if (!memory) we are in trouble, let other code error out */ + if (!memory) + return 0; /* it won't matter */ + + rc = prom_n_addr_cells(memory); + return rc; +} + +static int __init get_mem_size_cells(void) +{ + struct device_node *memory = NULL; + int rc; + + memory = of_find_node_by_type(memory, "memory"); + if (!memory) + return 0; /* it won't matter */ + rc = prom_n_size_cells(memory); + return rc; } static unsigned long __init read_n_cells(int n, unsigned int **buf) @@ -374,7 +386,7 @@ static int __init parse_numa_properties(void) { struct device_node *cpu = NULL; struct device_node *memory = NULL; - int n_addr_cells, n_size_cells; + int addr_cells, size_cells; int max_domain; unsigned long i; @@ -413,7 +425,8 @@ static int __init parse_numa_properties(void) } } - get_n_mem_cells(&n_addr_cells, &n_size_cells); + addr_cells = get_mem_addr_cells(); + size_cells = get_mem_size_cells(); memory = NULL; while ((memory = of_find_node_by_type(memory, "memory")) != NULL) { unsigned long start; @@ -430,8 +443,8 @@ static int __init parse_numa_properties(void) ranges = memory->n_addrs; new_range: /* these are order-sensitive, and modify the buffer pointer */ - start = read_n_cells(n_addr_cells, &memcell_buf); - size = read_n_cells(n_size_cells, &memcell_buf); + start = read_n_cells(addr_cells, &memcell_buf); + size = read_n_cells(size_cells, &memcell_buf); numa_domain = of_node_numa_domain(memory);