Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Anton Blanchard and committed by
Benjamin Herrenschmidt
e6532c63 2c2df038

+13 -9
+13 -9
arch/powerpc/kernel/setup-common.c
··· 200 200 unsigned short maj; 201 201 unsigned short min; 202 202 203 - if (cpu_id == NR_CPUS) { 204 - show_cpuinfo_summary(m); 205 - return 0; 206 - } 207 - 208 203 /* We only show online cpus: disable preempt (overzealous, I 209 204 * knew) to prevent cpu going down. */ 210 205 preempt_disable(); ··· 307 312 #endif 308 313 309 314 preempt_enable(); 315 + 316 + /* If this is the last cpu, print the summary */ 317 + if (cpumask_next(cpu_id, cpu_online_mask) >= nr_cpu_ids) 318 + show_cpuinfo_summary(m); 319 + 310 320 return 0; 311 321 } 312 322 313 323 static void *c_start(struct seq_file *m, loff_t *pos) 314 324 { 315 - unsigned long i = *pos; 316 - 317 - return i <= NR_CPUS ? (void *)(i + 1) : NULL; 325 + if (*pos == 0) /* just in case, cpu 0 is not the first */ 326 + *pos = cpumask_first(cpu_online_mask); 327 + else 328 + *pos = cpumask_next(*pos - 1, cpu_online_mask); 329 + if ((*pos) < nr_cpu_ids) 330 + return (void *)(unsigned long)(*pos + 1); 331 + return NULL; 318 332 } 319 333 320 334 static void *c_next(struct seq_file *m, void *v, loff_t *pos) 321 335 { 322 - ++*pos; 336 + (*pos)++; 323 337 return c_start(m, pos); 324 338 } 325 339