From patchwork Wed Jan 30 13:53:37 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Baltieri X-Patchwork-Id: 2067691 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id C6CD33FD2B for ; Wed, 30 Jan 2013 13:53:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754810Ab3A3Nx4 (ORCPT ); Wed, 30 Jan 2013 08:53:56 -0500 Received: from mail-ea0-f176.google.com ([209.85.215.176]:63815 "EHLO mail-ea0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753676Ab3A3Nxz (ORCPT ); Wed, 30 Jan 2013 08:53:55 -0500 Received: by mail-ea0-f176.google.com with SMTP id a13so724787eaa.21 for ; Wed, 30 Jan 2013 05:53:53 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer :x-gm-message-state; bh=lcnVl7vCF42vk5xJeJF2rypktROw+4qx+CGFDSqz+Fk=; b=DlZL32drKtSGLUQNTzlywALBb1EFgf7h786m6VWi2Bx0nDStPJ0MlPNAoWPurEzAZ0 HvYpnp0CS0UmzQcl3sMr2+mfLsnnekTUxoBhRscKmCJlwqA9Swm1/bPbz+r/Nc3O5ifY Fq+Gy69ENe1LfAxHTq1DxkBaXxFAhvwpINTe/zUh2dElnAadULFfBYgkwoRt9m+D3UKr X9I5+AapmV/+WCSRCjdnGPud4rzMGXk1ikfnAGmi/+Lei+as3MskWuAeViM3jd/vUdgJ PsZXi+3bg9ub8rFzhL0HguwBwk8gddb12FcgYmN1RKBJ+AYghahhDacPIlAQJKDyXGZg mEsw== X-Received: by 10.14.225.72 with SMTP id y48mr15045227eep.46.1359554033750; Wed, 30 Jan 2013 05:53:53 -0800 (PST) Received: from localhost ([2a01:2003:1:1e91:8e70:5aff:feac:ad8]) by mx.google.com with ESMTPS id 46sm2128210eeg.4.2013.01.30.05.53.45 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 30 Jan 2013 05:53:52 -0800 (PST) From: Fabio Baltieri To: "Rafael J. Wysocki" , cpufreq@vger.kernel.org, linux-pm@vger.kernel.org, Viresh Kumar Cc: Linus Walleij , swarren@wwwdotorg.org, linaro-dev@lists.linaro.org, Nicolas Pitre , mathieu.poirier@linaro.org, Joseph Lo , linux-kernel@vger.kernel.org, Fabio Baltieri Subject: [PATCH] cpufreq: governors: clean timer init and exit code Date: Wed, 30 Jan 2013 14:53:37 +0100 Message-Id: <1359554017-28620-1-git-send-email-fabio.baltieri@linaro.org> X-Mailer: git-send-email 1.7.12.1 X-Gm-Message-State: ALoCoQn/Bd3wYnuSjSgoZ2NegxpKJMOJrrl5LObLPJHu9T4r7Uk6NQEvd72N0+W2RYwJ3w81UatZ Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org 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 Signed-off-by: Fabio Baltieri Acked-by: Viresh Kumar --- 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);