diff options
Diffstat (limited to 'arch/powerpc/mm/numa.c')
-rw-r--r-- | arch/powerpc/mm/numa.c | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c index fbe23933f731..6c0f1c7d83e5 100644 --- a/arch/powerpc/mm/numa.c +++ b/arch/powerpc/mm/numa.c | |||
@@ -159,12 +159,12 @@ static struct device_node * __cpuinit find_cpu_node(unsigned int cpu) | |||
159 | { | 159 | { |
160 | unsigned int hw_cpuid = get_hard_smp_processor_id(cpu); | 160 | unsigned int hw_cpuid = get_hard_smp_processor_id(cpu); |
161 | struct device_node *cpu_node = NULL; | 161 | struct device_node *cpu_node = NULL; |
162 | unsigned int *interrupt_server, *reg; | 162 | const unsigned int *interrupt_server, *reg; |
163 | int len; | 163 | int len; |
164 | 164 | ||
165 | while ((cpu_node = of_find_node_by_type(cpu_node, "cpu")) != NULL) { | 165 | while ((cpu_node = of_find_node_by_type(cpu_node, "cpu")) != NULL) { |
166 | /* Try interrupt server first */ | 166 | /* Try interrupt server first */ |
167 | interrupt_server = (unsigned int *)get_property(cpu_node, | 167 | interrupt_server = get_property(cpu_node, |
168 | "ibm,ppc-interrupt-server#s", &len); | 168 | "ibm,ppc-interrupt-server#s", &len); |
169 | 169 | ||
170 | len = len / sizeof(u32); | 170 | len = len / sizeof(u32); |
@@ -175,8 +175,7 @@ static struct device_node * __cpuinit find_cpu_node(unsigned int cpu) | |||
175 | return cpu_node; | 175 | return cpu_node; |
176 | } | 176 | } |
177 | } else { | 177 | } else { |
178 | reg = (unsigned int *)get_property(cpu_node, | 178 | reg = get_property(cpu_node, "reg", &len); |
179 | "reg", &len); | ||
180 | if (reg && (len > 0) && (reg[0] == hw_cpuid)) | 179 | if (reg && (len > 0) && (reg[0] == hw_cpuid)) |
181 | return cpu_node; | 180 | return cpu_node; |
182 | } | 181 | } |
@@ -186,9 +185,9 @@ static struct device_node * __cpuinit find_cpu_node(unsigned int cpu) | |||
186 | } | 185 | } |
187 | 186 | ||
188 | /* must hold reference to node during call */ | 187 | /* must hold reference to node during call */ |
189 | static int *of_get_associativity(struct device_node *dev) | 188 | static const int *of_get_associativity(struct device_node *dev) |
190 | { | 189 | { |
191 | return (unsigned int *)get_property(dev, "ibm,associativity", NULL); | 190 | return get_property(dev, "ibm,associativity", NULL); |
192 | } | 191 | } |
193 | 192 | ||
194 | /* Returns nid in the range [0..MAX_NUMNODES-1], or -1 if no useful numa | 193 | /* Returns nid in the range [0..MAX_NUMNODES-1], or -1 if no useful numa |
@@ -197,7 +196,7 @@ static int *of_get_associativity(struct device_node *dev) | |||
197 | static int of_node_to_nid_single(struct device_node *device) | 196 | static int of_node_to_nid_single(struct device_node *device) |
198 | { | 197 | { |
199 | int nid = -1; | 198 | int nid = -1; |
200 | unsigned int *tmp; | 199 | const unsigned int *tmp; |
201 | 200 | ||
202 | if (min_common_depth == -1) | 201 | if (min_common_depth == -1) |
203 | goto out; | 202 | goto out; |
@@ -255,7 +254,7 @@ EXPORT_SYMBOL_GPL(of_node_to_nid); | |||
255 | static int __init find_min_common_depth(void) | 254 | static int __init find_min_common_depth(void) |
256 | { | 255 | { |
257 | int depth; | 256 | int depth; |
258 | unsigned int *ref_points; | 257 | const unsigned int *ref_points; |
259 | struct device_node *rtas_root; | 258 | struct device_node *rtas_root; |
260 | unsigned int len; | 259 | unsigned int len; |
261 | 260 | ||
@@ -270,7 +269,7 @@ static int __init find_min_common_depth(void) | |||
270 | * configuration (should be all 0's) and the second is for a normal | 269 | * configuration (should be all 0's) and the second is for a normal |
271 | * NUMA configuration. | 270 | * NUMA configuration. |
272 | */ | 271 | */ |
273 | ref_points = (unsigned int *)get_property(rtas_root, | 272 | ref_points = get_property(rtas_root, |
274 | "ibm,associativity-reference-points", &len); | 273 | "ibm,associativity-reference-points", &len); |
275 | 274 | ||
276 | if ((len >= 1) && ref_points) { | 275 | if ((len >= 1) && ref_points) { |
@@ -297,7 +296,7 @@ static void __init get_n_mem_cells(int *n_addr_cells, int *n_size_cells) | |||
297 | of_node_put(memory); | 296 | of_node_put(memory); |
298 | } | 297 | } |
299 | 298 | ||
300 | static unsigned long __devinit read_n_cells(int n, unsigned int **buf) | 299 | static unsigned long __devinit read_n_cells(int n, const unsigned int **buf) |
301 | { | 300 | { |
302 | unsigned long result = 0; | 301 | unsigned long result = 0; |
303 | 302 | ||
@@ -435,15 +434,13 @@ static int __init parse_numa_properties(void) | |||
435 | unsigned long size; | 434 | unsigned long size; |
436 | int nid; | 435 | int nid; |
437 | int ranges; | 436 | int ranges; |
438 | unsigned int *memcell_buf; | 437 | const unsigned int *memcell_buf; |
439 | unsigned int len; | 438 | unsigned int len; |
440 | 439 | ||
441 | memcell_buf = (unsigned int *)get_property(memory, | 440 | memcell_buf = get_property(memory, |
442 | "linux,usable-memory", &len); | 441 | "linux,usable-memory", &len); |
443 | if (!memcell_buf || len <= 0) | 442 | if (!memcell_buf || len <= 0) |
444 | memcell_buf = | 443 | memcell_buf = get_property(memory, "reg", &len); |
445 | (unsigned int *)get_property(memory, "reg", | ||
446 | &len); | ||
447 | if (!memcell_buf || len <= 0) | 444 | if (!memcell_buf || len <= 0) |
448 | continue; | 445 | continue; |
449 | 446 | ||
@@ -787,10 +784,10 @@ int hot_add_scn_to_nid(unsigned long scn_addr) | |||
787 | while ((memory = of_find_node_by_type(memory, "memory")) != NULL) { | 784 | while ((memory = of_find_node_by_type(memory, "memory")) != NULL) { |
788 | unsigned long start, size; | 785 | unsigned long start, size; |
789 | int ranges; | 786 | int ranges; |
790 | unsigned int *memcell_buf; | 787 | const unsigned int *memcell_buf; |
791 | unsigned int len; | 788 | unsigned int len; |
792 | 789 | ||
793 | memcell_buf = (unsigned int *)get_property(memory, "reg", &len); | 790 | memcell_buf = get_property(memory, "reg", &len); |
794 | if (!memcell_buf || len <= 0) | 791 | if (!memcell_buf || len <= 0) |
795 | continue; | 792 | continue; |
796 | 793 | ||