aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorAnton Blanchard <anton@samba.org>2010-04-26 11:32:40 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2010-05-06 03:41:55 -0400
commite6532c63cc3dbefc79936fc9c9c68a151004fe46 (patch)
tree381fc75043bb595d76a9602ef470d13e466aa185 /arch
parent2c2df038450cbf628426183c9efffc17cfea3406 (diff)
powerpc/cpumask: Convert /proc/cpuinfo to new cpumask API
Use new cpumask API in /proc/cpuinfo code. Signed-off-by: Anton Blanchard <anton@samba.org> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/powerpc/kernel/setup-common.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
index 58699a43eaa2..8dcec47a7b39 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -200,11 +200,6 @@ static int show_cpuinfo(struct seq_file *m, void *v)
200 unsigned short maj; 200 unsigned short maj;
201 unsigned short min; 201 unsigned short min;
202 202
203 if (cpu_id == NR_CPUS) {
204 show_cpuinfo_summary(m);
205 return 0;
206 }
207
208 /* We only show online cpus: disable preempt (overzealous, I 203 /* We only show online cpus: disable preempt (overzealous, I
209 * knew) to prevent cpu going down. */ 204 * knew) to prevent cpu going down. */
210 preempt_disable(); 205 preempt_disable();
@@ -312,19 +307,28 @@ static int show_cpuinfo(struct seq_file *m, void *v)
312#endif 307#endif
313 308
314 preempt_enable(); 309 preempt_enable();
310
311 /* If this is the last cpu, print the summary */
312 if (cpumask_next(cpu_id, cpu_online_mask) >= nr_cpu_ids)
313 show_cpuinfo_summary(m);
314
315 return 0; 315 return 0;
316} 316}
317 317
318static void *c_start(struct seq_file *m, loff_t *pos) 318static void *c_start(struct seq_file *m, loff_t *pos)
319{ 319{
320 unsigned long i = *pos; 320 if (*pos == 0) /* just in case, cpu 0 is not the first */
321 321 *pos = cpumask_first(cpu_online_mask);
322 return i <= NR_CPUS ? (void *)(i + 1) : NULL; 322 else
323 *pos = cpumask_next(*pos - 1, cpu_online_mask);
324 if ((*pos) < nr_cpu_ids)
325 return (void *)(unsigned long)(*pos + 1);
326 return NULL;
323} 327}
324 328
325static void *c_next(struct seq_file *m, void *v, loff_t *pos) 329static void *c_next(struct seq_file *m, void *v, loff_t *pos)
326{ 330{
327 ++*pos; 331 (*pos)++;
328 return c_start(m, pos); 332 return c_start(m, pos);
329} 333}
330 334