From patchwork Fri Sep 13 13:01:38 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 20206 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ye0-f198.google.com (mail-ye0-f198.google.com [209.85.213.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 4C37020358 for ; Fri, 13 Sep 2013 13:20:59 +0000 (UTC) Received: by mail-ye0-f198.google.com with SMTP id m11sf1159362yen.5 for ; Fri, 13 Sep 2013 06:20:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version: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=+t7V7LFS3OzJn3D0x2gqR27epvylmJuJCkPiCvQN4tQ=; b=bz3fb8iVND9tM43kVDoTbcKo4ZJ66SQEv1YaWjh0d0fxN7QI06MZDPGc/AekXymlA/ bR2EWL00sTZieHU65iN5r2u+IRahHFmnEo4+vWDngXpA6BKU1Mk8zxfSs9KWSZ0wAg2n bcPBLTRnPH06Zd3R+lR2qRnqRJJwIKs7F3aCwSBdzNkU0f07NLkk1DmFMBCpdEsz0bNJ ++34yHZPz/rBYEGEx2OAqgOBJzZHX0mA48SwNVM+vT9cUTX2PfB1dkJliXfJg/iWbbjm ali2nWwileXdSrD9mfahmZ1dtfqug4S2ONWf1fLP6GJL2/PABxybMMg4e9g3bNCsL2Uk TIhg== X-Gm-Message-State: ALoCoQl7wAiuJo+VAVPxfl7hJO+23N8Y8LwvgakH5pQbIXAhN3gT2HC+XE4s9JFYdvyzzLaaQNEr X-Received: by 10.236.111.73 with SMTP id v49mr5031559yhg.46.1379078459078; Fri, 13 Sep 2013 06:20:59 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.16.200 with SMTP id i8ls1156756qed.65.gmail; Fri, 13 Sep 2013 06:20:58 -0700 (PDT) X-Received: by 10.220.46.72 with SMTP id i8mr12180349vcf.10.1379078458859; Fri, 13 Sep 2013 06:20:58 -0700 (PDT) Received: from mail-vb0-f41.google.com (mail-vb0-f41.google.com [209.85.212.41]) by mx.google.com with ESMTPS id o3si401090ves.48.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Sep 2013 06:20:58 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.41 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.41; Received: by mail-vb0-f41.google.com with SMTP id g17so906028vbg.14 for ; Fri, 13 Sep 2013 06:20:58 -0700 (PDT) X-Received: by 10.221.44.136 with SMTP id ug8mr11972778vcb.13.1379078458768; Fri, 13 Sep 2013 06:20:58 -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 u4csp80375vcz; Fri, 13 Sep 2013 06:20:57 -0700 (PDT) X-Received: by 10.66.230.233 with SMTP id tb9mr15566264pac.38.1379078457158; Fri, 13 Sep 2013 06:20:57 -0700 (PDT) Received: from mail-pd0-f173.google.com (mail-pd0-f173.google.com [209.85.192.173]) by mx.google.com with ESMTPS id mj9si11153115pab.335.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Sep 2013 06:20:57 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.192.173 is neither permitted nor denied by best guess record for domain of viresh.kumar@linaro.org) client-ip=209.85.192.173; Received: by mail-pd0-f173.google.com with SMTP id p10so1241409pdj.18 for ; Fri, 13 Sep 2013 06:20:56 -0700 (PDT) X-Received: by 10.68.225.42 with SMTP id rh10mr2095452pbc.176.1379078456696; Fri, 13 Sep 2013 06:20:56 -0700 (PDT) Received: from localhost ([122.167.78.148]) by mx.google.com with ESMTPSA id xe9sm18108177pab.0.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 13 Sep 2013 06:20:56 -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 , Shawn Guo Subject: [PATCH 152/228] cpufreq: cpu0: Convert to light weight ->target_index() routine Date: Fri, 13 Sep 2013 18:31:38 +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.212.41 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 d8756e7..22a358f 100644 --- a/drivers/cpufreq/cpufreq-cpu0.c +++ b/drivers/cpufreq/cpufreq-cpu0.c @@ -34,24 +34,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 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; @@ -59,9 +49,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)) { @@ -127,7 +114,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,