Skip to content

Commit

Permalink
powerpc: Use for_each_node_by_type instead of open coding it
Browse files Browse the repository at this point in the history
Use for_each_node_by_type instead of open coding it.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
  • Loading branch information
Anton Blanchard authored and Benjamin Herrenschmidt committed Sep 20, 2011
1 parent 6083184 commit 94db7c5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
3 changes: 1 addition & 2 deletions arch/powerpc/kernel/machine_kexec_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ int default_machine_kexec_prepare(struct kimage *image)
}

/* We also should not overwrite the tce tables */
for (node = of_find_node_by_type(NULL, "pci"); node != NULL;
node = of_find_node_by_type(node, "pci")) {
for_each_node_by_type(node, "pci") {
basep = of_get_property(node, "linux,tce-base", NULL);
sizep = of_get_property(node, "linux,tce-size", NULL);
if (basep == NULL || sizep == NULL)
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/kernel/setup_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ static void __init initialize_cache_info(void)

DBG(" -> initialize_cache_info()\n");

for (np = NULL; (np = of_find_node_by_type(np, "cpu"));) {
for_each_node_by_type(np, "cpu") {
num_cpus += 1;

/* We're assuming *all* of the CPUs have the same
Expand Down
10 changes: 5 additions & 5 deletions arch/powerpc/mm/numa.c
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,7 @@ static void __init parse_drconf_memory(struct device_node *memory)
static int __init parse_numa_properties(void)
{
struct device_node *cpu = NULL;
struct device_node *memory = NULL;
struct device_node *memory;
int default_nid = 0;
unsigned long i;

Expand Down Expand Up @@ -750,8 +750,8 @@ static int __init parse_numa_properties(void)
}

get_n_mem_cells(&n_mem_addr_cells, &n_mem_size_cells);
memory = NULL;
while ((memory = of_find_node_by_type(memory, "memory")) != NULL) {

for_each_node_by_type(memory, "memory") {
unsigned long start;
unsigned long size;
int nid;
Expand Down Expand Up @@ -1187,10 +1187,10 @@ static int hot_add_drconf_scn_to_nid(struct device_node *memory,
*/
int hot_add_node_scn_to_nid(unsigned long scn_addr)
{
struct device_node *memory = NULL;
struct device_node *memory;
int nid = -1;

while ((memory = of_find_node_by_type(memory, "memory")) != NULL) {
for_each_node_by_type(memory, "memory") {
unsigned long start, size;
int ranges;
const unsigned int *memcell_buf;
Expand Down

0 comments on commit 94db7c5

Please sign in to comment.