From patchwork Fri Oct 18 13:59:29 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 3067681 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C41659F243 for ; Fri, 18 Oct 2013 14:09:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3EC0C2038E for ; Fri, 18 Oct 2013 14:09:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A9F1F204E2 for ; Fri, 18 Oct 2013 14:09:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755187Ab3JROA6 (ORCPT ); Fri, 18 Oct 2013 10:00:58 -0400 Received: from mail-pa0-f45.google.com ([209.85.220.45]:35682 "EHLO mail-pa0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755173Ab3JROA4 (ORCPT ); Fri, 18 Oct 2013 10:00:56 -0400 Received: by mail-pa0-f45.google.com with SMTP id rd3so4609883pab.4 for ; Fri, 18 Oct 2013 07:00:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=4razT5iuEEvixAfJV40JnHr5xOCUdaBWKEhASTeh52A=; b=BKmyJIjGXaZmENtTsH+jYKbiRBv1nQZ2GEZqrKqkMmOeP8VCtx7OfYU0zQH1ViK6Ag +h5+3D2eVmhrjCxOxhodW12Iozefv3VFj1KXCJ4qPi4gpsTZoh2YYr5r1WuypB8O2M1f aDTHK3OlfwQQFFtDQ0bHlO7qOkXohGk7Hfv9vnLPhpccuHw5uAEiFHYZ3F+afcEfykVs 301vb6PnxXA5yUcTMGYCXWJytebGFpJazjQd8EghCBpT0eNilUnl81O4Rpq/KRwp1fSy PikOj7eI0GrMPdbsKCRerJyp8K+52imcMTaBE3a+fhO5XxS9g9m/oi3WV1TPsjcCpNDx D1fQ== X-Gm-Message-State: ALoCoQmkKtGLXKs4lwHAsjFkiZrR9MBtW07pI2QnuRCNP2dXq21fd9kqoFPLgz6tfsrw8YszsAp0 X-Received: by 10.68.245.227 with SMTP id xr3mr2513600pbc.182.1382104855399; Fri, 18 Oct 2013 07:00:55 -0700 (PDT) Received: from localhost ([120.56.197.189]) by mx.google.com with ESMTPSA id go4sm2625658pbb.15.2013.10.18.07.00.50 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 18 Oct 2013 07:00:54 -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 , Shawn Guo Subject: [PATCH V2 Resend 06/34] cpufreq: cpu0: Convert to light weight ->target_index() routine Date: Fri, 18 Oct 2013 19:29:29 +0530 Message-Id: <20a227b774509c1ba39214e4b8f603828c104a6f.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: Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-6.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_WEB, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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. Cc: Shawn Guo Signed-off-by: Viresh Kumar --- drivers/cpufreq/cpufreq-cpu0.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/drivers/cpufreq/cpufreq-cpu0.c b/drivers/cpufreq/cpufreq-cpu0.c index 33ab650..4dbe7ef 100644 --- a/drivers/cpufreq/cpufreq-cpu0.c +++ b/drivers/cpufreq/cpufreq-cpu0.c @@ -35,24 +35,14 @@ static unsigned int cpu0_get_speed(unsigned int cpu) return clk_get_rate(cpu_clk) / 1000; } -static int cpu0_set_target(struct cpufreq_policy *policy, - unsigned int target_freq, unsigned int relation) +static int cpu0_set_target(struct cpufreq_policy *policy, unsigned int index) { struct cpufreq_freqs freqs; struct dev_pm_opp *opp; unsigned long volt = 0, volt_old = 0, tol = 0; long freq_Hz, freq_exact; - unsigned int index; int ret; - ret = cpufreq_frequency_table_target(policy, freq_table, target_freq, - relation, &index); - if (ret) { - pr_err("failed to match target freqency %d: %d\n", - target_freq, ret); - return ret; - } - freq_Hz = clk_round_rate(cpu_clk, freq_table[index].frequency * 1000); if (freq_Hz < 0) freq_Hz = freq_table[index].frequency * 1000; @@ -60,9 +50,6 @@ static int cpu0_set_target(struct cpufreq_policy *policy, freqs.new = freq_Hz / 1000; freqs.old = clk_get_rate(cpu_clk) / 1000; - if (freqs.old == freqs.new) - return 0; - cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); if (!IS_ERR(cpu_reg)) { @@ -128,7 +115,7 @@ static int cpu0_cpufreq_init(struct cpufreq_policy *policy) static struct cpufreq_driver cpu0_cpufreq_driver = { .flags = CPUFREQ_STICKY, .verify = cpufreq_generic_frequency_table_verify, - .target = cpu0_set_target, + .target_index = cpu0_set_target, .get = cpu0_get_speed, .init = cpu0_cpufreq_init, .exit = cpufreq_generic_exit,