linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/2] cpufreq: ondemand: Refactor frequency increase code
@ 2010-01-26  1:47 Mike Chan
  2010-01-26  1:47 ` [PATCH v2 2/2] cpufreq: ondemand: Independent max speed for nice threads with nice_max_freq Mike Chan
  2010-01-26 19:31 ` [PATCH v2 1/2] cpufreq: ondemand: Refactor frequency increase code Pallipadi, Venkatesh
  0 siblings, 2 replies; 4+ messages in thread
From: Mike Chan @ 2010-01-26  1:47 UTC (permalink / raw)
  Cc: venkatesh.pallipadi, tj, Miller, cpufreq, linux-kernel, Mike Chan

Make simpler to read and call.

Signed-off-by: Mike Chan <mike@android.com>
---
 drivers/cpufreq/cpufreq_ondemand.c |   26 +++++++++++++-------------
 1 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c
index 4b34ade..3dcf126 100644
--- a/drivers/cpufreq/cpufreq_ondemand.c
+++ b/drivers/cpufreq/cpufreq_ondemand.c
@@ -443,6 +443,17 @@ static struct attribute_group dbs_attr_group_old = {
 
 /************************** sysfs end ************************/
 
+static int dbs_freq_increase(struct cpufreq_policy *p, unsigned int target_freq)
+{
+	if (dbs_tuners_ins.powersave_bias)
+		target_freq = powersave_bias_target(p, target_freq,
+				CPUFREQ_RELATION_H);
+
+	__cpufreq_driver_target(p, target_freq,
+			dbs_tuners_ins.powersave_bias ?
+			CPUFREQ_RELATION_L : CPUFREQ_RELATION_H);
+}
+
 static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info)
 {
 	unsigned int max_load_freq;
@@ -520,19 +531,8 @@ static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info)
 
 	/* Check for frequency increase */
 	if (max_load_freq > dbs_tuners_ins.up_threshold * policy->cur) {
-		/* if we are already at full speed then break out early */
-		if (!dbs_tuners_ins.powersave_bias) {
-			if (policy->cur == policy->max)
-				return;
-
-			__cpufreq_driver_target(policy, policy->max,
-				CPUFREQ_RELATION_H);
-		} else {
-			int freq = powersave_bias_target(policy, policy->max,
-					CPUFREQ_RELATION_H);
-			__cpufreq_driver_target(policy, freq,
-				CPUFREQ_RELATION_L);
-		}
+		if (policy->cur != policy->max)
+			dbs_freq_increase(policy, policy->max);
 		return;
 	}
 
-- 
1.6.6


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

end of thread, other threads:[~2010-01-28  0:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-26  1:47 [PATCH v2 1/2] cpufreq: ondemand: Refactor frequency increase code Mike Chan
2010-01-26  1:47 ` [PATCH v2 2/2] cpufreq: ondemand: Independent max speed for nice threads with nice_max_freq Mike Chan
2010-01-28  0:17   ` Andrew Morton
2010-01-26 19:31 ` [PATCH v2 1/2] cpufreq: ondemand: Refactor frequency increase code Pallipadi, Venkatesh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).