From 13adfbfa04da0d025ad71d68b548e85d7caa3ec1 Mon Sep 17 00:00:00 2001 From: Vincent Guittot Date: Thu, 25 Apr 2024 09:37:09 +0200 Subject: [PATCH] BACKPORT: arch/topology: Fix variable naming to avoid shadowing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Using 'hw_pressure' for local variable name is confusing in regard to the per-CPU 'hw_pressure' variable that uses the same name: include/linux/arch_topology.h:DECLARE_PER_CPU(unsigned long, hw_pressure); ... which puts it into a global scope for all code that includes , shadowing the local variable. Rename it to avoid compiler confusion & Sparse warnings. [ mingo: Expanded the changelog. ] Reported-by: kernel test robot Change-Id: I4dd0832d45cac59e11d964df04a275d976225946 Signed-off-by: Vincent Guittot Signed-off-by: Ingo Molnar Reviewed-by: Lukasz Luba Reviewed-by: Konrad Dybcio Acked-by: Sudeep Holla Cc: Linus Torvalds Link: https://lore.kernel.org/r/20240425073709.379016-1-vincent.guittot@linaro.org Closes: https://lore.kernel.org/oe-kbuild-all/202404250740.VhQQoD7N-lkp@intel.com/ Fixes: d4dbc991714e ("sched/cpufreq: Rename arch_update_thermal_pressure() => arch_update_hw_pressure()") Tested-by: Konrad Dybcio # QC SM8550 QRD (cherry picked from commit e5bc44e47c531860be96ac615314b1ab23d5aa2b) [AD: fix merge conflict] Signed-off-by: André Draszik --- drivers/base/arch_topology.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c index 593500ab4aea..5cd78388f459 100644 --- a/drivers/base/arch_topology.c +++ b/drivers/base/arch_topology.c @@ -183,7 +183,7 @@ EXPORT_PER_CPU_SYMBOL_GPL(hw_pressure); void topology_update_hw_pressure(const struct cpumask *cpus, unsigned long capped_freq) { - unsigned long max_capacity, capacity, hw_pressure; + unsigned long max_capacity, capacity, pressure; u32 max_freq; int cpu; @@ -200,12 +200,12 @@ void topology_update_hw_pressure(const struct cpumask *cpus, else capacity = mult_frac(max_capacity, capped_freq, max_freq); - hw_pressure = max_capacity - capacity; + pressure = max_capacity - capacity; - trace_hw_pressure_update(cpu, hw_pressure); + trace_hw_pressure_update(cpu, pressure); for_each_cpu(cpu, cpus) { - WRITE_ONCE(per_cpu(hw_pressure, cpu), hw_pressure); + WRITE_ONCE(per_cpu(hw_pressure, cpu), pressure); trace_android_rvh_update_thermal_stats(cpu); } }