From patchwork Tue Aug 13 13:32:19 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 2843655 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 60660BF546 for ; Tue, 13 Aug 2013 13:35:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 38E40204A2 for ; Tue, 13 Aug 2013 13:35:55 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E1AA120431 for ; Tue, 13 Aug 2013 13:35:53 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1V9Ekj-0006hx-Jm; Tue, 13 Aug 2013 13:35:14 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1V9EkR-0007p6-0w; Tue, 13 Aug 2013 13:34:55 +0000 Received: from mail-pd0-f171.google.com ([209.85.192.171]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1V9Ejl-0007eR-EJ for linux-arm-kernel@lists.infradead.org; Tue, 13 Aug 2013 13:34:14 +0000 Received: by mail-pd0-f171.google.com with SMTP id g10so4891201pdj.2 for ; Tue, 13 Aug 2013 06:33:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=OLxpGrEFe4E5gz4q/dA1bxIlKTlj+oNmJOuDEUxoSJM=; b=P/nQIGTPLGjJNX/75xv9mV44OP1rSEAL3pF1kzwQiMvgaQR/BX6EM2R7DcTeorlvih 3WFnpzvuE8CSToBaMLyyN6V1khDl9z83shcZTNpUGp3GiaW2xYxdj0S49sxAsmzUq+rX 8Aowjd1x6VLI7T/4t6er6U0IxAmtilNKRt5iMFwxGXZ1HMY7+Org+VKD4WfbiocJsSfZ Qzlyw/Nd5pHPYzm62IxtgomZ6kCC/xpEjqT/0jXHg3/uq+cO/2mcX+FD52KPy6kAul8q YyKc7KiFyyOU6/ewwCaVvxrh50CjQEq1MOIUB2nH/nNuuEDRX1eKC00Ml8jGbqACVyyY WYIw== X-Gm-Message-State: ALoCoQm7EJNkHwF/pHCsxqtHMLmMCwvLV9nXYtGdgkekMKRdKRGYyreQtCl5XHcRwwVhQu8GJ77N X-Received: by 10.66.193.98 with SMTP id hn2mr2069266pac.173.1376400831946; Tue, 13 Aug 2013 06:33:51 -0700 (PDT) Received: from localhost ([122.172.193.46]) by mx.google.com with ESMTPSA id ot4sm46846975pac.17.2013.08.13.06.33.48 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 13 Aug 2013 06:33:51 -0700 (PDT) From: Viresh Kumar To: rjw@sisk.pl Subject: [PATCH V2 06/35] cpufreq: blackfin: Covert to light weight ->target_index() routine Date: Tue, 13 Aug 2013 19:02:19 +0530 Message-Id: <57b9c4fa9e22a22debe96f00d868745f8fdaa104.1376392602.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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130813_093413_604075_44B9027B X-CRM114-Status: UNSURE ( 9.62 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -1.9 (-) Cc: linaro-kernel@lists.linaro.org, Steven Miao , linux-pm@vger.kernel.org, Viresh Kumar , patches@linaro.org, linux-kernel@vger.kernel.org, cpufreq@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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: Steven Miao Signed-off-by: Viresh Kumar --- drivers/cpufreq/blackfin-cpufreq.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/drivers/cpufreq/blackfin-cpufreq.c b/drivers/cpufreq/blackfin-cpufreq.c index 48888cf..b343c7b 100644 --- a/drivers/cpufreq/blackfin-cpufreq.c +++ b/drivers/cpufreq/blackfin-cpufreq.c @@ -127,14 +127,11 @@ unsigned long cpu_set_cclk(int cpu, unsigned long new) } #endif -static int bfin_target(struct cpufreq_policy *policy, - unsigned int target_freq, unsigned int relation) +static int bfin_target(struct cpufreq_policy *policy, unsigned int index) { #ifndef CONFIG_BF60x unsigned int plldiv; #endif - unsigned int index; - unsigned long cclk_hz; struct cpufreq_freqs freqs; static unsigned long lpj_ref; static unsigned int lpj_ref_freq; @@ -144,17 +141,11 @@ static int bfin_target(struct cpufreq_policy *policy, cycles_t cycles; #endif - if (cpufreq_frequency_table_target(policy, bfin_freq_table, target_freq, - relation, &index)) - return -EINVAL; - - cclk_hz = bfin_freq_table[index].frequency; - freqs.old = bfin_getfreq_khz(0); - freqs.new = cclk_hz; + freqs.new = bfin_freq_table[index].frequency; pr_debug("cpufreq: changing cclk to %lu; target = %u, oldfreq = %u\n", - cclk_hz, target_freq, freqs.old); + freqs.new, freqs.new, freqs.old); cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); #ifndef CONFIG_BF60x @@ -210,7 +201,7 @@ static int __bfin_cpu_init(struct cpufreq_policy *policy) static struct cpufreq_driver bfin_driver = { .verify = cpufreq_generic_frequency_table_verify, - .target = bfin_target, + .target_index = bfin_target, .get = bfin_getfreq_khz, .init = __bfin_cpu_init, .exit = cpufreq_generic_exit,