diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2015-03-04 19:19:19 -0500 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2015-03-09 23:24:42 -0400 |
commit | c8ed00107b60b4a890798677d75e5c2910f393bb (patch) | |
tree | 48a0440907bbef7d8d1d71d090881ba00192ee65 /drivers | |
parent | 2f0f267ea0720ec6adbe9cf7386450425fac8258 (diff) |
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 <rusty@rustcorp.com.au>
Reported-by: Oleg Drokin <green@linuxhacker.ru>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/scsi/hpsa.c | 6 |
1 files changed, 2 insertions, 4 deletions
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) | |||
6632 | 6632 | ||
6633 | static void set_lockup_detected_for_all_cpus(struct ctlr_info *h, u32 value) | 6633 | static void set_lockup_detected_for_all_cpus(struct ctlr_info *h, u32 value) |
6634 | { | 6634 | { |
6635 | int i, cpu; | 6635 | int cpu; |
6636 | 6636 | ||
6637 | cpu = cpumask_first(cpu_online_mask); | 6637 | for_each_online_cpu(cpu) { |
6638 | for (i = 0; i < num_online_cpus(); i++) { | ||
6639 | u32 *lockup_detected; | 6638 | u32 *lockup_detected; |
6640 | lockup_detected = per_cpu_ptr(h->lockup_detected, cpu); | 6639 | lockup_detected = per_cpu_ptr(h->lockup_detected, cpu); |
6641 | *lockup_detected = value; | 6640 | *lockup_detected = value; |
6642 | cpu = cpumask_next(cpu, cpu_online_mask); | ||
6643 | } | 6641 | } |
6644 | wmb(); /* be sure the per-cpu variables are out to memory */ | 6642 | wmb(); /* be sure the per-cpu variables are out to memory */ |
6645 | } | 6643 | } |