linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Fabio Baltieri <fabio.baltieri@linaro.org>
To: "Rafael J. Wysocki" <rjw@sisk.pl>,
	cpufreq@vger.kernel.org, linux-pm@vger.kernel.org,
	Viresh Kumar <viresh.kumar@linaro.org>
Cc: Linus Walleij <linus.walleij@linaro.org>,
	swarren@wwwdotorg.org, linaro-dev@lists.linaro.org,
	Nicolas Pitre <nicolas.pitre@linaro.org>,
	mathieu.poirier@linaro.org, Joseph Lo <josephl@nvidia.com>,
	linux-kernel@vger.kernel.org,
	Fabio Baltieri <fabio.baltieri@linaro.org>
Subject: [PATCH] cpufreq: governors: clean timer init and exit code
Date: Wed, 30 Jan 2013 14:53:37 +0100	[thread overview]
Message-ID: <1359554017-28620-1-git-send-email-fabio.baltieri@linaro.org> (raw)

Drop unused arguments from dbs_timer_init and clean dbs_timer_exit and
cpufreq_governor_dbs to remove non necessary special cases.

Reported-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Fabio Baltieri <fabio.baltieri@linaro.org>
---

Hello Rafael,

that's the cleanup on top of "cpufreq: handle SW coordinated CPUs".

Thanks,
Fabio

 drivers/cpufreq/cpufreq_governor.c | 43 ++++++++++++--------------------------
 1 file changed, 13 insertions(+), 30 deletions(-)

diff --git a/drivers/cpufreq/cpufreq_governor.c b/drivers/cpufreq/cpufreq_governor.c
index ee8b7ca..46f96a4 100644
--- a/drivers/cpufreq/cpufreq_governor.c
+++ b/drivers/cpufreq/cpufreq_governor.c
@@ -169,19 +169,19 @@ bool dbs_sw_coordinated_cpus(struct cpu_dbs_common_info *cdbs)
 }
 EXPORT_SYMBOL_GPL(dbs_sw_coordinated_cpus);
 
-static inline void dbs_timer_init(struct dbs_data *dbs_data,
-				  struct cpu_dbs_common_info *cdbs,
-				  unsigned int sampling_rate,
-				  int cpu)
+static inline void dbs_timer_init(struct dbs_data *dbs_data, int cpu,
+				  unsigned int sampling_rate)
 {
 	int delay = delay_for_sampling_rate(sampling_rate);
-	struct cpu_dbs_common_info *cdbs_local = dbs_data->get_cpu_cdbs(cpu);
+	struct cpu_dbs_common_info *cdbs = dbs_data->get_cpu_cdbs(cpu);
 
-	schedule_delayed_work_on(cpu, &cdbs_local->work, delay);
+	schedule_delayed_work_on(cpu, &cdbs->work, delay);
 }
 
-static inline void dbs_timer_exit(struct cpu_dbs_common_info *cdbs)
+static inline void dbs_timer_exit(struct dbs_data *dbs_data, int cpu)
 {
+	struct cpu_dbs_common_info *cdbs = dbs_data->get_cpu_cdbs(cpu);
+
 	cancel_delayed_work_sync(&cdbs->work);
 }
 
@@ -289,36 +289,19 @@ second_time:
 		}
 		mutex_unlock(&dbs_data->mutex);
 
-		if (dbs_sw_coordinated_cpus(cpu_cdbs)) {
-			/* Initiate timer time stamp */
-			cpu_cdbs->time_stamp = ktime_get();
+		/* Initiate timer time stamp */
+		cpu_cdbs->time_stamp = ktime_get();
 
-			for_each_cpu(j, policy->cpus) {
-				struct cpu_dbs_common_info *j_cdbs;
-
-				j_cdbs = dbs_data->get_cpu_cdbs(j);
-				dbs_timer_init(dbs_data, j_cdbs,
-					       *sampling_rate, j);
-			}
-		} else {
-			dbs_timer_init(dbs_data, cpu_cdbs, *sampling_rate, cpu);
-		}
+		for_each_cpu(j, policy->cpus)
+			dbs_timer_init(dbs_data, j, *sampling_rate);
 		break;
 
 	case CPUFREQ_GOV_STOP:
 		if (dbs_data->governor == GOV_CONSERVATIVE)
 			cs_dbs_info->enable = 0;
 
-		if (dbs_sw_coordinated_cpus(cpu_cdbs)) {
-			for_each_cpu(j, policy->cpus) {
-				struct cpu_dbs_common_info *j_cdbs;
-
-				j_cdbs = dbs_data->get_cpu_cdbs(j);
-				dbs_timer_exit(j_cdbs);
-			}
-		} else {
-			dbs_timer_exit(cpu_cdbs);
-		}
+		for_each_cpu(j, policy->cpus)
+			dbs_timer_exit(dbs_data, j);
 
 		mutex_lock(&dbs_data->mutex);
 		mutex_destroy(&cpu_cdbs->timer_mutex);
-- 
1.7.12.1


             reply	other threads:[~2013-01-30 13:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-30 13:53 Fabio Baltieri [this message]
2013-01-31 10:53 ` [PATCH] cpufreq: governors: clean timer init and exit code Viresh Kumar
2013-01-31 11:06   ` Fabio Baltieri
2013-01-31 13:06     ` Rafael J. Wysocki
2013-02-01  3:54       ` Viresh Kumar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1359554017-28620-1-git-send-email-fabio.baltieri@linaro.org \
    --to=fabio.baltieri@linaro.org \
    --cc=cpufreq@vger.kernel.org \
    --cc=josephl@nvidia.com \
    --cc=linaro-dev@lists.linaro.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mathieu.poirier@linaro.org \
    --cc=nicolas.pitre@linaro.org \
    --cc=rjw@sisk.pl \
    --cc=swarren@wwwdotorg.org \
    --cc=viresh.kumar@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).