From patchwork Tue Aug 13 13:32:36 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 19078 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-gh0-f198.google.com (mail-gh0-f198.google.com [209.85.160.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 71F14246B8 for ; Tue, 13 Aug 2013 13:36:02 +0000 (UTC) Received: by mail-gh0-f198.google.com with SMTP id r13sf693222ghr.5 for ; Tue, 13 Aug 2013 06:36:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; 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=6sMx69VZOMiuxghpVcpzPRsjABSsapmYpg0XRffh3/c=; b=WlOzGboFyhutIxVZr/ElZQ59IOBldBle86pKHcRy5rCvBlu3P9bv8s0eyrHU1C7fm/ M0VlErlwJO4u2WDvDvcJQgo5ubFi3ux8fuh6/dzOvf4TlLdwTlWBcMlf1aRWRTN1PwQ/ sSo6ktgp8XQOsSC0gxlATsWa+vgi2Mv64FbATP2iZo9DaEqy7UYJ8BOJCEOgl9DVULFC 4vzWPlZtDnpsZhJAM61upq+/oWQs3UxKTnZ5UCnqh+6NoTvRM9aSV5vtl5TWfrNFfLPh tA0aIndpvdEDwioqmcndDWJs7dXHipI86otcuf+nsF1JtlADcUN/InYrxDOrbM0ArD0T Hf4Q== X-Received: by 10.236.150.203 with SMTP id z51mr1643699yhj.23.1376400962184; Tue, 13 Aug 2013 06:36:02 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.86.71 with SMTP id n7ls2693306qez.16.gmail; Tue, 13 Aug 2013 06:36:02 -0700 (PDT) X-Received: by 10.58.219.68 with SMTP id pm4mr332334vec.49.1376400962054; Tue, 13 Aug 2013 06:36:02 -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 r9si9754652vcc.1.2013.08.13.06.36.02 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 13 Aug 2013 06:36:02 -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 oz10so6674331veb.31 for ; Tue, 13 Aug 2013 06:36:02 -0700 (PDT) X-Gm-Message-State: ALoCoQnupGVIIR4ez4K/MFdBUe+Cvx1nxMZKf9OsG52sTJ4UyFkUH/t1SXo/dJSXzIXMj2bNLLny X-Received: by 10.58.56.230 with SMTP id d6mr545556veq.45.1376400961979; Tue, 13 Aug 2013 06:36:01 -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 u4csp154251vcz; Tue, 13 Aug 2013 06:36:01 -0700 (PDT) X-Received: by 10.68.164.33 with SMTP id yn1mr4631459pbb.102.1376400961114; Tue, 13 Aug 2013 06:36:01 -0700 (PDT) Received: from mail-pd0-f178.google.com (mail-pd0-f178.google.com [209.85.192.178]) by mx.google.com with ESMTPS id hk5si4395704pac.154.2013.08.13.06.36.00 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 13 Aug 2013 06:36:01 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.192.178 is neither permitted nor denied by best guess record for domain of viresh.kumar@linaro.org) client-ip=209.85.192.178; Received: by mail-pd0-f178.google.com with SMTP id w10so4937072pde.9 for ; Tue, 13 Aug 2013 06:36:00 -0700 (PDT) X-Received: by 10.68.137.201 with SMTP id qk9mr1620417pbb.199.1376400960718; Tue, 13 Aug 2013 06:36:00 -0700 (PDT) Received: from localhost ([122.172.193.46]) by mx.google.com with ESMTPSA id ia5sm3347646pbc.42.2013.08.13.06.35.56 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 13 Aug 2013 06:36:00 -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, linux-arm-kernel@lists.infradead.org, Viresh Kumar Subject: [PATCH V2 23/35] cpufreq: pmac32: Covert to light weight ->target_index() routine Date: Tue, 13 Aug 2013 19:02:36 +0530 Message-Id: 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 3f8efd2..b1ba708 100644 --- a/drivers/cpufreq/pmac32-cpufreq.c +++ b/drivers/cpufreq/pmac32-cpufreq.c @@ -373,17 +373,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; @@ -458,7 +452,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 0eb9313..7679990 100644 --- a/drivers/cpufreq/pmac64-cpufreq.c +++ b/drivers/cpufreq/pmac64-cpufreq.c @@ -311,27 +311,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); @@ -362,7 +353,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, };