From patchwork Tue Aug 13 13:32:31 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 2843778 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 CE2669F271 for ; Tue, 13 Aug 2013 15:49:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 74AE320517 for ; Tue, 13 Aug 2013 15:49:57 +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 26BF820514 for ; Tue, 13 Aug 2013 15:49:56 +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 1V9Emn-0000Bs-Gu; Tue, 13 Aug 2013 13:37:21 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1V9Emb-0008Bu-Ep; Tue, 13 Aug 2013 13:37:10 +0000 Received: from mail-pa0-f51.google.com ([209.85.220.51]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1V9ElG-0007vC-RI for linux-arm-kernel@lists.infradead.org; Tue, 13 Aug 2013 13:35:49 +0000 Received: by mail-pa0-f51.google.com with SMTP id lf1so6061376pab.24 for ; Tue, 13 Aug 2013 06:35:24 -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=0fxSh5+ers6vJTGNWzGuIohg8I0mbS87Tb38rESzSO0=; b=Yd2/ypjhUbbHvouPIG1kcQGniQxFUsseLhjZpX3M/n52ISZ+WIFnqIPkb3a/ln91iH VLW1cBJeBB9y3F87nkcNBr+WgZtcPhiBCS4owm1QJta+g0nIHtDziyOtOBoInCFxLYcs 6AWCuPW7iFXCOWHkEkwM04mjGHC5FYaTYi8yLxXm4inI4zsp6I8U2FO8aFlVzE2zyKxQ UwfgMgDrlu/e45M4ai9s1YVlyQJKzkZp/Phsd5GJB1KRlNKM9Zu3WhvXxe1PbCKlV3vs nObeYROvpY5JRs/dy2EFG9AQvOnXyOgydnsuMUbymwyUg6QSCcNZ/33rjtXdjmD11xP3 fOrQ== X-Gm-Message-State: ALoCoQkca9qesOcjnrx/MVZGiAo0cwfWZpilGoe1ZkPxonXjmOjevphEwCI+djP+yXKJSwGZhzVD X-Received: by 10.68.225.195 with SMTP id rm3mr4674434pbc.70.1376400924417; Tue, 13 Aug 2013 06:35:24 -0700 (PDT) Received: from localhost ([122.172.193.46]) by mx.google.com with ESMTPSA id hk3sm2488095pbb.3.2013.08.13.06.35.20 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 13 Aug 2013 06:35:23 -0700 (PDT) From: Viresh Kumar To: rjw@sisk.pl Subject: [PATCH V2 18/35] cpufreq: loongson2: Covert to light weight ->target_index() routine Date: Tue, 13 Aug 2013 19:02:31 +0530 Message-Id: <038067a60cebe1bb098393f2d5254417c96a033a.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_093547_146164_E77C500E X-CRM114-Status: GOOD ( 11.13 ) 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, linux-arm-kernel@lists.infradead.org, John Crispin 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: John Crispin Signed-off-by: Viresh Kumar --- drivers/cpufreq/loongson2_cpufreq.c | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/drivers/cpufreq/loongson2_cpufreq.c b/drivers/cpufreq/loongson2_cpufreq.c index ed7fbe2..009c29c 100644 --- a/drivers/cpufreq/loongson2_cpufreq.c +++ b/drivers/cpufreq/loongson2_cpufreq.c @@ -53,11 +53,9 @@ static unsigned int loongson2_cpufreq_get(unsigned int cpu) * Here we notify other drivers of the proposed change and the final change. */ static int loongson2_cpufreq_target(struct cpufreq_policy *policy, - unsigned int target_freq, - unsigned int relation) + unsigned int index) { unsigned int cpu = policy->cpu; - unsigned int newstate = 0; cpumask_t cpus_allowed; struct cpufreq_freqs freqs; unsigned int freq; @@ -65,26 +63,17 @@ static int loongson2_cpufreq_target(struct cpufreq_policy *policy, cpus_allowed = current->cpus_allowed; set_cpus_allowed_ptr(current, cpumask_of(cpu)); - if (cpufreq_frequency_table_target - (policy, &loongson2_clockmod_table[0], target_freq, relation, - &newstate)) - return -EINVAL; - freq = ((cpu_clock_freq / 1000) * - loongson2_clockmod_table[newstate].driver_data) / 8; - if (freq < policy->min || freq > policy->max) - return -EINVAL; + loongson2_clockmod_table[index].driver_data) / 8; - pr_debug("cpufreq: requested frequency %u Hz\n", target_freq * 1000); + pr_debug("cpufreq: requested frequency %u Hz\n", + loongson2_clockmod_table[index].frequency * 1000); freqs.old = loongson2_cpufreq_get(cpu); freqs.new = freq; freqs.flags = 0; - if (freqs.new == freqs.old) - return 0; - /* notifiers */ cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); @@ -148,7 +137,7 @@ static struct cpufreq_driver loongson2_cpufreq_driver = { .name = "loongson2", .init = loongson2_cpufreq_cpu_init, .verify = cpufreq_generic_frequency_table_verify, - .target = loongson2_cpufreq_target, + .target_index = loongson2_cpufreq_target, .get = loongson2_cpufreq_get, .exit = loongson2_cpufreq_exit, .attr = cpufreq_generic_attr,