From patchwork Mon Aug 12 17:48:53 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 19027 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f198.google.com (mail-ve0-f198.google.com [209.85.128.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 1F4A9246B8 for ; Mon, 12 Aug 2013 17:51:34 +0000 (UTC) Received: by mail-ve0-f198.google.com with SMTP id 15sf2233421vea.5 for ; Mon, 12 Aug 2013 10:51:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; 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=AaWLbWIr9ATqLxLrDeuiY9jIdU9ullh5PnCMzcdAhi0=; b=OD355pXKjNfBvkcC+pzRRIt0JXaF317MAEaNGL8N+BrjGaPfvjKUooGzieVdd1y+2H I55FFfauXdy7iIKLNnY3pKB5MbUdVdKvKx1mQkiqVKwWeugxn+39ap1GNHDOF4dOp46/ InGxqUHrUcsVsffA8U5Q9Vbxc/QonQJs8X8Wq7nwkTu/F5d2UHBR/PVF2EKrE6zpaLn1 QDLnwfHoJ/aRuahYyYq1sTjyKgA11uMfTOAeLk69g20yMDz1iCOgHd6XyzpnipPhLH+3 3+9bjqU0bu8p7PJkdNLjAxKh7sn/4WArEt6gSUtpRu6djda4lSmPNgflGEFfJMgUkAWg geng== X-Received: by 10.236.206.105 with SMTP id k69mr74514yho.8.1376329893881; Mon, 12 Aug 2013 10:51:33 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.47.11 with SMTP id z11ls2521935qem.68.gmail; Mon, 12 Aug 2013 10:51:33 -0700 (PDT) X-Received: by 10.220.197.72 with SMTP id ej8mr146170vcb.66.1376329893741; Mon, 12 Aug 2013 10:51:33 -0700 (PDT) Received: from mail-vb0-f42.google.com (mail-vb0-f42.google.com [209.85.212.42]) by mx.google.com with ESMTPS id q1si8594743vex.5.2013.08.12.10.51.33 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 12 Aug 2013 10:51:33 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.42 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.42; Received: by mail-vb0-f42.google.com with SMTP id e12so2046602vbg.15 for ; Mon, 12 Aug 2013 10:51:33 -0700 (PDT) X-Gm-Message-State: ALoCoQlU2AkpdLqDu8x/3mCuatMujEo4FoEG3E1rga355NH//VMlTi3Yg7fLT0bpiQKjCRThz34M X-Received: by 10.58.86.7 with SMTP id l7mr145599vez.65.1376329893652; Mon, 12 Aug 2013 10:51:33 -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 u4csp108244vcz; Mon, 12 Aug 2013 10:51:33 -0700 (PDT) X-Received: by 10.68.19.162 with SMTP id g2mr232460pbe.140.1376329893064; Mon, 12 Aug 2013 10:51:33 -0700 (PDT) Received: from mail-pa0-f54.google.com (mail-pa0-f54.google.com [209.85.220.54]) by mx.google.com with ESMTPS id yo4si6260354pac.237.2013.08.12.10.51.32 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 12 Aug 2013 10:51:33 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.54 is neither permitted nor denied by best guess record for domain of viresh.kumar@linaro.org) client-ip=209.85.220.54; Received: by mail-pa0-f54.google.com with SMTP id kx10so2311512pab.13 for ; Mon, 12 Aug 2013 10:51:32 -0700 (PDT) X-Received: by 10.68.27.37 with SMTP id q5mr229551pbg.145.1376329892676; Mon, 12 Aug 2013 10:51:32 -0700 (PDT) Received: from localhost ([122.172.193.46]) by mx.google.com with ESMTPSA id 7sm41355940paf.22.2013.08.12.10.51.29 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 12 Aug 2013 10:51:32 -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 , John Crispin Subject: [PATCH 17/31] cpufreq: loongson2: Covert to light weight ->target() routine Date: Mon, 12 Aug 2013 23:18:53 +0530 Message-Id: <531a63246cdcba02ec21378d06891fc9a8fe587c.1376329128.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.212.42 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_old() to newly defined light weight .target() 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 afdece4..a9e6e35 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_old = loongson2_cpufreq_target, + .target = loongson2_cpufreq_target, .get = loongson2_cpufreq_get, .exit = loongson2_cpufreq_exit, .attr = cpufreq_generic_attr,