[tip:smp/hotplug] x86/mce/therm_throt: Move hotplug callbacks to online

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Commit-ID:  33d97302eb502b72b76107d3122afbf18b09b3ec
Gitweb:     http://git.kernel.org/tip/33d97302eb502b72b76107d3122afbf18b09b3ec
Author:     Thomas Gleixner <tglx@xxxxxxxxxxxxx>
AuthorDate: Mon, 21 Nov 2016 13:15:32 +0100
Committer:  Thomas Gleixner <tglx@xxxxxxxxxxxxx>
CommitDate: Tue, 22 Nov 2016 23:34:38 +0100

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@xxxxxxxxxxxxx>
Cc: Sebastian Siewior <bigeasy@xxxxxxxxxxxxx>
Cc: Tony Luck <tony.luck@xxxxxxxxx>
Cc: Borislav Petkov <bp@xxxxxxxxx>

---
 arch/x86/kernel/cpu/mcheck/therm_throt.c | 13 ++++++++-----
 include/linux/cpuhotplug.h               |  1 -
 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 7f56620..e1d74fd 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)
 }
 
 /* Get notified when a cpu comes on/off. Be hotplug friendly. */
-static int thermal_throttle_prepare(unsigned int cpu)
+static int thermal_throttle_online(unsigned int cpu)
 {
 	struct device *dev = get_cpu_device(cpu);
 
 	return thermal_throttle_add_dev(dev, cpu);
 }
 
-static int thermal_throttle_dead(unsigned int cpu)
+static int thermal_throttle_offline(unsigned int cpu)
 {
 	struct device *dev = get_cpu_device(cpu);
 
@@ -288,12 +288,15 @@ static int thermal_throttle_dead(unsigned int cpu)
 
 static __init int thermal_throttle_init_device(void)
 {
+	int ret;
+
 	if (!atomic_read(&therm_throt_en))
 		return 0;
 
-	return cpuhp_setup_state(CPUHP_X86_THERM_PREPARE, "x86/therm:prepare",
-				 thermal_throttle_prepare,
-				 thermal_throttle_dead);
+	ret = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "x86/therm:online",
+				thermal_throttle_online,
+				thermal_throttle_offline);
+	return ret < 0 ? ret : 0;
 }
 device_initcall(thermal_throttle_init_device);
 
diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h
index aea6c6a..79b96f6 100644
--- a/include/linux/cpuhotplug.h
+++ b/include/linux/cpuhotplug.h
@@ -59,7 +59,6 @@ enum cpuhp_state {
 	CPUHP_BLK_MQ_PREPARE,
 	CPUHP_NET_FLOW_PREPARE,
 	CPUHP_TOPOLOGY_PREPARE,
-	CPUHP_X86_THERM_PREPARE,
 	CPUHP_TIMERS_DEAD,
 	CPUHP_NOTF_ERR_INJ_PREPARE,
 	CPUHP_MIPS_SOC_PREPARE,
--
To unsubscribe from this list: send the line "unsubscribe linux-tip-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Stable Commits]     [Linux Stable Kernel]     [Linux Kernel]     [Linux USB Devel]     [Linux Video &Media]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux