diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2016-11-22 17:57:06 +0000 |
---|---|---|
committer | Zhang Rui <rui.zhang@intel.com> | 2016-11-30 10:24:44 +0800 |
commit | 21a3d3d4c8f373054421443e244c75a94a40b1ae (patch) | |
tree | 036b8b71c35a3e2ad8eec7f0f4a08a0dfef59679 /drivers/thermal | |
parent | 89baa56be7fad333db0a91198bf4026017ab737d (diff) | |
download | linux-21a3d3d4c8f373054421443e244c75a94a40b1ae.tar.bz2 |
thermal/x86_pkg_temp: Replace open coded cpu search
find_next_sibling() iterates over the online cpus and searches for a cpu
with the same package id as the current cpu. This is a pointless exercise
as topology_core_cpumask() allows a simple cpumask search for an online cpu
on the same package.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Diffstat (limited to 'drivers/thermal')
-rw-r--r-- | drivers/thermal/x86_pkg_temp_thermal.c | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/drivers/thermal/x86_pkg_temp_thermal.c b/drivers/thermal/x86_pkg_temp_thermal.c index 95573b2ef201..eea94aabff6f 100644 --- a/drivers/thermal/x86_pkg_temp_thermal.c +++ b/drivers/thermal/x86_pkg_temp_thermal.c @@ -384,18 +384,6 @@ static int pkg_temp_thermal_platform_thermal_notify(__u64 msr_val) return 0; } -static int find_siblings_cpu(int cpu) -{ - int i; - int id = topology_physical_package_id(cpu); - - for_each_online_cpu(i) - if (i != cpu && topology_physical_package_id(i) == id) - return i; - - return 0; -} - static int pkg_temp_thermal_device_add(unsigned int cpu) { int err; @@ -488,9 +476,10 @@ static int pkg_temp_thermal_device_remove(unsigned int cpu) mutex_lock(&phy_dev_list_mutex); /* If we are loosing the first cpu for this package, we need change */ if (phdev->first_cpu == cpu) { - phdev->first_cpu = find_siblings_cpu(cpu); - pr_debug("thermal_device_remove: first cpu switched %d\n", - phdev->first_cpu); + int target = cpumask_any_but(topology_core_cpumask(cpu), cpu); + + phdev->first_cpu = target; + pr_debug("CPU %d down. New first_cpu%d\n", cpu, target); } /* * It is possible that no siblings left as this was the last cpu |