random: Use cpumask_next_wrap() in try_to_generate_entropy()
PATCH 1/1 random: Use cpumask_next_wrap() in try_to_generate_entropy()
Replace the manual sequence of cpumask_next() and cpumask_first() with a single call to cpumask_next_wrap() in try_to_generate_entropy().
Signed-off-by Fushuai Wang <[email protected]>
--- drivers/char/random.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/char/random.c +1 -3
@@ -1336,9 +1336,7 @@ static void __cold try_to_generate_entropy(void)/* Basic CPU round-robin, which avoids the current CPU. */ do { - cpu =cpumask_next (cpu, &timer_cpus); -if (cpu >= nr_cpu_ids) - cpu =cpumask_first (&timer_cpus); + cpu =cpumask_next_wrap (cpu, &timer_cpus); }while (cpu ==smp_processor_id () && num_cpus >1 );/* Expiring the timer at `jiffies` means it's the next tick. */
Signature · 1 line
2.36.1