[PATCH v2 2/4] powerpc: Simplify cpumask api usage for cpuinfo display
Shrikanth Hegde
sshegde at linux.ibm.com
Mon Apr 27 14:47:13 AEST 2026
- 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 at nvidia.com>
Signed-off-by: Shrikanth Hegde <sshegde at linux.ibm.com>
---
arch/powerpc/kernel/setup-common.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
index 8a86b0efcb1c..aecabe9cf139 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -323,7 +323,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
seq_putc(m, '\n');
/* If this is the last cpu, print the summary */
- if (cpumask_next(cpu_id, cpu_online_mask) >= nr_cpu_ids)
+ if (cpu_id == cpumask_last(cpu_online_mask))
show_cpuinfo_summary(m);
return 0;
@@ -331,10 +331,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
static void *c_start(struct seq_file *m, loff_t *pos)
{
- 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);
+ *pos = cpumask_next(*pos - 1, cpu_online_mask);
if ((*pos) < nr_cpu_ids)
return (void *)(unsigned long)(*pos + 1);
return NULL;
--
2.47.3
More information about the Linuxppc-dev
mailing list