public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 1/2] thermal/cpufreq_cooling: remove unused cpu_idx in get_load()
@ 2026-03-20 11:31 Xuewen Yan
  2026-03-20 11:31 ` [RFC PATCH 2/2] thermal/cpufreq_cooling: Use idle_time to get cpu_load when scx_enabled Xuewen Yan
  2026-03-20 12:32 ` [RFC PATCH 1/2] thermal/cpufreq_cooling: remove unused cpu_idx in get_load() Lukasz Luba
  0 siblings, 2 replies; 18+ messages in thread
From: Xuewen Yan @ 2026-03-20 11:31 UTC (permalink / raw)
  To: daniel.lezcano, amit.kachhap, viresh.kumar, lukasz.luba, rafael
  Cc: rui.zhang, linux-pm, linux-kernel, ke.wang, di.shen, jeson.gao,
	xuewen.yan94

From: Di Shen <di.shen@unisoc.com>

The cpu_idx variable in the get_load function is now
unused and can be safely removed.

No code logic is affected.

Signed-off-by: Di Shen <di.shen@unisoc.com>
---
 drivers/thermal/cpufreq_cooling.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/drivers/thermal/cpufreq_cooling.c b/drivers/thermal/cpufreq_cooling.c
index 32bf5ab44f4a..d030dbeb2973 100644
--- a/drivers/thermal/cpufreq_cooling.c
+++ b/drivers/thermal/cpufreq_cooling.c
@@ -151,26 +151,23 @@ static u32 cpu_power_to_freq(struct cpufreq_cooling_device *cpufreq_cdev,
  * get_load() - get load for a cpu
  * @cpufreq_cdev: struct cpufreq_cooling_device for the cpu
  * @cpu: cpu number
- * @cpu_idx: index of the cpu in time_in_idle array
  *
  * Return: The average load of cpu @cpu in percentage since this
  * function was last called.
  */
 #ifdef CONFIG_SMP
-static u32 get_load(struct cpufreq_cooling_device *cpufreq_cdev, int cpu,
-		    int cpu_idx)
+static u32 get_load(struct cpufreq_cooling_device *cpufreq_cdev, int cpu)
 {
 	unsigned long util = sched_cpu_util(cpu);
 
 	return (util * 100) / arch_scale_cpu_capacity(cpu);
 }
 #else /* !CONFIG_SMP */
-static u32 get_load(struct cpufreq_cooling_device *cpufreq_cdev, int cpu,
-		    int cpu_idx)
+static u32 get_load(struct cpufreq_cooling_device *cpufreq_cdev, int cpu)
 {
 	u32 load;
 	u64 now, now_idle, delta_time, delta_idle;
-	struct time_in_idle *idle_time = &cpufreq_cdev->idle_time[cpu_idx];
+	struct time_in_idle *idle_time = &cpufreq_cdev->idle_time[cpu];
 
 	now_idle = get_cpu_idle_time(cpu, &now, 0);
 	delta_idle = now_idle - idle_time->time;
@@ -231,7 +228,7 @@ static int cpufreq_get_requested_power(struct thermal_cooling_device *cdev,
 				       u32 *power)
 {
 	unsigned long freq;
-	int i = 0, cpu;
+	int cpu;
 	u32 total_load = 0;
 	struct cpufreq_cooling_device *cpufreq_cdev = cdev->devdata;
 	struct cpufreq_policy *policy = cpufreq_cdev->policy;
@@ -242,7 +239,7 @@ static int cpufreq_get_requested_power(struct thermal_cooling_device *cdev,
 		u32 load;
 
 		if (cpu_online(cpu))
-			load = get_load(cpufreq_cdev, cpu, i);
+			load = get_load(cpufreq_cdev, cpu);
 		else
 			load = 0;
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2026-03-28  8:09 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-20 11:31 [RFC PATCH 1/2] thermal/cpufreq_cooling: remove unused cpu_idx in get_load() Xuewen Yan
2026-03-20 11:31 ` [RFC PATCH 2/2] thermal/cpufreq_cooling: Use idle_time to get cpu_load when scx_enabled Xuewen Yan
2026-03-24  1:41   ` Qais Yousef
2026-03-20 12:32 ` [RFC PATCH 1/2] thermal/cpufreq_cooling: remove unused cpu_idx in get_load() Lukasz Luba
2026-03-21  8:48   ` Xuewen Yan
2026-03-23  5:34   ` Viresh Kumar
2026-03-23  9:20     ` Lukasz Luba
2026-03-23 10:41       ` Viresh Kumar
2026-03-23 10:52         ` Lukasz Luba
2026-03-23 11:06           ` Viresh Kumar
2026-03-23 13:25             ` Lukasz Luba
2026-03-24  2:20               ` Xuewen Yan
2026-03-24 10:46                 ` Lukasz Luba
2026-03-24 12:03                   ` Xuewen Yan
2026-03-25  8:31                     ` Lukasz Luba
2026-03-26  9:05                   ` Qais Yousef
2026-03-26  9:21                     ` Lukasz Luba
2026-03-28  8:09                       ` Qais Yousef

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox