diff options
Diffstat (limited to 'arch/x86/kernel/cpuid.c')
-rw-r--r-- | arch/x86/kernel/cpuid.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/arch/x86/kernel/cpuid.c b/arch/x86/kernel/cpuid.c index 39472dd2323f..60c78917190c 100644 --- a/arch/x86/kernel/cpuid.c +++ b/arch/x86/kernel/cpuid.c | |||
@@ -199,12 +199,14 @@ static int __init cpuid_init(void) | |||
199 | goto out_chrdev; | 199 | goto out_chrdev; |
200 | } | 200 | } |
201 | cpuid_class->devnode = cpuid_devnode; | 201 | cpuid_class->devnode = cpuid_devnode; |
202 | get_online_cpus(); | ||
202 | for_each_online_cpu(i) { | 203 | for_each_online_cpu(i) { |
203 | err = cpuid_device_create(i); | 204 | err = cpuid_device_create(i); |
204 | if (err != 0) | 205 | if (err != 0) |
205 | goto out_class; | 206 | goto out_class; |
206 | } | 207 | } |
207 | register_hotcpu_notifier(&cpuid_class_cpu_notifier); | 208 | register_hotcpu_notifier(&cpuid_class_cpu_notifier); |
209 | put_online_cpus(); | ||
208 | 210 | ||
209 | err = 0; | 211 | err = 0; |
210 | goto out; | 212 | goto out; |
@@ -214,6 +216,7 @@ out_class: | |||
214 | for_each_online_cpu(i) { | 216 | for_each_online_cpu(i) { |
215 | cpuid_device_destroy(i); | 217 | cpuid_device_destroy(i); |
216 | } | 218 | } |
219 | put_online_cpus(); | ||
217 | class_destroy(cpuid_class); | 220 | class_destroy(cpuid_class); |
218 | out_chrdev: | 221 | out_chrdev: |
219 | __unregister_chrdev(CPUID_MAJOR, 0, NR_CPUS, "cpu/cpuid"); | 222 | __unregister_chrdev(CPUID_MAJOR, 0, NR_CPUS, "cpu/cpuid"); |
@@ -225,11 +228,13 @@ static void __exit cpuid_exit(void) | |||
225 | { | 228 | { |
226 | int cpu = 0; | 229 | int cpu = 0; |
227 | 230 | ||
231 | get_online_cpus(); | ||
228 | for_each_online_cpu(cpu) | 232 | for_each_online_cpu(cpu) |
229 | cpuid_device_destroy(cpu); | 233 | cpuid_device_destroy(cpu); |
230 | class_destroy(cpuid_class); | 234 | class_destroy(cpuid_class); |
231 | __unregister_chrdev(CPUID_MAJOR, 0, NR_CPUS, "cpu/cpuid"); | 235 | __unregister_chrdev(CPUID_MAJOR, 0, NR_CPUS, "cpu/cpuid"); |
232 | unregister_hotcpu_notifier(&cpuid_class_cpu_notifier); | 236 | unregister_hotcpu_notifier(&cpuid_class_cpu_notifier); |
237 | put_online_cpus(); | ||
233 | } | 238 | } |
234 | 239 | ||
235 | module_init(cpuid_init); | 240 | module_init(cpuid_init); |