summaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/cpuid.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2016-11-21 13:07:34 +0100
committerThomas Gleixner <tglx@linutronix.de>2016-11-22 23:34:39 +0100
commitee92be9b0d7ad34cb58b61d5c0933d2e5ff7c31d (patch)
tree9959deddb7c42e0e806def751cf67a1f2b9091e5 /arch/x86/kernel/cpuid.c
parentx86/cpuid: Convert to hotplug state machine (diff)
downloadlinux-ee92be9b0d7ad34cb58b61d5c0933d2e5ff7c31d.tar.xz
linux-ee92be9b0d7ad34cb58b61d5c0933d2e5ff7c31d.zip
x86/cpuid: Move the hotplug callbacks to online
No point to have this file around before the cpu is online and no point to have it around until the cpu is dead. Get rid of the explicit state. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: Sebastian Siewior <bigeasy@linutronix.de>
Diffstat (limited to 'arch/x86/kernel/cpuid.c')
-rw-r--r--arch/x86/kernel/cpuid.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/arch/x86/kernel/cpuid.c b/arch/x86/kernel/cpuid.c
index fd85e93e0691..373e372a0e1c 100644
--- a/arch/x86/kernel/cpuid.c
+++ b/arch/x86/kernel/cpuid.c
@@ -45,6 +45,7 @@
#include <asm/msr.h>
static struct class *cpuid_class;
+static enum cpuhp_state cpuhp_cpuid_state;
struct cpuid_regs {
u32 eax, ebx, ecx, edx;
@@ -152,11 +153,12 @@ static int __init cpuid_init(void)
}
cpuid_class->devnode = cpuid_devnode;
- err = cpuhp_setup_state(CPUHP_X86_CPUID_PREPARE, "x86/cpuid:prepare",
+ err = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "x86/cpuid:online",
cpuid_device_create, cpuid_device_destroy);
- if (err)
+ if (err < 0)
goto out_class;
+ cpuhp_cpuid_state = err;
return 0;
out_class:
@@ -165,15 +167,14 @@ out_chrdev:
__unregister_chrdev(CPUID_MAJOR, 0, NR_CPUS, "cpu/cpuid");
return err;
}
+module_init(cpuid_init);
static void __exit cpuid_exit(void)
{
- cpuhp_remove_state(CPUHP_X86_CPUID_PREPARE);
+ cpuhp_remove_state(cpuhp_cpuid_state);
class_destroy(cpuid_class);
__unregister_chrdev(CPUID_MAJOR, 0, NR_CPUS, "cpu/cpuid");
}
-
-module_init(cpuid_init);
module_exit(cpuid_exit);
MODULE_AUTHOR("H. Peter Anvin <hpa@zytor.com>");