Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1329882

[PATCH V4 7/7] cpufreq: ondemand: Rearrange od_dbs_timer() to void updating delay

From Viresh Kumar <viresh.kumar@linaro.org>
Newsgroups linux.kernel
Subject [PATCH V4 7/7] cpufreq: ondemand: Rearrange od_dbs_timer() to void updating delay
Date 2016-02-09 04:50 +0100
Message-ID <r07to-6FT-9@gated-at.bofh.it> (permalink)
References <r07tn-6FT-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


'delay' is updated properly in all paths of the routine od_dbs_timer(),
leaving just one. And can be 0 only in that case.

Move the update to 'delay' as an else part of the if block.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 drivers/cpufreq/cpufreq_ondemand.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c
index d9f323f150c4..388ae07ce413 100644
--- a/drivers/cpufreq/cpufreq_ondemand.c
+++ b/drivers/cpufreq/cpufreq_ondemand.c
@@ -194,7 +194,7 @@ static unsigned int od_dbs_timer(struct cpufreq_policy *policy)
 	struct policy_dbs_info *policy_dbs = policy->governor_data;
 	struct dbs_data *dbs_data = policy_dbs->dbs_data;
 	struct od_cpu_dbs_info_s *dbs_info = &per_cpu(od_cpu_dbs_info, policy->cpu);
-	int delay = 0, sample_type = dbs_info->sample_type;
+	int delay, sample_type = dbs_info->sample_type;
 
 	/* Common NORMAL_SAMPLE setup */
 	dbs_info->sample_type = OD_NORMAL_SAMPLE;
@@ -208,13 +208,12 @@ static unsigned int od_dbs_timer(struct cpufreq_policy *policy)
 			/* Setup timer for SUB_SAMPLE */
 			dbs_info->sample_type = OD_SUB_SAMPLE;
 			delay = dbs_info->freq_hi_jiffies;
+		} else {
+			delay = delay_for_sampling_rate(dbs_data->sampling_rate
+							* dbs_info->rate_mult);
 		}
 	}
 
-	if (!delay)
-		delay = delay_for_sampling_rate(dbs_data->sampling_rate
-				* dbs_info->rate_mult);
-
 	return delay;
 }
 
-- 
2.7.1.370.gb2aa7f8

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH V4 0/7] cpufreq: Locking fixes and cleanups Viresh Kumar <viresh.kumar@linaro.org> - 2016-02-09 04:50 +0100
  [PATCH V4 7/7] cpufreq: ondemand: Rearrange od_dbs_timer() to void updating delay Viresh Kumar <viresh.kumar@linaro.org> - 2016-02-09 04:50 +0100
    Re: [PATCH V4 7/7] cpufreq: ondemand: Rearrange od_dbs_timer() to  void updating delay "Rafael J. Wysocki" <rafael@kernel.org> - 2016-02-10 01:30 +0100
  [PATCH V4 5/7] cpufreq: governor: No need to manage state machine now Viresh Kumar <viresh.kumar@linaro.org> - 2016-02-09 04:50 +0100
    Re: [PATCH V4 5/7] cpufreq: governor: No need to manage state machine now "Rafael J. Wysocki" <rafael@kernel.org> - 2016-02-10 01:40 +0100
      Re: [PATCH V4 5/7] cpufreq: governor: No need to manage state  machine now Viresh Kumar <viresh.kumar@linaro.org> - 2016-02-10 06:40 +0100
  [PATCH V4 2/7] cpufreq: Call __cpufreq_governor() with policy->rwsem held Viresh Kumar <viresh.kumar@linaro.org> - 2016-02-09 04:50 +0100
    Re: [PATCH V4 2/7] cpufreq: Call __cpufreq_governor() with  policy->rwsem held "Rafael J. Wysocki" <rafael@kernel.org> - 2016-02-11 10:50 +0100
      Re: [PATCH V4 2/7] cpufreq: Call __cpufreq_governor() with  policy->rwsem held Viresh Kumar <viresh.kumar@linaro.org> - 2016-02-11 13:00 +0100
  [PATCH V4 1/7] cpufreq: Merge cpufreq_offline_prepare/finish routines Viresh Kumar <viresh.kumar@linaro.org> - 2016-02-09 05:00 +0100
    Re: [PATCH V4 1/7] cpufreq: Merge cpufreq_offline_prepare/finish routines "Rafael J. Wysocki" <rafael@kernel.org> - 2016-02-11 02:00 +0100
      Re: [PATCH V4 1/7] cpufreq: Merge cpufreq_offline_prepare/finish routines "Rafael J. Wysocki" <rafael@kernel.org> - 2016-02-11 02:20 +0100
        Re: [PATCH V4 1/7] cpufreq: Merge cpufreq_offline_prepare/finish  routines Viresh Kumar <viresh.kumar@linaro.org> - 2016-02-11 12:50 +0100

csiph-web