aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2016-11-21 07:15:32 -0500
committerThomas Gleixner <tglx@linutronix.de>2016-11-22 17:34:38 -0500
commit33d97302eb502b72b76107d3122afbf18b09b3ec (patch)
tree53262702b2927e230b6a410b77952702ddd3bae4
parentd6526e73dbbbc4c382c1b16942413eab77ed5e1a (diff)
x86/mce/therm_throt: Move hotplug callbacks to online
No point to have the sysfs files around before the cpu is online and no point to have them 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> Cc: Tony Luck <tony.luck@intel.com> Cc: Borislav Petkov <bp@alien8.de>
-rw-r--r--arch/x86/kernel/cpu/mcheck/therm_throt.c13
-rw-r--r--include/linux/cpuhotplug.h1
2 files changed, 8 insertions, 6 deletions
diff --git a/arch/x86/kernel/cpu/mcheck/therm_throt.c b/arch/x86/kernel/cpu/mcheck/therm_throt.c
index 7f56620735ca..e1d74fd79d5f 100644
--- a/arch/x86/kernel/cpu/mcheck/therm_throt.c
+++ b/arch/x86/kernel/cpu/mcheck/therm_throt.c
@@ -271,14 +271,14 @@ static void thermal_throttle_remove_dev(struct device *dev)
271} 271}
272 272
273/* Get notified when a cpu comes on/off. Be hotplug friendly. */ 273/* Get notified when a cpu comes on/off. Be hotplug friendly. */
274static int thermal_throttle_prepare(unsigned int cpu) 274static int thermal_throttle_online(unsigned int cpu)
275{ 275{
276 struct device *dev = get_cpu_device(cpu); 276 struct device *dev = get_cpu_device(cpu);
277 277
278 return thermal_throttle_add_dev(dev, cpu); 278 return thermal_throttle_add_dev(dev, cpu);
279} 279}
280 280
281static int thermal_throttle_dead(unsigned int cpu) 281static int thermal_throttle_offline(unsigned int cpu)
282{ 282{
283 struct device *dev = get_cpu_device(cpu); 283 struct device *dev = get_cpu_device(cpu);
284 284
@@ -288,12 +288,15 @@ static int thermal_throttle_dead(unsigned int cpu)
288 288
289static __init int thermal_throttle_init_device(void) 289static __init int thermal_throttle_init_device(void)
290{ 290{
291 int ret;
292
291 if (!atomic_read(&therm_throt_en)) 293 if (!atomic_read(&therm_throt_en))
292 return 0; 294 return 0;
293 295
294 return cpuhp_setup_state(CPUHP_X86_THERM_PREPARE, "x86/therm:prepare", 296 ret = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "x86/therm:online",
295 thermal_throttle_prepare, 297 thermal_throttle_online,
296 thermal_throttle_dead); 298 thermal_throttle_offline);
299 return ret < 0 ? ret : 0;
297} 300}
298device_initcall(thermal_throttle_init_device); 301device_initcall(thermal_throttle_init_device);
299 302
diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h
index aea6c6a63139..79b96f647d64 100644
--- a/include/linux/cpuhotplug.h
+++ b/include/linux/cpuhotplug.h
@@ -59,7 +59,6 @@ enum cpuhp_state {
59 CPUHP_BLK_MQ_PREPARE, 59 CPUHP_BLK_MQ_PREPARE,
60 CPUHP_NET_FLOW_PREPARE, 60 CPUHP_NET_FLOW_PREPARE,
61 CPUHP_TOPOLOGY_PREPARE, 61 CPUHP_TOPOLOGY_PREPARE,
62 CPUHP_X86_THERM_PREPARE,
63 CPUHP_TIMERS_DEAD, 62 CPUHP_TIMERS_DEAD,
64 CPUHP_NOTF_ERR_INJ_PREPARE, 63 CPUHP_NOTF_ERR_INJ_PREPARE,
65 CPUHP_MIPS_SOC_PREPARE, 64 CPUHP_MIPS_SOC_PREPARE,