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: 21137 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qe0-f70.google.com (mail-qe0-f70.google.com [209.85.128.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 55E44202FF for ; Fri, 18 Oct 2013 14:00:57 +0000 (UTC) Received: by mail-qe0-f70.google.com with SMTP id 8sf4694859qea.1 for ; Fri, 18 Oct 2013 07:00:57 -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=4razT5iuEEvixAfJV40JnHr5xOCUdaBWKEhASTeh52A=; b=NhidaHyl/ew0+hUsAPi+BevSA4LqTlgRUztKA6Wpmj/iEz/PcD7VbJDPgoBKshyPTo E5MRt2IexRNlawsX6cfMHZILAHCWA/KSvmoN7ipLCAZ6g6pmEzVcerkSTQNoPUAMDCUo AZa7wjReI+r45L0OIbILZ36S+lW8yfCE9TLY/SsvWO+cWaWqUQWD84Q5GuG6GMjBWgfn ZjF6SAUqQe6btKLPM3sTEHmliIUsfqjWMcpvRO4iDq4laDPndBZen68n2GnX4RN7e9Jr 8itJcQdia1NgHmUrD7KZadub5eEG8XtNaJUEnu3MnD+SKybaoKgmm2VqleUJt2mvIMuQ QZiQ== X-Received: by 10.224.11.7 with SMTP id r7mr3137965qar.7.1382104857149; Fri, 18 Oct 2013 07:00:57 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.87.36 with SMTP id u4ls1294289qez.56.gmail; Fri, 18 Oct 2013 07:00:57 -0700 (PDT) X-Received: by 10.220.69.212 with SMTP id a20mr2240713vcj.10.1382104856988; Fri, 18 Oct 2013 07:00:56 -0700 (PDT) Received: from mail-ve0-f178.google.com (mail-ve0-f178.google.com [209.85.128.178]) by mx.google.com with ESMTPS id uw4si331134vec.77.2013.10.18.07.00.56 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 18 Oct 2013 07:00:56 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.178 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.178; Received: by mail-ve0-f178.google.com with SMTP id jy13so2123008veb.9 for ; Fri, 18 Oct 2013 07:00:56 -0700 (PDT) X-Gm-Message-State: ALoCoQngm2/9SgiU1MdsKUmfzvy8HhZGuXNfS9ptuuAnT9GRXg1hNO1Wb5GUm8I1TFlmyOL2w7Ol X-Received: by 10.58.64.202 with SMTP id q10mr635015ves.22.1382104856897; Fri, 18 Oct 2013 07:00:56 -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 u4csp37908vcz; Fri, 18 Oct 2013 07:00:56 -0700 (PDT) X-Received: by 10.66.26.49 with SMTP id i17mr3727917pag.148.1382104855954; Fri, 18 Oct 2013 07:00:55 -0700 (PDT) Received: from mail-pb0-f43.google.com (mail-pb0-f43.google.com [209.85.160.43]) by mx.google.com with ESMTPS id yk3si1556861pac.244.2013.10.18.07.00.55 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 18 Oct 2013 07:00:55 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.160.43 is neither permitted nor denied by best guess record for domain of viresh.kumar@linaro.org) client-ip=209.85.160.43; Received: by mail-pb0-f43.google.com with SMTP id md4so3861723pbc.16 for ; Fri, 18 Oct 2013 07:00:55 -0700 (PDT) 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: 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.178 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. 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,