Merge tag 'powerpc-4.16-1' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc...
[linux-2.6-microblaze.git] / arch / powerpc / kernel / setup-common.c
index 3f33869..d73ec51 100644 (file)
@@ -346,10 +346,8 @@ static int show_cpuinfo(struct seq_file *m, void *v)
                   loops_per_jiffy / (500000/HZ),
                   (loops_per_jiffy / (5000/HZ)) % 100);
 #endif
-
-#ifdef CONFIG_SMP
        seq_printf(m, "\n");
-#endif
+
        /* If this is the last cpu, print the summary */
        if (cpumask_next(cpu_id, cpu_online_mask) >= nr_cpu_ids)
                show_cpuinfo_summary(m);
@@ -379,10 +377,10 @@ static void c_stop(struct seq_file *m, void *v)
 }
 
 const struct seq_operations cpuinfo_op = {
-       .start =c_start,
-       .next = c_next,
-       .stop = c_stop,
-       .show = show_cpuinfo,
+       .start  = c_start,
+       .next   = c_next,
+       .stop   = c_stop,
+       .show   = show_cpuinfo,
 };
 
 void __init check_for_initrd(void)
@@ -459,13 +457,13 @@ static void __init cpu_init_thread_core_maps(int tpc)
  */
 void __init smp_setup_cpu_maps(void)
 {
-       struct device_node *dn = NULL;
+       struct device_node *dn;
        int cpu = 0;
        int nthreads = 1;
 
        DBG("smp_setup_cpu_maps()\n");
 
-       while ((dn = of_find_node_by_type(dn, "cpu")) && cpu < nr_cpu_ids) {
+       for_each_node_by_type(dn, "cpu") {
                const __be32 *intserv;
                __be32 cpu_be;
                int j, len;
@@ -505,6 +503,11 @@ void __init smp_setup_cpu_maps(void)
                        set_cpu_possible(cpu, true);
                        cpu++;
                }
+
+               if (cpu >= nr_cpu_ids) {
+                       of_node_put(dn);
+                       break;
+               }
        }
 
        /* If no SMT supported, nthreads is forced to 1 */