Skip to content

Commit

Permalink
x86: Remove the useless branch in c_start()
Browse files Browse the repository at this point in the history
Since 'cpu == -1' in cpumask_next() is legal, no need to handle
'*pos == 0' specially.

About the comments:

	/* just in case, cpu 0 is not the first */

A test with a cpumask in which cpu 0 is not the first has been
done, and it works well.

This patch will remove that useless branch to clean the code.

Signed-off-by: Michael Wang <wangyun@linux.vnet.ibm.com>
Cc: kjwinchester@gmail.com
Cc: borislav.petkov@amd.com
Cc: ak@linux.intel.com
Link: http://lkml.kernel.org/r/1348033343-23658-1-git-send-email-wangyun@linux.vnet.ibm.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
  • Loading branch information
Michael Wang authored and Ingo Molnar committed Sep 26, 2012
1 parent 6f0f9b6 commit dec08a8
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions arch/x86/kernel/cpu/proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,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 &cpu_data(*pos);
return NULL;
Expand Down

0 comments on commit dec08a8

Please sign in to comment.