{
        struct device_node *cpun;
 
-       for_each_node_by_type(cpun, "cpu") {
+       for_each_of_cpu_node(cpun) {
                if (arch_find_n_match_cpu_physical_id(cpun, cpu, thread))
                        return cpun;
        }
 
 {
        u32 nid;
        int r;
-       struct device_node *cpus;
-       struct device_node *np = NULL;
-
-       cpus = of_find_node_by_path("/cpus");
-       if (!cpus)
-               return;
-
-       for_each_child_of_node(cpus, np) {
-               /* Skip things that are not CPUs */
-               if (of_node_cmp(np->type, "cpu") != 0)
-                       continue;
+       struct device_node *np;
 
+       for_each_of_cpu_node(np) {
                r = of_property_read_u32(np, "numa-node-id", &nid);
                if (r)
                        continue;
                else
                        node_set(nid, numa_nodes_parsed);
        }
-
-       of_node_put(cpus);
 }
 
 static int __init of_numa_parse_memory_nodes(void)