Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux...
[pandora-kernel.git] / arch / powerpc / kernel / setup-common.c
index 48f0a00..5e4d852 100644 (file)
@@ -161,45 +161,44 @@ extern u32 cpu_temp_both(unsigned long cpu);
 DEFINE_PER_CPU(unsigned int, cpu_pvr);
 #endif
 
-static int show_cpuinfo(struct seq_file *m, void *v)
+static void show_cpuinfo_summary(struct seq_file *m)
 {
-       unsigned long cpu_id = (unsigned long)v - 1;
-       unsigned int pvr;
-       unsigned short maj;
-       unsigned short min;
-
-       if (cpu_id == NR_CPUS) {
-               struct device_node *root;
-               const char *model = NULL;
+       struct device_node *root;
+       const char *model = NULL;
 #if defined(CONFIG_SMP) && defined(CONFIG_PPC32)
-               unsigned long bogosum = 0;
-               int i;
-               for_each_online_cpu(i)
-                       bogosum += loops_per_jiffy;
-               seq_printf(m, "total bogomips\t: %lu.%02lu\n",
-                          bogosum/(500000/HZ), bogosum/(5000/HZ) % 100);
+       unsigned long bogosum = 0;
+       int i;
+       for_each_online_cpu(i)
+               bogosum += loops_per_jiffy;
+       seq_printf(m, "total bogomips\t: %lu.%02lu\n",
+                  bogosum/(500000/HZ), bogosum/(5000/HZ) % 100);
 #endif /* CONFIG_SMP && CONFIG_PPC32 */
-               seq_printf(m, "timebase\t: %lu\n", ppc_tb_freq);
-               if (ppc_md.name)
-                       seq_printf(m, "platform\t: %s\n", ppc_md.name);
-               root = of_find_node_by_path("/");
-               if (root)
-                       model = of_get_property(root, "model", NULL);
-               if (model)
-                       seq_printf(m, "model\t\t: %s\n", model);
-               of_node_put(root);
-
-               if (ppc_md.show_cpuinfo != NULL)
-                       ppc_md.show_cpuinfo(m);
+       seq_printf(m, "timebase\t: %lu\n", ppc_tb_freq);
+       if (ppc_md.name)
+               seq_printf(m, "platform\t: %s\n", ppc_md.name);
+       root = of_find_node_by_path("/");
+       if (root)
+               model = of_get_property(root, "model", NULL);
+       if (model)
+               seq_printf(m, "model\t\t: %s\n", model);
+       of_node_put(root);
+
+       if (ppc_md.show_cpuinfo != NULL)
+               ppc_md.show_cpuinfo(m);
 
 #ifdef CONFIG_PPC32
-               /* Display the amount of memory */
-               seq_printf(m, "Memory\t\t: %d MB\n",
-                          (unsigned int)(total_memory / (1024 * 1024)));
+       /* Display the amount of memory */
+       seq_printf(m, "Memory\t\t: %d MB\n",
+                  (unsigned int)(total_memory / (1024 * 1024)));
 #endif
+}
 
-               return 0;
-       }
+static int show_cpuinfo(struct seq_file *m, void *v)
+{
+       unsigned long cpu_id = (unsigned long)v - 1;
+       unsigned int pvr;
+       unsigned short maj;
+       unsigned short min;
 
        /* We only show online cpus: disable preempt (overzealous, I
         * knew) to prevent cpu going down. */
@@ -308,19 +307,28 @@ static int show_cpuinfo(struct seq_file *m, void *v)
 #endif
 
        preempt_enable();
+
+       /* If this is the last cpu, print the summary */
+       if (cpumask_next(cpu_id, cpu_online_mask) >= nr_cpu_ids)
+               show_cpuinfo_summary(m);
+
        return 0;
 }
 
 static void *c_start(struct seq_file *m, loff_t *pos)
 {
-       unsigned long i = *pos;
-
-       return i <= NR_CPUS ? (void *)(i + 1) : NULL;
+       if (*pos == 0)  /* just in case, cpu 0 is not the first */
+               *pos = cpumask_first(cpu_online_mask);
+       else
+               *pos = cpumask_next(*pos - 1, cpu_online_mask);
+       if ((*pos) < nr_cpu_ids)
+               return (void *)(unsigned long)(*pos + 1);
+       return NULL;
 }
 
 static void *c_next(struct seq_file *m, void *v, loff_t *pos)
 {
-       ++*pos;
+       (*pos)++;
        return c_start(m, pos);
 }
 
@@ -386,14 +394,14 @@ static void __init cpu_init_thread_core_maps(int tpc)
 
 /**
  * setup_cpu_maps - initialize the following cpu maps:
- *                  cpu_possible_map
- *                  cpu_present_map
+ *                  cpu_possible_mask
+ *                  cpu_present_mask
  *
  * Having the possible map set up early allows us to restrict allocations
  * of things like irqstacks to num_possible_cpus() rather than NR_CPUS.
  *
  * We do not initialize the online map here; cpus set their own bits in
- * cpu_online_map as they come up.
+ * cpu_online_mask as they come up.
  *
  * This function is valid only for Open Firmware systems.  finish_device_tree
  * must be called before using this.