diff options
Diffstat (limited to 'arch/i386/kernel/microcode.c')
-rw-r--r-- | arch/i386/kernel/microcode.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/arch/i386/kernel/microcode.c b/arch/i386/kernel/microcode.c index d3fdf0057d82..5390b521aca0 100644 --- a/arch/i386/kernel/microcode.c +++ b/arch/i386/kernel/microcode.c | |||
@@ -74,6 +74,7 @@ | |||
74 | #include <linux/kernel.h> | 74 | #include <linux/kernel.h> |
75 | #include <linux/init.h> | 75 | #include <linux/init.h> |
76 | #include <linux/sched.h> | 76 | #include <linux/sched.h> |
77 | #include <linux/cpumask.h> | ||
77 | #include <linux/module.h> | 78 | #include <linux/module.h> |
78 | #include <linux/slab.h> | 79 | #include <linux/slab.h> |
79 | #include <linux/vmalloc.h> | 80 | #include <linux/vmalloc.h> |
@@ -250,8 +251,8 @@ static int find_matching_ucodes (void) | |||
250 | error = -EINVAL; | 251 | error = -EINVAL; |
251 | goto out; | 252 | goto out; |
252 | } | 253 | } |
253 | 254 | ||
254 | for (cpu_num = 0; cpu_num < num_online_cpus(); cpu_num++) { | 255 | for_each_online_cpu(cpu_num) { |
255 | struct ucode_cpu_info *uci = ucode_cpu_info + cpu_num; | 256 | struct ucode_cpu_info *uci = ucode_cpu_info + cpu_num; |
256 | if (uci->err != MC_NOTFOUND) /* already found a match or not an online cpu*/ | 257 | if (uci->err != MC_NOTFOUND) /* already found a match or not an online cpu*/ |
257 | continue; | 258 | continue; |
@@ -293,7 +294,7 @@ static int find_matching_ucodes (void) | |||
293 | error = -EFAULT; | 294 | error = -EFAULT; |
294 | goto out; | 295 | goto out; |
295 | } | 296 | } |
296 | for (cpu_num = 0; cpu_num < num_online_cpus(); cpu_num++) { | 297 | for_each_online_cpu(cpu_num) { |
297 | struct ucode_cpu_info *uci = ucode_cpu_info + cpu_num; | 298 | struct ucode_cpu_info *uci = ucode_cpu_info + cpu_num; |
298 | if (uci->err != MC_NOTFOUND) /* already found a match or not an online cpu*/ | 299 | if (uci->err != MC_NOTFOUND) /* already found a match or not an online cpu*/ |
299 | continue; | 300 | continue; |
@@ -304,7 +305,9 @@ static int find_matching_ucodes (void) | |||
304 | } | 305 | } |
305 | } | 306 | } |
306 | /* now check if any cpu has matched */ | 307 | /* now check if any cpu has matched */ |
307 | for (cpu_num = 0, allocated_flag = 0, sum = 0; cpu_num < num_online_cpus(); cpu_num++) { | 308 | allocated_flag = 0; |
309 | sum = 0; | ||
310 | for_each_online_cpu(cpu_num) { | ||
308 | if (ucode_cpu_info[cpu_num].err == MC_MARKED) { | 311 | if (ucode_cpu_info[cpu_num].err == MC_MARKED) { |
309 | struct ucode_cpu_info *uci = ucode_cpu_info + cpu_num; | 312 | struct ucode_cpu_info *uci = ucode_cpu_info + cpu_num; |
310 | if (!allocated_flag) { | 313 | if (!allocated_flag) { |
@@ -415,12 +418,12 @@ static int do_microcode_update (void) | |||
415 | } | 418 | } |
416 | 419 | ||
417 | out_free: | 420 | out_free: |
418 | for (i = 0; i < num_online_cpus(); i++) { | 421 | for_each_online_cpu(i) { |
419 | if (ucode_cpu_info[i].mc) { | 422 | if (ucode_cpu_info[i].mc) { |
420 | int j; | 423 | int j; |
421 | void *tmp = ucode_cpu_info[i].mc; | 424 | void *tmp = ucode_cpu_info[i].mc; |
422 | vfree(tmp); | 425 | vfree(tmp); |
423 | for (j = i; j < num_online_cpus(); j++) { | 426 | for_each_online_cpu(j) { |
424 | if (ucode_cpu_info[j].mc == tmp) | 427 | if (ucode_cpu_info[j].mc == tmp) |
425 | ucode_cpu_info[j].mc = NULL; | 428 | ucode_cpu_info[j].mc = NULL; |
426 | } | 429 | } |