[PATCH v1 3/4] cpuidle: governors: teo: Use s64 consistently in teo_update()

Rafael J. Wysocki posted 1 patch 2 months, 3 weeks ago
drivers/cpuidle/governors/teo.c |    7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
[PATCH v1 3/4] cpuidle: governors: teo: Use s64 consistently in teo_update()
Posted by Rafael J. Wysocki 2 months, 3 weeks ago
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Two local variables in teo_update() are defined as u64, but their
values are then compared with s64 values, so it is more consistent
to use s64 as their data type.

No intentional functional impact.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/cpuidle/governors/teo.c |    7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

--- a/drivers/cpuidle/governors/teo.c
+++ b/drivers/cpuidle/governors/teo.c
@@ -157,8 +157,7 @@ static void teo_update(struct cpuidle_dr
 {
 	struct teo_cpu *cpu_data = per_cpu_ptr(&teo_cpus, dev->cpu);
 	int i, idx_timer = 0, idx_duration = 0;
-	s64 target_residency_ns;
-	u64 measured_ns;
+	s64 target_residency_ns, measured_ns;
 
 	cpu_data->short_idles -= cpu_data->short_idles >> DECAY_SHIFT;
 
@@ -167,9 +166,9 @@ static void teo_update(struct cpuidle_dr
 		 * If one of the safety nets has triggered, assume that this
 		 * might have been a long sleep.
 		 */
-		measured_ns = U64_MAX;
+		measured_ns = S64_MAX;
 	} else {
-		u64 lat_ns = drv->states[dev->last_state_idx].exit_latency_ns;
+		s64 lat_ns = drv->states[dev->last_state_idx].exit_latency_ns;
 
 		measured_ns = dev->last_residency_ns;
 		/*
Re: [PATCH v1 3/4] cpuidle: governors: teo: Use s64 consistently in teo_update()
Posted by Christian Loehle 2 months, 3 weeks ago
On 11/12/25 16:24, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> Two local variables in teo_update() are defined as u64, but their
> values are then compared with s64 values, so it is more consistent
> to use s64 as their data type.
> 
> No intentional functional impact.
> 
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Reviewed-by: Christian Loehle <christian.loehle@arm.com>

> ---
>  drivers/cpuidle/governors/teo.c |    7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> --- a/drivers/cpuidle/governors/teo.c
> +++ b/drivers/cpuidle/governors/teo.c
> @@ -157,8 +157,7 @@ static void teo_update(struct cpuidle_dr
>  {
>  	struct teo_cpu *cpu_data = per_cpu_ptr(&teo_cpus, dev->cpu);
>  	int i, idx_timer = 0, idx_duration = 0;
> -	s64 target_residency_ns;
> -	u64 measured_ns;
> +	s64 target_residency_ns, measured_ns;
>  
>  	cpu_data->short_idles -= cpu_data->short_idles >> DECAY_SHIFT;
>  
> @@ -167,9 +166,9 @@ static void teo_update(struct cpuidle_dr
>  		 * If one of the safety nets has triggered, assume that this
>  		 * might have been a long sleep.
>  		 */
> -		measured_ns = U64_MAX;
> +		measured_ns = S64_MAX;
>  	} else {
> -		u64 lat_ns = drv->states[dev->last_state_idx].exit_latency_ns;
> +		s64 lat_ns = drv->states[dev->last_state_idx].exit_latency_ns;
>  
>  		measured_ns = dev->last_residency_ns;
>  		/*
> 
> 
>