From patchwork Tue Aug 13 13:32:20 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 2843665 Return-Path: X-Original-To: patchwork-linux-arm@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 B89B49F271 for ; Tue, 13 Aug 2013 13:36:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 15A9A204F0 for ; Tue, 13 Aug 2013 13:36:35 +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 CEBB7204E2 for ; Tue, 13 Aug 2013 13:36:33 +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 1V9El0-0006qx-Lz; Tue, 13 Aug 2013 13:35:31 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1V9Ekb-0007rF-GX; Tue, 13 Aug 2013 13:35:05 +0000 Received: from mail-pa0-f47.google.com ([209.85.220.47]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1V9Ejs-0007gS-Ko for linux-arm-kernel@lists.infradead.org; Tue, 13 Aug 2013 13:34:23 +0000 Received: by mail-pa0-f47.google.com with SMTP id kl13so1273337pab.20 for ; Tue, 13 Aug 2013 06:33:59 -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=WeNsww8b7xO/IqMfj6i1etq/0/WWLSNkx/cVJEvcxRk=; b=fRnD2uHbiqyxeMvq1B3rZJqaeW400O+EkpqVMcjCR0H442toDAb/+W6wBmAFcfNV+M 55c2od+deA26hBJta/JidrmAtVa1DwpfYNoRV9xOGX+Lb2OLbpUkcXWabn64Jmm0gniE TYV+/n4i6Q4XHPuGSmupd8IC7PdtEWpQ31AqZF7df9laR3cVSbAn2p9czlkPg9/msH6u FjvqanUYvdqhjuAphuTNgYfl4RuUf+rSydwQ55TfheX8XXifz8tS7cpE5jLmUO1cyHcD HQ+eM6rfw4UeDNFm1XSB/wvZ2kTYS0CWB59pnYvxBpbarCyXenEolHjLvgZEhuhJrMQX roiQ== X-Gm-Message-State: ALoCoQkzWW7RY/lubH4I5jFk3eRYXPxkLE73K8OyVTkVAzJr0dbVXDKPg7eP83gxRl5oKH8rnDuY X-Received: by 10.68.171.35 with SMTP id ar3mr4607795pbc.61.1376400839696; Tue, 13 Aug 2013 06:33:59 -0700 (PDT) Received: from localhost ([122.172.193.46]) by mx.google.com with ESMTPSA id eq5sm44001747pbc.15.2013.08.13.06.33.55 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 13 Aug 2013 06:33:58 -0700 (PDT) From: Viresh Kumar To: rjw@sisk.pl Subject: [PATCH V2 07/35] cpufreq: cpu0: Covert to light weight ->target_index() routine Date: Tue, 13 Aug 2013 19:02:20 +0530 Message-Id: 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_093420_858659_FD6B38FD X-CRM114-Status: GOOD ( 12.50 ) X-Spam-Score: -2.6 (--) Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, Viresh Kumar , patches@linaro.org, linux-kernel@vger.kernel.org, cpufreq@vger.kernel.org, Shawn Guo , 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: 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 3d24e7b..fb07a40 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 (cpu_reg) { @@ -145,7 +132,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,