Skip to content

Commit a66eab7

Browse files
Shrikanth Hegdemaddy-kerneldev
authored andcommitted
powerpc: Simplify cpumask api usage for cpuinfo display
- cpumask_next can take -1 as valid argument. So simplify cpuinfo iterator. - Use cpumask_last to find if this_cpu is last online CPU. /proc/cpuinfo shows same info with patch. Reviewed-by: Yury Norov <ynorov@nvidia.com> Signed-off-by: Shrikanth Hegde <sshegde@linux.ibm.com> Reviewed-by: Yury Norov <ynorov@gmail.com> Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com> Link: https://patch.msgid.link/20260427044715.559137-3-sshegde@linux.ibm.com
1 parent 1ca0c82 commit a66eab7

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

arch/powerpc/kernel/setup-common.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -323,18 +323,15 @@ static int show_cpuinfo(struct seq_file *m, void *v)
323323
seq_putc(m, '\n');
324324

325325
/* If this is the last cpu, print the summary */
326-
if (cpumask_next(cpu_id, cpu_online_mask) >= nr_cpu_ids)
326+
if (cpu_id == cpumask_last(cpu_online_mask))
327327
show_cpuinfo_summary(m);
328328

329329
return 0;
330330
}
331331

332332
static void *c_start(struct seq_file *m, loff_t *pos)
333333
{
334-
if (*pos == 0) /* just in case, cpu 0 is not the first */
335-
*pos = cpumask_first(cpu_online_mask);
336-
else
337-
*pos = cpumask_next(*pos - 1, cpu_online_mask);
334+
*pos = cpumask_next(*pos - 1, cpu_online_mask);
338335
if ((*pos) < nr_cpu_ids)
339336
return (void *)(unsigned long)(*pos + 1);
340337
return NULL;

0 commit comments

Comments
 (0)