Commit e6532c63 authored by Anton Blanchard's avatar Anton Blanchard Committed by Benjamin Herrenschmidt

powerpc/cpumask: Convert /proc/cpuinfo to new cpumask API

Use new cpumask API in /proc/cpuinfo code.
Signed-off-by: default avatarAnton Blanchard <anton@samba.org>
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
parent 2c2df038
...@@ -200,11 +200,6 @@ static int show_cpuinfo(struct seq_file *m, void *v) ...@@ -200,11 +200,6 @@ static int show_cpuinfo(struct seq_file *m, void *v)
unsigned short maj; unsigned short maj;
unsigned short min; unsigned short min;
if (cpu_id == NR_CPUS) {
show_cpuinfo_summary(m);
return 0;
}
/* We only show online cpus: disable preempt (overzealous, I /* We only show online cpus: disable preempt (overzealous, I
* knew) to prevent cpu going down. */ * knew) to prevent cpu going down. */
preempt_disable(); preempt_disable();
...@@ -312,19 +307,28 @@ static int show_cpuinfo(struct seq_file *m, void *v) ...@@ -312,19 +307,28 @@ static int show_cpuinfo(struct seq_file *m, void *v)
#endif #endif
preempt_enable(); 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; return 0;
} }
static void *c_start(struct seq_file *m, loff_t *pos) static void *c_start(struct seq_file *m, loff_t *pos)
{ {
unsigned long i = *pos; if (*pos == 0) /* just in case, cpu 0 is not the first */
*pos = cpumask_first(cpu_online_mask);
return i <= NR_CPUS ? (void *)(i + 1) : NULL; 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) static void *c_next(struct seq_file *m, void *v, loff_t *pos)
{ {
++*pos; (*pos)++;
return c_start(m, pos); return c_start(m, pos);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment