From patchwork Fri Oct 18 13:59:45 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 21153 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f72.google.com (mail-pa0-f72.google.com [209.85.220.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id E1046202FF for ; Fri, 18 Oct 2013 14:03:00 +0000 (UTC) Received: by mail-pa0-f72.google.com with SMTP id bj1sf6463006pad.3 for ; Fri, 18 Oct 2013 07:03:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=mime-version:x-gm-message-state:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:in-reply-to:references :x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=M2BMI4gAYgJgpEutHDlWYOwf+TaDEfirq+PIRGwyZow=; b=b3txroteM9mhtcRwXAKDwb7LIDjod9honA4zFM/NK/EOCPN/l49umVRBVMJqd4pz4d l5R8h0jrG7F0m5JxZlxVQI/xfECjaNv7R/nA8dnh8CJ9y5nJgNyax/ikM8/EnI+2eGa8 aMVHitcnFKHhQ5RavpCTuZVnRA7mNy6sgniIKbZ4rL7d2csj8fIKgCu26KS+crP3v9QM yzOqCq4QkODNqfI/zD/jOXg30szv4AUQzbXjTlTq/YEDpA3+nXACukIu34FXD9impWmO nQRGuFmkUPr1ujjW/DeCHedCF/11wMEXtEZFHH3ipzziTPi6WUpBBmHTBoYLEJxDided UaZw== X-Received: by 10.66.160.168 with SMTP id xl8mr1345231pab.14.1382104980168; Fri, 18 Oct 2013 07:03:00 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.53.2 with SMTP id x2ls506347qeo.34.gmail; Fri, 18 Oct 2013 07:03:00 -0700 (PDT) X-Received: by 10.220.196.66 with SMTP id ef2mr2228826vcb.7.1382104980029; Fri, 18 Oct 2013 07:03:00 -0700 (PDT) Received: from mail-ve0-f172.google.com (mail-ve0-f172.google.com [209.85.128.172]) by mx.google.com with ESMTPS id ph5si339724veb.14.2013.10.18.07.03.00 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 18 Oct 2013 07:03:00 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.172 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.172; Received: by mail-ve0-f172.google.com with SMTP id cz12so1701946veb.17 for ; Fri, 18 Oct 2013 07:03:00 -0700 (PDT) X-Gm-Message-State: ALoCoQkg6CkSjrqhb4QtMv4SFQFqVuCrPIBy7tW7YSgilKzqLiASSgtFWabDUQJKLJUCkLjENR5V X-Received: by 10.58.146.71 with SMTP id ta7mr537417veb.23.1382104979943; Fri, 18 Oct 2013 07:02:59 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp38081vcz; Fri, 18 Oct 2013 07:02:59 -0700 (PDT) X-Received: by 10.66.122.40 with SMTP id lp8mr3693193pab.82.1382104979022; Fri, 18 Oct 2013 07:02:59 -0700 (PDT) Received: from mail-pa0-f50.google.com (mail-pa0-f50.google.com [209.85.220.50]) by mx.google.com with ESMTPS id gl1si1564435pac.227.2013.10.18.07.02.58 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 18 Oct 2013 07:02:59 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.50 is neither permitted nor denied by best guess record for domain of viresh.kumar@linaro.org) client-ip=209.85.220.50; Received: by mail-pa0-f50.google.com with SMTP id fa1so4517671pad.23 for ; Fri, 18 Oct 2013 07:02:58 -0700 (PDT) X-Received: by 10.67.3.3 with SMTP id bs3mr3773940pad.46.1382104978626; Fri, 18 Oct 2013 07:02:58 -0700 (PDT) Received: from localhost ([120.56.197.189]) by mx.google.com with ESMTPSA id ab4sm2591120pbc.43.2013.10.18.07.02.54 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 18 Oct 2013 07:02:58 -0700 (PDT) From: Viresh Kumar To: rjw@sisk.pl Cc: linaro-kernel@lists.linaro.org, patches@linaro.org, cpufreq@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Viresh Kumar Subject: [PATCH V2 Resend 22/34] cpufreq: pmac32: Convert to light weight ->target_index() routine Date: Fri, 18 Oct 2013 19:29:45 +0530 Message-Id: <2b47de3028a78c247f12521f42d3257556edc632.1382104515.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 1.7.12.rc2.18.g61b472e In-Reply-To: References: In-Reply-To: References: X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: viresh.kumar@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.172 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , This patch converts existing .target() to newly defined light weight .target_index() routine for this driver. CPUFreq core will call cpufreq_frequency_table_target() before calling this routine and will pass index to it. Signed-off-by: Viresh Kumar --- drivers/cpufreq/pmac32-cpufreq.c | 12 +++--------- drivers/cpufreq/pmac64-cpufreq.c | 17 ++++------------- 2 files changed, 7 insertions(+), 22 deletions(-) diff --git a/drivers/cpufreq/pmac32-cpufreq.c b/drivers/cpufreq/pmac32-cpufreq.c index 6eac1e2..05f705e 100644 --- a/drivers/cpufreq/pmac32-cpufreq.c +++ b/drivers/cpufreq/pmac32-cpufreq.c @@ -374,17 +374,11 @@ static unsigned int pmac_cpufreq_get_speed(unsigned int cpu) } static int pmac_cpufreq_target( struct cpufreq_policy *policy, - unsigned int target_freq, - unsigned int relation) + unsigned int index) { - unsigned int newstate = 0; int rc; - if (cpufreq_frequency_table_target(policy, pmac_cpu_freqs, - target_freq, relation, &newstate)) - return -EINVAL; - - rc = do_set_cpu_speed(policy, newstate, 1); + rc = do_set_cpu_speed(policy, index, 1); ppc_proc_freq = cur_freq * 1000ul; return rc; @@ -453,7 +447,7 @@ static int pmac_cpufreq_resume(struct cpufreq_policy *policy) static struct cpufreq_driver pmac_cpufreq_driver = { .verify = cpufreq_generic_frequency_table_verify, - .target = pmac_cpufreq_target, + .target_index = pmac_cpufreq_target, .get = pmac_cpufreq_get_speed, .init = pmac_cpufreq_cpu_init, .suspend = pmac_cpufreq_suspend, diff --git a/drivers/cpufreq/pmac64-cpufreq.c b/drivers/cpufreq/pmac64-cpufreq.c index 5261b92..234b598 100644 --- a/drivers/cpufreq/pmac64-cpufreq.c +++ b/drivers/cpufreq/pmac64-cpufreq.c @@ -312,27 +312,18 @@ static int g5_pfunc_query_freq(void) * Common interface to the cpufreq core */ -static int g5_cpufreq_target(struct cpufreq_policy *policy, - unsigned int target_freq, unsigned int relation) +static int g5_cpufreq_target(struct cpufreq_policy *policy, unsigned int index) { - unsigned int newstate = 0; struct cpufreq_freqs freqs; int rc; - if (cpufreq_frequency_table_target(policy, g5_cpu_freqs, - target_freq, relation, &newstate)) - return -EINVAL; - - if (g5_pmode_cur == newstate) - return 0; - mutex_lock(&g5_switch_mutex); freqs.old = g5_cpu_freqs[g5_pmode_cur].frequency; - freqs.new = g5_cpu_freqs[newstate].frequency; + freqs.new = g5_cpu_freqs[index].frequency; cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); - rc = g5_switch_freq(newstate); + rc = g5_switch_freq(index); cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); mutex_unlock(&g5_switch_mutex); @@ -355,7 +346,7 @@ static struct cpufreq_driver g5_cpufreq_driver = { .flags = CPUFREQ_CONST_LOOPS, .init = g5_cpufreq_cpu_init, .verify = cpufreq_generic_frequency_table_verify, - .target = g5_cpufreq_target, + .target_index = g5_cpufreq_target, .get = g5_cpufreq_get_speed, .attr = cpufreq_generic_attr, };