cpufreq: schedutil: Simplify sugov_fast_switch()
diff mbox series

Message ID 1869109.WhRmcVd4D2@kreacher
State Accepted
Commit 86836bac55f971995499978df4e62115d7baf5ef
Headers show
Series
  • cpufreq: schedutil: Simplify sugov_fast_switch()
Related show

Commit Message

Rafael J. Wysocki Oct. 6, 2020, 12:01 p.m. UTC
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Drop a redundant local variable definition from sugov_fast_switch()
and rearrange the code in there to avoid the redundant logical
negation.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---

The code reads a bit easier after this change IMV.

linux-next material.

---
 kernel/sched/cpufreq_schedutil.c |    8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

Comments

Viresh Kumar Oct. 7, 2020, 5:11 a.m. UTC | #1
On 06-10-20, 14:01, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> Drop a redundant local variable definition from sugov_fast_switch()
> and rearrange the code in there to avoid the redundant logical
> negation.
> 
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
> 
> The code reads a bit easier after this change IMV.
> 
> linux-next material.
> 
> ---
>  kernel/sched/cpufreq_schedutil.c |    8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> Index: linux-pm/kernel/sched/cpufreq_schedutil.c
> ===================================================================
> --- linux-pm.orig/kernel/sched/cpufreq_schedutil.c
> +++ linux-pm/kernel/sched/cpufreq_schedutil.c
> @@ -114,12 +114,8 @@ static bool sugov_update_next_freq(struc
>  static void sugov_fast_switch(struct sugov_policy *sg_policy, u64 time,
>  			      unsigned int next_freq)
>  {
> -	struct cpufreq_policy *policy = sg_policy->policy;
> -
> -	if (!sugov_update_next_freq(sg_policy, time, next_freq))
> -		return;
> -
> -	cpufreq_driver_fast_switch(policy, next_freq);
> +	if (sugov_update_next_freq(sg_policy, time, next_freq))
> +		cpufreq_driver_fast_switch(sg_policy->policy, next_freq);
>  }
>  
>  static void sugov_deferred_update(struct sugov_policy *sg_policy, u64 time,

Acked-by: Viresh Kumar <viresh.kumar@linaro.org>

Patch
diff mbox series

Index: linux-pm/kernel/sched/cpufreq_schedutil.c
===================================================================
--- linux-pm.orig/kernel/sched/cpufreq_schedutil.c
+++ linux-pm/kernel/sched/cpufreq_schedutil.c
@@ -114,12 +114,8 @@  static bool sugov_update_next_freq(struc
 static void sugov_fast_switch(struct sugov_policy *sg_policy, u64 time,
 			      unsigned int next_freq)
 {
-	struct cpufreq_policy *policy = sg_policy->policy;
-
-	if (!sugov_update_next_freq(sg_policy, time, next_freq))
-		return;
-
-	cpufreq_driver_fast_switch(policy, next_freq);
+	if (sugov_update_next_freq(sg_policy, time, next_freq))
+		cpufreq_driver_fast_switch(sg_policy->policy, next_freq);
 }
 
 static void sugov_deferred_update(struct sugov_policy *sg_policy, u64 time,