Skip to content

Commit bfc9b9b

Browse files
author
Fox Snowpatch
committed
1 parent 4f37907 commit bfc9b9b

4 files changed

Lines changed: 8 additions & 20 deletions

File tree

arch/powerpc/kernel/irq.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -370,10 +370,7 @@ int irq_choose_cpu(const struct cpumask *mask)
370370
do_round_robin:
371371
raw_spin_lock_irqsave(&irq_rover_lock, flags);
372372

373-
irq_rover = cpumask_next(irq_rover, cpu_online_mask);
374-
if (irq_rover >= nr_cpu_ids)
375-
irq_rover = cpumask_first(cpu_online_mask);
376-
373+
irq_rover = cpumask_next_wrap(irq_rover, cpu_online_mask);
377374
cpuid = irq_rover;
378375

379376
raw_spin_unlock_irqrestore(&irq_rover_lock, flags);

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;

arch/powerpc/mm/book3s64/hash_utils.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1299,9 +1299,7 @@ static void stress_hpt_timer_fn(struct timer_list *timer)
12991299
if (!firmware_has_feature(FW_FEATURE_LPAR))
13001300
tlbiel_all();
13011301

1302-
next_cpu = cpumask_next(raw_smp_processor_id(), cpu_online_mask);
1303-
if (next_cpu >= nr_cpu_ids)
1304-
next_cpu = cpumask_first(cpu_online_mask);
1302+
next_cpu = cpumask_next_wrap(raw_smp_processor_id(), cpu_online_mask);
13051303
stress_hpt_timer.expires = jiffies + msecs_to_jiffies(10);
13061304
add_timer_on(&stress_hpt_timer, next_cpu);
13071305
}

arch/powerpc/sysdev/xive/common.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -548,11 +548,10 @@ static void xive_dec_target_count(int cpu)
548548
static int xive_find_target_in_mask(const struct cpumask *mask,
549549
unsigned int fuzz)
550550
{
551-
int cpu, first, num, i;
551+
int cpu, first, i;
552552

553-
/* Pick up a starting point CPU in the mask based on fuzz */
554-
num = min_t(int, cpumask_weight(mask), nr_cpu_ids);
555-
first = fuzz % num;
553+
/* Pick up a starting point CPU in the mask based on fuzz */
554+
first = fuzz % cpumask_weight(mask);
556555

557556
/* Locate it */
558557
cpu = cpumask_first(mask);
@@ -577,10 +576,7 @@ static int xive_find_target_in_mask(const struct cpumask *mask,
577576
*/
578577
if (cpu_online(cpu) && xive_try_pick_target(cpu))
579578
return cpu;
580-
cpu = cpumask_next(cpu, mask);
581-
/* Wrap around */
582-
if (cpu >= nr_cpu_ids)
583-
cpu = cpumask_first(mask);
579+
cpu = cpumask_next_wrap(cpu, mask);
584580
} while (cpu != first);
585581

586582
return -1;

0 commit comments

Comments
 (0)