From c8ed00107b60b4a890798677d75e5c2910f393bb Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Thu, 5 Mar 2015 10:49:19 +1030 Subject: Fix weird uses of num_online_cpus(). This may be OK in archs with contiguous CPU numbers and without hotplug CPUs, but it sets a terrible example. And open-coding it like drivers/scsi/hpsa.c is just weird. BTRFS has a weird comparison with num_online_cpus() too, but since BTRFS just screwed up my test machines' root partition, I'm not touching it :) Signed-off-by: Rusty Russell Reported-by: Oleg Drokin --- drivers/scsi/hpsa.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'drivers/scsi') diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c index a1cfbd3dda47..8eab107b53fb 100644 --- a/drivers/scsi/hpsa.c +++ b/drivers/scsi/hpsa.c @@ -6632,14 +6632,12 @@ static void fail_all_outstanding_cmds(struct ctlr_info *h) static void set_lockup_detected_for_all_cpus(struct ctlr_info *h, u32 value) { - int i, cpu; + int cpu; - cpu = cpumask_first(cpu_online_mask); - for (i = 0; i < num_online_cpus(); i++) { + for_each_online_cpu(cpu) { u32 *lockup_detected; lockup_detected = per_cpu_ptr(h->lockup_detected, cpu); *lockup_detected = value; - cpu = cpumask_next(cpu, cpu_online_mask); } wmb(); /* be sure the per-cpu variables are out to memory */ } -- cgit v1.2.3